Fixed non-fatal out-of-bounds read in SSE2 SIMD code reported by valgrind when decompressing a JPEG image to a bitmap buffer whose size was not a multiple of 16 bytes.
git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@727 632fc199-4ca6-4c93-a231-07263d6284db
diff --git a/BUILDING.txt b/BUILDING.txt
index 846e969..a889ed7 100644
--- a/BUILDING.txt
+++ b/BUILDING.txt
@@ -11,7 +11,7 @@
-- automake 1.7 or later
-- libtool 1.4 or later
--- NASM
+-- NASM (if building x86 or x86-64 SIMD extensions)
* 0.98, or 2.01 or later is required for a 32-bit build
* NASM 2.00 or later is required for a 64-bit build
* NASM 2.07 or later is required for a 64-bit build on OS X. This can be
@@ -34,6 +34,14 @@
-- GCC v4.1 or later recommended for best performance
+-- If building the TurboJPEG/OSS Java wrapper, JDK or OpenJDK 1.5 or later is
+ required. Some systems, such as OS X 10.4, Solaris 10 and later, and Red
+ Hat Enterprise Linux 5 and later, have this pre-installed. On OS X 10.5 and
+ later, it will be necessary to install the Java Developer Package, which can
+ be downloaded from http://connect.apple.com. For systems that do not have a
+ JDK installed, you can obtain the Oracle Java Development Kit from
+ http://www.java.com.
+
==================
Out-of-Tree Builds
@@ -121,6 +129,22 @@
disable encoding or decoding (respectively.)
+TurboJPEG/OSS Java Wrapper
+--------------------------
+Add --with-java to the configure command line to incorporate an optional Java
+Native Interface wrapper into the TurboJPEG/OSS dynamic library and build the
+Java front-end classes to support it. This allows the TurboJPEG/OSS dynamic
+library to be used directly from Java applications. See java/README for more
+details.
+
+You can set the JAVAC, JAR, and JAVA configure variables to specify
+alternate commands for javac, jar, and java (respectively.) You can also
+set the JAVACFLAGS configure variable to specify arguments that should be
+passed to the Java compiler when building the front-end classes, and JNI_CFLAGS
+to specify arguments that should be passed to the C compiler when building the
+JNI wrapper. Run 'configure --help' for more details.
+
+
========================
Installing libjpeg-turbo
========================
@@ -257,6 +281,55 @@
Use CMake (see recipes below)
+===========
+ARM Support
+===========
+
+This release of libjpeg-turbo can use ARM NEON SIMD instructions to accelerate
+JPEG compression/decompression by approximately 2-4x on ARMv7 and later
+platforms. If libjpeg-turbo is configured on an ARM Linux platform, then the
+build system will automatically include the NEON SIMD routines, if they are
+supported.
+
+
+Building libjpeg-turbo for iOS
+------------------------------
+
+iOS platforms, such as the iPhone and iPad, also use ARM processors, some of
+which support NEON instructions. Additional steps are required to build
+libjpeg-turbo for these platforms. The steps below assume iOS SDK v4.3. If
+you are using a different SDK version, then you will need to modify the
+examples accordingly.
+
+Additional build requirements:
+
+ gas-preprocessor.pl (https://github.com/yuvi/gas-preprocessor) should be
+ installed in your PATH.
+
+Set the following shell variables for simplicity:
+
+ IOS_PLATFORMDIR="/Developer/Platforms/iPhoneOS.platform"
+ IOS_SYSROOT="$IOS_PLATFORMDIR/Developer/SDKs/iPhoneOS4.3.sdk"
+ IOS_GCC="$IOS_PLATFORMDIR/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2"
+
+ ARM v6 only (up to and including iPhone 3G):
+ IOS_CFLAGS="-march=armv6 -mcpu=arm1176jzf-s -mfpu=vfp"
+
+ ARM v7 only (iPhone 3GS and newer, iPad):
+ IOS_CFLAGS="-march=armv7 -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon"
+
+Follow the procedure under "Building libjpeg-turbo" above, adding
+
+ --host arm-apple-darwin10 --enable-static --disable-shared \
+ CC="$IOS_GCC" LD="$IOS_GCC" \
+ CFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT -O3 $IOS_CFLAGS" \
+ LDFLAGS="-mfloat-abi=softfp -isysroot $IOS_SYSROOT $IOS_CFLAGS"
+
+to the configure command line.
+
+Once built, lipo can be used to combine the ARM v6 and v7 variants into a
+universal library.
+
*******************************************************************************
** Building on Windows (Visual C++ or MinGW)
@@ -299,6 +372,9 @@
-- NASM (http://www.nasm.us/) 0.98 or later (NASM 2.05 or later is required for
a 64-bit build)
+-- If building the TurboJPEG/OSS Java wrapper, JDK 1.5 or later is required.
+ This can be downloaded from http://www.java.com.
+
==================
Out-of-Tree Builds
@@ -438,6 +514,22 @@
disable encoding or decoding (respectively.)
+TurboJPEG/OSS Java Wrapper
+--------------------------
+Add "-DWITH_JAVA=1" to the cmake command line to incorporate an optional Java
+Native Interface wrapper into the TurboJPEG/OSS dynamic library and build the
+Java front-end classes to support it. This allows the TurboJPEG/OSS dynamic
+library to be used directly from Java applications. See java/README for more
+details.
+
+If you are using CMake 2.8, you can set the Java_JAVAC_EXECUTABLE,
+Java_JAVA_EXECUTABLE, and Java_JAR_EXECUTABLE CMake variables to specify
+alternate commands or locations for javac, jar, and java (respectively.) If
+you are using CMake 2.6, set JAVA_COMPILE, JAVA_RUNTIME, and JAVA_ARCHIVE
+instead. You can also set the JAVACFLAGS CMake variable to specify arguments
+that should be passed to the Java compiler when building the front-end classes.
+
+
========================
Installing libjpeg-turbo
========================
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f703acf..455d133 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,7 @@
cmake_minimum_required(VERSION 2.6)
project(libjpeg-turbo C)
-set(VERSION 1.1.2)
+set(VERSION 1.2.0)
if(MINGW OR CYGWIN)
execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD)
@@ -18,6 +18,8 @@
message(FATAL_ERROR "Platform not supported by this build system. Use autotools instead.")
endif()
+# This does nothing except when using MinGW. CMAKE_BUILD_TYPE has no meaning
+# in Visual Studio, and it always defaults to Debug when using NMake.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
@@ -25,7 +27,7 @@
message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}")
# This only works if building from the command line. There is currently no way
-# to set a variable's value based on the build type when using the MSVC IDE.
+# to set a variable's value based on the build type when using Visual Studio.
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(BUILD "${BUILD}d")
endif()
@@ -37,6 +39,7 @@
option(WITH_ARITH_DEC "Include arithmetic decoding support" TRUE)
option(WITH_JPEG7 "Emulate libjpeg v7 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
option(WITH_JPEG8 "Emulate libjpeg v8 API/ABI (this makes libjpeg-turbo backward incompatible with libjpeg v6b)" FALSE)
+option(WITH_JAVA "Build Java wrapper for the TurboJPEG/OSS library" FALSE)
if(WITH_ARITH_ENC)
set(C_ARITH_CODING_SUPPORTED 1)
@@ -52,6 +55,12 @@
message(STATUS "Arithmetic decoding support disabled")
endif()
+if(WITH_JAVA)
+ message(STATUS "TurboJPEG/OSS Java wrapper enabled")
+else()
+ message(STATUS "TurboJPEG/OSS Java wrapper disabled")
+endif()
+
set(JPEG_LIB_VERSION 62)
set(DLL_VERSION ${JPEG_LIB_VERSION})
set(FULLVERSION ${DLL_VERSION}.0.0)
@@ -99,6 +108,14 @@
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR})
+if(WITH_JAVA)
+ find_package(Java)
+ find_package(JNI)
+ if(DEFINED JAVACFLAGS)
+ message(STATUS "Java compiler flags = ${JAVACFLAGS}")
+ endif()
+endif()
+
#
# Targets
@@ -139,6 +156,10 @@
message(STATUS "Not using SIMD acceleration")
endif()
+if(WITH_JAVA)
+ add_subdirectory(java)
+endif()
+
add_subdirectory(sharedlib)
add_library(jpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS})
@@ -149,13 +170,22 @@
add_dependencies(jpeg-static simd)
endif()
-add_library(turbojpeg SHARED turbojpegl.c)
+set(TURBOJPEG_SOURCES turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c)
+if(WITH_JAVA)
+ set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} turbojpeg-jni.c)
+ 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 "")
add_library(turbojpeg-static STATIC ${JPEG_SOURCES} ${SIMD_OBJS}
- turbojpegl.c)
+ turbojpeg.c transupp.c jdatadst-tj.c jdatasrc-tj.c)
if(NOT MSVC)
set_target_properties(turbojpeg-static PROPERTIES OUTPUT_NAME turbojpeg)
endif()
@@ -163,17 +193,23 @@
add_dependencies(turbojpeg-static simd)
endif()
-add_executable(jpegut jpegut.c)
-target_link_libraries(jpegut turbojpeg)
+add_executable(tjunittest tjunittest.c tjutil.c)
+target_link_libraries(tjunittest turbojpeg)
-add_executable(jpegut-static jpegut.c)
-target_link_libraries(jpegut-static turbojpeg-static)
+add_executable(tjunittest-static tjunittest.c tjutil.c)
+target_link_libraries(tjunittest-static turbojpeg-static)
-add_executable(jpgtest jpgtest.c bmp.c)
-target_link_libraries(jpgtest 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")
-add_executable(jpgtest-static jpgtest.c bmp.c)
-target_link_libraries(jpgtest-static turbojpeg-static)
+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(cjpeg-static cjpeg.c cdjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c
rdtarga.c)
@@ -200,9 +236,22 @@
# Tests
#
+if(MSVC_IDE)
+ set(OBJDIR "\${CTEST_CONFIGURATION_TYPE}/")
+else()
+ set(OBJDIR "")
+endif()
+
enable_testing()
-add_test(jpegut jpegut)
-add_test(jpegut-yuv jpegut -yuv)
+if(WITH_JAVA)
+add_test(TJUnitTest ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest)
+add_test(TJUnitTest-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -yuv)
+add_test(TJUnitTest-bi ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi)
+add_test(TJUnitTest-bi-yuv ${JAVA_RUNTIME} -cp java/${OBJDIR}turbojpeg.jar -Djava.library.path=${CMAKE_CURRENT_BINARY_DIR}/${OBJDIR} TJUnitTest -bi -yuv)
+endif()
+add_test(tjunittest tjunittest)
+add_test(tjunittest-alloc tjunittest -alloc)
+add_test(tjunittest-yuv tjunittest -yuv)
add_test(cjpeg-int sharedlib/cjpeg -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
add_test(cjpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg)
add_test(cjpeg-fast sharedlib/cjpeg -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
@@ -215,6 +264,8 @@
else()
add_test(cjpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt-nosimd.jpg testoutflt.jpg)
endif()
+add_test(cjpeg-int-gray sharedlib/cjpeg -dct int -grayscale -outfile testoutgray.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
+add_test(cjpeg-int-gray-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimggray.jpg testoutgray.jpg)
add_test(djpeg-int sharedlib/djpeg -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
add_test(djpeg-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.ppm testoutint.ppm)
add_test(djpeg-fast sharedlib/djpeg -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
@@ -225,6 +276,18 @@
else()
add_test(djpeg-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testorig.ppm testoutflt.ppm)
endif()
+add_test(djpeg-int-1_2 sharedlib/djpeg -dct int -scale 1/2 -ppm -outfile testoutint1_2.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
+add_test(djpeg-int-1_2-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint1_2.ppm testoutint1_2.ppm)
+add_test(djpeg-fast-1_2 sharedlib/djpeg -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
+add_test(djpeg-fast-1_2-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst1_2.ppm testoutfst1_2.ppm)
+add_test(djpeg-int-1_4 sharedlib/djpeg -dct int -scale 1/4 -ppm -outfile testoutint1_4.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
+add_test(djpeg-int-1_4-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint1_4.ppm testoutint1_4.ppm)
+add_test(djpeg-fast-1_4 sharedlib/djpeg -dct fast -scale 1/4 -ppm -outfile testoutfst1_4.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
+add_test(djpeg-fast-1_4-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst1_4.ppm testoutfst1_4.ppm)
+add_test(djpeg-int-1_8 sharedlib/djpeg -dct int -scale 1/8 -ppm -outfile testoutint1_8.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
+add_test(djpeg-int-1_8-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint1_8.ppm testoutint1_8.ppm)
+add_test(djpeg-fast-1_8 sharedlib/djpeg -dct fast -scale 1/8 -ppm -outfile testoutfst1_8.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
+add_test(djpeg-fast-1_8-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst1_8.ppm testoutfst1_8.ppm)
add_test(djpeg-256 sharedlib/djpeg -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testorig.jpg)
add_test(djpeg-256-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimg.bmp testout.bmp)
add_test(cjpeg-prog sharedlib/cjpeg -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
@@ -246,8 +309,9 @@
add_test(jpegtran-crop sharedlib/jpegtran -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testorig.jpg)
add_test(jpegtran-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgcrop.jpg testoutcrop.jpg)
-add_test(jpegut-static jpegut-static)
-add_test(jpegut-static-yuv jpegut-static -yuv)
+add_test(tjunittest-static tjunittest-static)
+add_test(tjunittest-static-alloc tjunittest-static -alloc)
+add_test(tjunittest-static-yuv tjunittest-static -yuv)
add_test(cjpeg-static-int cjpeg-static -dct int -outfile testoutint.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
add_test(cjpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.jpg testoutint.jpg)
add_test(cjpeg-static-fast cjpeg-static -dct fast -opt -outfile testoutfst.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
@@ -260,6 +324,8 @@
else()
add_test(cjpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgflt-nosimd.jpg testoutflt.jpg)
endif()
+add_test(cjpeg-static-int-gray cjpeg-static -dct int -grayscale -outfile testoutgray.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
+add_test(cjpeg-static-int-gray-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimggray.jpg testoutgray.jpg)
add_test(djpeg-static-int djpeg-static -dct int -fast -ppm -outfile testoutint.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
add_test(djpeg-static-int-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint.ppm testoutint.ppm)
add_test(djpeg-static-fast djpeg-static -dct fast -ppm -outfile testoutfst.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
@@ -270,6 +336,18 @@
else()
add_test(djpeg-static-float-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testorig.ppm testoutflt.ppm)
endif()
+add_test(djpeg-static-int-1_2 djpeg-static -dct int -scale 1/2 -ppm -outfile testoutint1_2.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
+add_test(djpeg-static-int-1_2-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint1_2.ppm testoutint1_2.ppm)
+add_test(djpeg-static-fast-1_2 djpeg-static -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
+add_test(djpeg-static-fast-1_2-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst1_2.ppm testoutfst1_2.ppm)
+add_test(djpeg-static-int-1_4 djpeg-static -dct int -scale 1/4 -ppm -outfile testoutint1_4.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
+add_test(djpeg-static-int-1_4-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint1_4.ppm testoutint1_4.ppm)
+add_test(djpeg-static-fast-1_4 djpeg-static -dct fast -scale 1/4 -ppm -outfile testoutfst1_4.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
+add_test(djpeg-static-fast-1_4-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst1_4.ppm testoutfst1_4.ppm)
+add_test(djpeg-static-int-1_8 djpeg-static -dct int -scale 1/8 -ppm -outfile testoutint1_8.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
+add_test(djpeg-static-int-1_8-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgint1_8.ppm testoutint1_8.ppm)
+add_test(djpeg-static-fast-1_8 djpeg-static -dct fast -scale 1/8 -ppm -outfile testoutfst1_8.ppm ${CMAKE_SOURCE_DIR}/testorig.jpg)
+add_test(djpeg-static-fast-1_8-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgfst1_8.ppm testoutfst1_8.ppm)
add_test(djpeg-static-256 djpeg-static -dct int -bmp -colors 256 -outfile testout.bmp ${CMAKE_SOURCE_DIR}/testorig.jpg)
add_test(djpeg-static-256-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimg.bmp testout.bmp)
add_test(cjpeg-static-prog cjpeg-static -dct int -progressive -outfile testoutp.jpg ${CMAKE_SOURCE_DIR}/testorig.ppm)
@@ -291,6 +369,9 @@
add_test(jpegtran-static-crop jpegtran-static -crop 120x90+20+50 -transpose -perfect -outfile testoutcrop.jpg ${CMAKE_SOURCE_DIR}/testorig.jpg)
add_test(jpegtran-static-crop-cmp ${CMAKE_COMMAND} -E compare_files ${CMAKE_SOURCE_DIR}/testimgcrop.jpg testoutcrop.jpg)
+add_custom_target(testclean COMMAND ${CMAKE_COMMAND} -P
+ ${CMAKE_SOURCE_DIR}/cmakescripts/testclean.cmake)
+
#
# Installer
@@ -314,6 +395,10 @@
set(INST_DEFS ${INST_DEFS} -DWIN64)
endif()
+if(WITH_JAVA)
+ set(INST_DEFS ${INST_DEFS} -DJAVA)
+endif()
+
if(MSVC_IDE)
set(INST_DEFS ${INST_DEFS} "-DBUILDDIR=${CMAKE_CFG_INTDIR}\\")
else()
@@ -325,10 +410,10 @@
add_custom_target(installer
makensis -nocd ${INST_DEFS} libjpeg-turbo.nsi
DEPENDS jpeg jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom
- cjpeg djpeg jpegtran jpgtest
+ cjpeg djpeg jpegtran tjbench
SOURCES libjpeg-turbo.nsi)
-install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom jpgtest
+install(TARGETS jpeg-static turbojpeg turbojpeg-static rdjpgcom wrjpgcom tjbench
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
diff --git a/ChangeLog.txt b/ChangeLog.txt
index fe264d5..be091dd 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,11 +1,69 @@
-1.1.2
+1.2.0
=====
-[1] Eliminated errors in the output of jpegtran on Windows that occurred when
+[1] Fixed build issue with YASM on Unix systems (the libjpeg-turbo build system
+was not adding the current directory to the assembler include path, so YASM
+was not able to find jsimdcfg.inc.)
+
+[2] Fixed out-of-bounds read in SSE2 SIMD code that occurred when decompressing
+a JPEG image to a bitmap buffer whose size was not a multiple of 16 bytes.
+This was more of an annoyance than an actual bug, since it did not cause any
+actual run-time problems, but the issue showed up when running libjpeg-turbo in
+valgrind. See http://crbug.com/72399 for more information.
+
+
+1.1.90 (1.2 beta1)
+==================
+
+[1] Added a Java wrapper for the TurboJPEG API. See java/README for more
+details.
+
+[2] The TurboJPEG API can now be used to scale down images during
+decompression.
+
+[3] Added SIMD routines for RGB-to-grayscale color conversion, which
+significantly improves the performance of grayscale JPEG compression from an
+RGB source image.
+
+[4] Improved the performance of the C color conversion routines, which are used
+on platforms for which SIMD acceleration is not available.
+
+[5] Added a function to the TurboJPEG API that performs lossless transforms.
+This function is implemented using the same back end as jpegtran, but it
+performs transcoding entirely in memory and allows multiple transforms and/or
+crop operations to be batched together, so the source coefficients only need to
+be read once. This is useful when generating image tiles from a single source
+JPEG.
+
+[6] Added tests for the new TurboJPEG scaled decompression and lossless
+transform features to tjbench (the TurboJPEG benchmark, formerly called
+"jpgtest".)
+
+[7] Added support for 4:4:0 (transposed 4:2:2) subsampling in TurboJPEG, which
+was necessary in order for it to read 4:2:2 JPEG files that had been losslessly
+transposed or rotated 90 degrees.
+
+[8] All legacy VirtualGL code has been re-factored, and this has allowed
+libjpeg-turbo, in its entirety, to be re-licensed under a BSD-style license.
+
+[9] libjpeg-turbo can now be built with YASM.
+
+[10] Added SIMD acceleration for ARM Linux and iOS platforms that support
+NEON instructions.
+
+[11] Refactored the TurboJPEG C API and documented it using Doxygen. The
+TurboJPEG 1.2 API uses pixel formats to define the size and component order of
+the uncompressed source/destination images, and it includes a more efficient
+version of TJBUFSIZE() that computes a worst-case JPEG size based on the level
+of chrominance subsampling. The refactored implementation of TurboJPEG/OSS
+now uses the libjpeg memory source and destination managers, which allows the
+TurboJPEG compressor to grow the JPEG buffer as necessary.
+
+[12] Eliminated errors in the output of jpegtran on Windows that occurred when
the application was invoked using I/O redirection
(jpegtran <input.jpg >output.jpg).
-[2] The inclusion of libjpeg v7 and v8 emulation as well as arithmetic coding
+[13] The inclusion of libjpeg v7 and v8 emulation as well as arithmetic coding
support in libjpeg-turbo v1.1.0 introduced several new error constants in
jerror.h, and these were mistakenly enabled for all emulation modes, causing
the error enum in libjpeg-turbo to sometimes have different values than the
@@ -14,18 +72,17 @@
error value. The fix was to include the new error constants conditionally
based on whether libjpeg v7 or v8 emulation was enabled.
-[3] Fixed an issue whereby Windows applications that used libjpeg-turbo would
+[14] Fixed an issue whereby Windows applications that used libjpeg-turbo would
fail to compile if the Windows system headers were included before jpeglib.h.
This issue was caused by a conflict in the definition of the INT32 type.
-[4] Fixed 32-bit supplementary package for amd64 Debian systems which was
+[15] Fixed 32-bit supplementary package for amd64 Debian systems, which was
broken by enhancements to the packaging system in 1.1.
-[5] Fixed out-of-bounds read in SSE2 SIMD code that occurred when decompressing
-a JPEG image to a bitmap buffer whose size was not a multiple of 16 bytes.
-This was more of an annoyance than an actual bug, since it did not cause any
-actual run-time problems, but the issue showed up when running libjpeg-turbo in
-valgrind. See http://crbug.com/72399 for more information.
+[16] When decompressing a JPEG image using an output colorspace of
+JCS_EXT_RGBX, JCS_EXT_BGRX, JCS_EXT_XBGR, or JCS_EXT_XRGB, libjpeg-turbo will
+now set the unused byte to 0xFF, which allows applications to interpret that
+byte as an alpha channel (0xFF = opaque).
1.1.1
diff --git a/LGPL.txt b/LGPL.txt
deleted file mode 100644
index b1e3f5a..0000000
--- a/LGPL.txt
+++ /dev/null
@@ -1,504 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index fa803b1..0000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,53 +0,0 @@
- wxWindows Library Licence, Version 3.1
- ======================================
-
- Copyright (C) 1998-2005 Julian Smart, Robert Roebling et al
-
- Everyone is permitted to copy and distribute verbatim copies
- of this licence document, but changing it is not allowed.
-
- WXWINDOWS LIBRARY LICENCE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Library General Public Licence as published by
- the Free Software Foundation; either version 2 of the Licence, or (at
- your option) any later version.
-
- This library is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
- General Public Licence for more details.
-
- You should have received a copy of the GNU Library General Public Licence
- along with this software, usually in a file named COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- Boston, MA 02111-1307 USA.
-
- EXCEPTION NOTICE
-
- 1. As a special exception, the copyright holders of this library give
- permission for additional uses of the text contained in this release of
- the library as licenced under the wxWindows Library Licence, applying
- either version 3.1 of the Licence, or (at your option) any later version of
- the Licence as published by the copyright holders of version
- 3.1 of the Licence document.
-
- 2. The exception is that you may use, copy, link, modify and distribute
- under your own terms, binary object code versions of works based
- on the Library.
-
- 3. If you copy code from files distributed under the terms of the GNU
- General Public Licence or the GNU Library General Public Licence into a
- copy of this library, as this licence permits, the exception does not
- apply to the code that you add in this way. To avoid misleading anyone as
- to the status of such modified files, you must delete this exception
- notice from such code and/or adjust the licensing conditions notice
- accordingly.
-
- 4. If you write modifications of your own for this library, it is your
- choice whether to permit this exception to apply to your modifications.
- If you do not wish that, you must delete the exception notice from such
- code and/or adjust the licensing conditions notice accordingly.
-
-
diff --git a/Makefile.am b/Makefile.am
index 005f040..560af9a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,19 +34,35 @@
endif
-libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpegl.c turbojpeg.h \
- turbojpeg-mapfile
+libturbojpeg_la_SOURCES = $(libjpeg_la_SOURCES) turbojpeg.c turbojpeg.h \
+ transupp.c transupp.h jdatadst-tj.c jdatasrc-tj.c
+
+SUBDIRS = java
+
+if WITH_JAVA
+
+libturbojpeg_la_SOURCES += turbojpeg-jni.c
+libturbojpeg_la_CFLAGS = ${JNI_CFLAGS}
+TJMAPFILE = turbojpeg-mapfile.jni
+
+else
+
+TJMAPFILE = turbojpeg-mapfile
+
+endif
+
+libturbojpeg_la_SOURCES += $(TJMAPFILE)
if VERSION_SCRIPT
-libturbojpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)$(srcdir)/turbojpeg-mapfile
+libturbojpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)$(srcdir)/$(TJMAPFILE)
libjpeg_la_LDFLAGS += $(VERSION_SCRIPT_FLAG)libjpeg.map
endif
if WITH_SIMD
-SUBDIRS = simd
+SUBDIRS += simd
libjpeg_la_LIBADD = simd/libsimd.la
libturbojpeg_la_LIBADD = simd/libsimd.la
@@ -56,18 +72,19 @@
endif
-TSTHDRS = rrutil.h rrtimer.h
+bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom tjbench
+noinst_PROGRAMS = tjunittest
-bin_PROGRAMS = cjpeg djpeg jpegtran rdjpgcom wrjpgcom jpgtest
-noinst_PROGRAMS = jpegut
+tjbench_SOURCES = tjbench.c bmp.h bmp.c tjutil.h tjutil.c rdbmp.c rdppm.c \
+ wrbmp.c wrppm.c
-jpgtest_SOURCES = $(TSTHDRS) jpgtest.c bmp.h bmp.c
+tjbench_LDADD = libturbojpeg.la libjpeg.la -lm
-jpgtest_LDADD = libturbojpeg.la -lm
+tjbench_CFLAGS = -DBMP_SUPPORTED -DPPM_SUPPORTED
-jpegut_SOURCES = $(TSTHDRS) jpegut.c bmp.h bmp.c
+tjunittest_SOURCES = tjunittest.c tjutil.h tjutil.c
-jpegut_LDADD = libturbojpeg.la
+tjunittest_LDADD = libturbojpeg.la
cjpeg_SOURCES = cdjpeg.h cderror.h cdjpeg.c cjpeg.c rdbmp.c rdgif.c \
rdppm.c rdswitch.c rdtarga.c
@@ -102,24 +119,34 @@
DOCS= README install.txt usage.txt wizard.txt example.c libjpeg.txt \
structure.txt coderules.txt filelist.txt jconfig.txt change.log \
- README-turbo.txt rdrle.c wrrle.c LICENSE.txt LGPL.txt BUILDING.txt \
- ChangeLog.txt
+ README-turbo.txt rdrle.c wrrle.c BUILDING.txt ChangeLog.txt
TESTFILES= testorig.jpg testorig.ppm testimg.bmp testimgflt.jpg \
testimgfst.jpg testimgint.jpg testimgp.jpg testimgflt.ppm testimgfst.ppm \
testimgint.ppm testimgflt-nosimd.jpg testimgcrop.jpg testimgari.jpg \
- testimgari.ppm testimgfst100.jpg
+ testimgari.ppm testimgfst100.jpg testimggray.jpg testimgfst1_2.ppm \
+ testimgfst1_4.ppm testimgfst1_8.ppm testimgint1_2.ppm testimgint1_4.ppm \
+ testimgint1_8.ppm
+
EXTRA_DIST = win release $(DOCS) $(TESTFILES) CMakeLists.txt \
- sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in
+ sharedlib/CMakeLists.txt cmakescripts libjpeg.map.in doc doxygen.config \
+ jccolext.c jdcolext.c jdmrgext.c
dist-hook:
rm -rf `find $(distdir) -name .svn`
test: testclean all
- ./jpegut
- ./jpegut -yuv
+if WITH_JAVA
+ $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest
+ $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -bi
+ $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv
+ $(JAVA) -cp java/turbojpeg.jar -Djava.library.path=.libs TJUnitTest -yuv -bi
+endif
+ ./tjunittest
+ ./tjunittest -alloc
+ ./tjunittest -yuv
./cjpeg -dct int -outfile testoutint.jpg $(srcdir)/testorig.ppm
cmp $(srcdir)/testimgint.jpg testoutint.jpg
./cjpeg -dct fast -opt -outfile testoutfst.jpg $(srcdir)/testorig.ppm
@@ -127,21 +154,35 @@
./cjpeg -dct fast -quality 100 -opt -outfile testoutfst100.jpg $(srcdir)/testorig.ppm
cmp $(srcdir)/testimgfst100.jpg testoutfst100.jpg
./cjpeg -dct float -outfile testoutflt.jpg $(srcdir)/testorig.ppm
-if WITH_SIMD
+if WITH_SSE_FLOAT_DCT
cmp $(srcdir)/testimgflt.jpg testoutflt.jpg
else
cmp $(srcdir)/testimgflt-nosimd.jpg testoutflt.jpg
endif
+ ./cjpeg -dct int -grayscale -outfile testoutgray.jpg $(srcdir)/testorig.ppm
+ cmp $(srcdir)/testimggray.jpg testoutgray.jpg
./djpeg -dct int -fast -ppm -outfile testoutint.ppm $(srcdir)/testorig.jpg
cmp $(srcdir)/testimgint.ppm testoutint.ppm
./djpeg -dct fast -ppm -outfile testoutfst.ppm $(srcdir)/testorig.jpg
cmp $(srcdir)/testimgfst.ppm testoutfst.ppm
./djpeg -dct float -ppm -outfile testoutflt.ppm $(srcdir)/testorig.jpg
-if WITH_SIMD
+if WITH_SSE_FLOAT_DCT
cmp $(srcdir)/testimgflt.ppm testoutflt.ppm
else
cmp $(srcdir)/testorig.ppm testoutflt.ppm
endif
+ ./djpeg -dct int -scale 1/2 -ppm -outfile testoutint1_2.ppm $(srcdir)/testorig.jpg
+ cmp $(srcdir)/testimgint1_2.ppm testoutint1_2.ppm
+ ./djpeg -dct fast -scale 1/2 -ppm -outfile testoutfst1_2.ppm $(srcdir)/testorig.jpg
+ cmp $(srcdir)/testimgfst1_2.ppm testoutfst1_2.ppm
+ ./djpeg -dct int -scale 1/4 -ppm -outfile testoutint1_4.ppm $(srcdir)/testorig.jpg
+ cmp $(srcdir)/testimgint1_4.ppm testoutint1_4.ppm
+ ./djpeg -dct fast -scale 1/4 -ppm -outfile testoutfst1_4.ppm $(srcdir)/testorig.jpg
+ cmp $(srcdir)/testimgfst1_4.ppm testoutfst1_4.ppm
+ ./djpeg -dct int -scale 1/8 -ppm -outfile testoutint1_8.ppm $(srcdir)/testorig.jpg
+ cmp $(srcdir)/testimgint1_8.ppm testoutint1_8.ppm
+ ./djpeg -dct fast -scale 1/8 -ppm -outfile testoutfst1_8.ppm $(srcdir)/testorig.jpg
+ cmp $(srcdir)/testimgfst1_8.ppm testoutfst1_8.ppm
./djpeg -dct int -bmp -colors 256 -outfile testout.bmp $(srcdir)/testorig.jpg
cmp $(srcdir)/testimg.bmp testout.bmp
if WITH_ARITH_ENC
@@ -166,22 +207,31 @@
testclean:
rm -f testout*
- rm -f *_GRAYQ[0-9]*.bmp
- rm -f *_GRAYQ[0-9]*.ppm
- rm -f *_GRAYQ[0-9]*.jpg
+ rm -f *_GRAY_*.bmp
+ rm -f *_GRAY_*.png
+ rm -f *_GRAY_*.ppm
+ rm -f *_GRAY_*.jpg
rm -f *_GRAY.yuv
- rm -f *_420Q[0-9]*.bmp
- rm -f *_420Q[0-9]*.ppm
- rm -f *_420Q[0-9]*.jpg
+ rm -f *_420_*.bmp
+ rm -f *_420_*.png
+ rm -f *_420_*.ppm
+ rm -f *_420_*.jpg
rm -f *_420.yuv
- rm -f *_422Q[0-9]*.bmp
- rm -f *_422Q[0-9]*.ppm
- rm -f *_422Q[0-9]*.jpg
+ rm -f *_422_*.bmp
+ rm -f *_422_*.png
+ rm -f *_422_*.ppm
+ rm -f *_422_*.jpg
rm -f *_422.yuv
- rm -f *_444Q[0-9]*.bmp
- rm -f *_444Q[0-9]*.ppm
- rm -f *_444Q[0-9]*.jpg
+ rm -f *_444_*.bmp
+ rm -f *_444_*.png
+ rm -f *_444_*.ppm
+ rm -f *_444_*.jpg
rm -f *_444.yuv
+ rm -f *_440_*.bmp
+ rm -f *_440_*.png
+ rm -f *_440_*.ppm
+ rm -f *_440_*.jpg
+ rm -f *_440.yuv
if X86_64
diff --git a/README-turbo.txt b/README-turbo.txt
index fec34e0..ac37556 100755
--- a/README-turbo.txt
+++ b/README-turbo.txt
@@ -26,27 +26,56 @@
** License
*******************************************************************************
-The TurboJPEG/OSS wrapper, as well as some of the optimizations to the Huffman
-encoder (jchuff.c) and decoder (jdhuff.c), were borrowed from VirtualGL, and
-thus any distribution of libjpeg-turbo which includes those files must, as a
-whole, be subject to the terms of the wxWindows Library Licence, Version 3.1.
-A copy of this license can be found in this directory under LICENSE.txt. The
-wxWindows Library License is based on the LGPL but includes provisions which
-allow the Library to be statically linked into proprietary libraries and
-applications without requiring the resulting binaries to be distributed under
-the terms of the LGPL.
+libjpeg-turbo is licensed under a non-restrictive, BSD-style license
+(see README.) The TurboJPEG/OSS wrapper (both C and Java versions) and
+associated test programs bear a similar license, which is reproduced below:
-The rest of the source code, apart from TurboJPEG/OSS and the Huffman codec
-optimizations, falls under a less restrictive, BSD-style license (see README.)
-You can choose to distribute libjpeg-turbo, as a whole, under this BSD-style
-license by simply removing TurboJPEG/OSS and replacing the optimized jchuff.c
-and jdhuff.c with their unoptimized counterparts from the libjpeg v6b source.
+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.
*******************************************************************************
** Using libjpeg-turbo
*******************************************************************************
+libjpeg-turbo includes two APIs which can be used to compress and decompress
+JPEG images:
+
+ TurboJPEG/OSS: This API wraps libjpeg-turbo and provides an easy-to-use
+ interface for compressing and decompressing JPEG images in memory. It also
+ provides some features that would not be straightforward to implement using
+ the underlying libjpeg API, such as generating planar YUV images and
+ performing multiple simultaneous lossless transforms on an image. The Java
+ interface for libjpeg-turbo is written on top of TurboJPEG/OSS.
+
+ libjpeg API: This is the industry standard API for compressing and
+ decompressing JPEG images. It is more difficult to use than TurboJPEG/OSS
+ but also more powerful. libjpeg-turbo is both API/ABI-compatible and
+ mathematically compatible with libjpeg v6b. It can also optionally be
+ configured to be API/ABI-compatible with libjpeg v7 and v8 (see below.)
+
+
=============================
Replacing libjpeg at Run Time
=============================
diff --git a/acinclude.m4 b/acinclude.m4
index cc10a21..70e2555 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -3,7 +3,7 @@
# Check that NASM exists and determine flags
AC_DEFUN([AC_PROG_NASM],[
-AC_CHECK_PROGS(NASM, [nasm nasmw])
+AC_CHECK_PROGS(NASM, [nasm nasmw yasm])
test -z "$NASM" && AC_MSG_ERROR([no nasm (Netwide Assembler) found])
AC_MSG_CHECKING([for object file format of host system])
@@ -134,3 +134,49 @@
fi
])
+
+# AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE
+# --------------------------
+# Test whether the assembler is suitable and supports NEON instructions
+AC_DEFUN([AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE],[
+ ac_good_gnu_arm_assembler=no
+ ac_save_CC="$CC"
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CCASFLAGS -x assembler-with-cpp"
+ CC="$CCAS"
+ AC_COMPILE_IFELSE([[
+ .text
+ .fpu neon
+ .arch armv7a
+ .object_arch armv4
+ .arm
+ pld [r0]
+ vmovn.u16 d0, q0]], ac_good_gnu_arm_assembler=yes)
+
+ ac_use_gas_preprocessor=no
+ if test "x$ac_good_gnu_arm_assembler" = "xno" ; then
+ CC="gas-preprocessor.pl $CCAS"
+ AC_COMPILE_IFELSE([[
+ .text
+ .fpu neon
+ .arch armv7a
+ .object_arch armv4
+ .arm
+ pld [r0]
+ vmovn.u16 d0, q0]], ac_use_gas_preprocessor=yes)
+ fi
+ CFLAGS="$ac_save_CFLAGS"
+ CC="$ac_save_CC"
+
+ if test "x$ac_use_gas_preprocessor" = "xyes" ; then
+ CCAS="gas-preprocessor.pl $CCAS"
+ AC_SUBST([CCAS])
+ ac_good_gnu_arm_assembler=yes
+ fi
+
+ if test "x$ac_good_gnu_arm_assembler" = "xyes" ; then
+ $1
+ else
+ $2
+ fi
+])
diff --git a/bmp.c b/bmp.c
index 3ccc877..4caefb4 100644
--- a/bmp.c
+++ b/bmp.c
@@ -1,370 +1,274 @@
-/* Copyright (C)2004 Landmark Graphics Corporation
- * Copyright (C)2005 Sun Microsystems, Inc.
+/*
+ * Copyright (C)2011 D. R. Commander. All Rights Reserved.
*
- * This library is free software and may be redistributed and/or modified under
- * the terms of the wxWindows Library License, Version 3.1 or (at your option)
- * any later version. The full license is in the LICENSE.txt file included
- * with this distribution.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * wxWindows Library License for more details.
-*/
+ * - 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.
+ */
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#ifdef _WIN32
- #include <io.h>
-#else
- #include <unistd.h>
-#endif
-#include "./rrutil.h"
-#include "./bmp.h"
+#include <setjmp.h>
+#include <errno.h>
+#include "cdjpeg.h"
+#include <jpeglib.h>
+#include <jpegint.h>
+#include "tjutil.h"
+#include "bmp.h"
-#ifndef BI_BITFIELDS
-#define BI_BITFIELDS 3L
-#endif
-#ifndef BI_RGB
-#define BI_RGB 0L
-#endif
-#define BMPHDRSIZE 54
-typedef struct _bmphdr
+/* This duplicates the functionality of the VirtualGL bitmap library using
+ the components from cjpeg and djpeg */
+
+
+/* Error handling (based on example in example.c) */
+
+static char errStr[JMSG_LENGTH_MAX]="No error";
+
+struct my_error_mgr
{
- unsigned short bfType;
- unsigned int bfSize;
- unsigned short bfReserved1, bfReserved2;
- unsigned int bfOffBits;
+ struct jpeg_error_mgr pub;
+ jmp_buf setjmp_buffer;
+};
+typedef struct my_error_mgr *my_error_ptr;
- unsigned int biSize;
- int biWidth, biHeight;
- unsigned short biPlanes, biBitCount;
- unsigned int biCompression, biSizeImage;
- int biXPelsPerMeter, biYPelsPerMeter;
- unsigned int biClrUsed, biClrImportant;
-} bmphdr;
-
-static const char *__bmperr="No error";
-
-static const int ps[BMPPIXELFORMATS]={3, 4, 3, 4, 4, 4};
-static const int roffset[BMPPIXELFORMATS]={0, 0, 2, 2, 3, 1};
-static const int goffset[BMPPIXELFORMATS]={1, 1, 1, 1, 2, 2};
-static const int boffset[BMPPIXELFORMATS]={2, 2, 0, 0, 1, 3};
-
-#define _throw(m) {__bmperr=m; retcode=-1; goto finally;}
-#define _unix(f) {if((f)==-1) _throw(strerror(errno));}
-#define _catch(f) {if((f)==-1) {retcode=-1; goto finally;}}
-
-#define readme(fd, addr, size) \
- if((bytesread=read(fd, addr, (size)))==-1) _throw(strerror(errno)); \
- if(bytesread!=(size)) _throw("Read error");
-
-void pixelconvert(unsigned char *srcbuf, enum BMPPIXELFORMAT srcformat,
- int srcpitch, unsigned char *dstbuf, enum BMPPIXELFORMAT dstformat, int dstpitch,
- int w, int h, int flip)
+static void my_error_exit(j_common_ptr cinfo)
{
- unsigned char *srcptr, *srcptr0, *dstptr, *dstptr0;
- int i, j;
-
- srcptr=flip? &srcbuf[srcpitch*(h-1)]:srcbuf;
- for(j=0, dstptr=dstbuf; j<h; j++,
- srcptr+=flip? -srcpitch:srcpitch, dstptr+=dstpitch)
- {
- for(i=0, srcptr0=srcptr, dstptr0=dstptr; i<w; i++,
- srcptr0+=ps[srcformat], dstptr0+=ps[dstformat])
- {
- dstptr0[roffset[dstformat]]=srcptr0[roffset[srcformat]];
- dstptr0[goffset[dstformat]]=srcptr0[goffset[srcformat]];
- dstptr0[boffset[dstformat]]=srcptr0[boffset[srcformat]];
- }
- }
+ my_error_ptr myerr=(my_error_ptr)cinfo->err;
+ (*cinfo->err->output_message)(cinfo);
+ longjmp(myerr->setjmp_buffer, 1);
}
-int loadppm(int *fd, unsigned char **buf, int *w, int *h,
- enum BMPPIXELFORMAT f, int align, int dstbottomup, int ascii)
+/* Based on output_message() in jerror.c */
+
+static void my_output_message(j_common_ptr cinfo)
{
- FILE *fs=NULL; int retcode=0, scalefactor, dstpitch;
- unsigned char *tempbuf=NULL; char temps[255], temps2[255];
- int numread=0, totalread=0, pixel[3], i, j;
+ (*cinfo->err->format_message)(cinfo, errStr);
+}
- if((fs=fdopen(*fd, "r"))==NULL) _throw(strerror(errno));
+#define _throw(m) {snprintf(errStr, JMSG_LENGTH_MAX, "%s", m); \
+ retval=-1; goto bailout;}
+#define _throwunix(m) {snprintf(errStr, JMSG_LENGTH_MAX, "%s\n%s", m, \
+ strerror(errno)); retval=-1; goto bailout;}
- do
+
+static void pixelconvert(unsigned char *srcbuf, int srcpf, int srcbottomup,
+ unsigned char *dstbuf, int dstpf, int dstbottomup, int w, int h)
+{
+ unsigned char *srcptr=srcbuf, *srcptr2;
+ int srcps=tjPixelSize[srcpf];
+ int srcstride=srcbottomup? -w*srcps:w*srcps;
+ unsigned char *dstptr=dstbuf, *dstptr2;
+ int dstps=tjPixelSize[dstpf];
+ int dststride=dstbottomup? -w*dstps:w*dstps;
+ int row, col;
+
+ if(srcbottomup) srcptr=&srcbuf[w*srcps*(h-1)];
+ if(dstbottomup) dstptr=&dstbuf[w*dstps*(h-1)];
+ for(row=0; row<h; row++, srcptr+=srcstride, dstptr+=dststride)
{
- if(!fgets(temps, 255, fs)) _throw("Read error");
- if(strlen(temps)==0 || temps[0]=='\n') continue;
- if(sscanf(temps, "%s", temps2)==1 && temps2[1]=='#') continue;
- switch(totalread)
+ for(col=0, srcptr2=srcptr, dstptr2=dstptr; col<w; col++, srcptr2+=srcps,
+ dstptr2+=dstps)
{
- case 0:
- if((numread=sscanf(temps, "%d %d %d", w, h, &scalefactor))==EOF)
- _throw("Read error");
- break;
- case 1:
- if((numread=sscanf(temps, "%d %d", h, &scalefactor))==EOF)
- _throw("Read error");
- break;
- case 2:
- if((numread=sscanf(temps, "%d", &scalefactor))==EOF)
- _throw("Read error");
- break;
- }
- totalread+=numread;
- } while(totalread<3);
- if((*w)<1 || (*h)<1 || scalefactor<1) _throw("Corrupt PPM header");
-
- dstpitch=(((*w)*ps[f])+(align-1))&(~(align-1));
- if((*buf=(unsigned char *)malloc(dstpitch*(*h)))==NULL)
- _throw("Memory allocation error");
- if(ascii)
- {
- for(j=0; j<*h; j++)
- {
- for(i=0; i<*w; i++)
- {
- if(fscanf(fs, "%d%d%d", &pixel[0], &pixel[1], &pixel[2])!=3)
- _throw("Read error");
- (*buf)[j*dstpitch+i*ps[f]+roffset[f]]=(unsigned char)(pixel[0]*255/scalefactor);
- (*buf)[j*dstpitch+i*ps[f]+goffset[f]]=(unsigned char)(pixel[1]*255/scalefactor);
- (*buf)[j*dstpitch+i*ps[f]+boffset[f]]=(unsigned char)(pixel[2]*255/scalefactor);
- }
+ dstptr2[tjRedOffset[dstpf]]=srcptr2[tjRedOffset[srcpf]];
+ dstptr2[tjGreenOffset[dstpf]]=srcptr2[tjGreenOffset[srcpf]];
+ dstptr2[tjBlueOffset[dstpf]]=srcptr2[tjBlueOffset[srcpf]];
}
}
- else
- {
- if(scalefactor!=255)
- _throw("Binary PPMs must have 8-bit components");
- if((tempbuf=(unsigned char *)malloc((*w)*(*h)*3))==NULL)
- _throw("Memory allocation error");
- if(fread(tempbuf, (*w)*(*h)*3, 1, fs)!=1) _throw("Read error");
- pixelconvert(tempbuf, BMP_RGB, (*w)*3, *buf, f, dstpitch, *w, *h, dstbottomup);
- }
-
- finally:
- if(fs) {fclose(fs); *fd=-1;}
- if(tempbuf) free(tempbuf);
- return retcode;
}
int loadbmp(char *filename, unsigned char **buf, int *w, int *h,
- enum BMPPIXELFORMAT f, int align, int dstbottomup)
+ int dstpf, int bottomup)
{
- int fd=-1, bytesread, srcpitch, srcbottomup=1, srcps, dstpitch,
- retcode=0;
- unsigned char *tempbuf=NULL;
- bmphdr bh; int flags=O_RDONLY;
+ int retval=0, dstps, srcpf, tempc;
+ struct jpeg_compress_struct cinfo;
+ struct my_error_mgr jerr;
+ cjpeg_source_ptr src;
+ FILE *file=NULL;
- dstbottomup=dstbottomup? 1:0;
- #ifdef _WIN32
- flags|=O_BINARY;
- #endif
- if(!filename || !buf || !w || !h || f<0 || f>BMPPIXELFORMATS-1 || align<1)
- _throw("invalid argument to loadbmp()");
- if((align&(align-1))!=0)
- _throw("Alignment must be a power of 2");
- _unix(fd=open(filename, flags));
+ memset(&cinfo, 0, sizeof(struct jpeg_compress_struct));
- readme(fd, &bh.bfType, sizeof(unsigned short));
- if(!littleendian()) bh.bfType=byteswap16(bh.bfType);
+ if(!filename || !buf || !w || !h || dstpf<0 || dstpf>=TJ_NUMPF)
+ _throw("loadbmp(): Invalid argument");
- if(bh.bfType==0x3650)
+ if((file=fopen(filename, "rb"))==NULL)
+ _throwunix("loadbmp(): Cannot open input file");
+
+ cinfo.err=jpeg_std_error(&jerr.pub);
+ jerr.pub.error_exit=my_error_exit;
+ jerr.pub.output_message=my_output_message;
+
+ if(setjmp(jerr.setjmp_buffer))
{
- _catch(loadppm(&fd, buf, w, h, f, align, dstbottomup, 0));
- goto finally;
- }
- if(bh.bfType==0x3350)
- {
- _catch(loadppm(&fd, buf, w, h, f, align, dstbottomup, 1));
- goto finally;
+ /* If we get here, the JPEG code has signaled an error. */
+ retval=-1; goto bailout;
}
- readme(fd, &bh.bfSize, sizeof(unsigned int));
- readme(fd, &bh.bfReserved1, sizeof(unsigned short));
- readme(fd, &bh.bfReserved2, sizeof(unsigned short));
- readme(fd, &bh.bfOffBits, sizeof(unsigned int));
- readme(fd, &bh.biSize, sizeof(unsigned int));
- readme(fd, &bh.biWidth, sizeof(int));
- readme(fd, &bh.biHeight, sizeof(int));
- readme(fd, &bh.biPlanes, sizeof(unsigned short));
- readme(fd, &bh.biBitCount, sizeof(unsigned short));
- readme(fd, &bh.biCompression, sizeof(unsigned int));
- readme(fd, &bh.biSizeImage, sizeof(unsigned int));
- readme(fd, &bh.biXPelsPerMeter, sizeof(int));
- readme(fd, &bh.biYPelsPerMeter, sizeof(int));
- readme(fd, &bh.biClrUsed, sizeof(unsigned int));
- readme(fd, &bh.biClrImportant, sizeof(unsigned int));
+ jpeg_create_compress(&cinfo);
+ if((tempc=getc(file))<0 || ungetc(tempc, file)==EOF)
+ _throwunix("loadbmp(): Could not read input file")
+ else if(tempc==EOF) _throw("loadbmp(): Input file contains no data");
- if(!littleendian())
+ if(tempc=='B')
{
- bh.bfSize=byteswap(bh.bfSize);
- bh.bfOffBits=byteswap(bh.bfOffBits);
- bh.biSize=byteswap(bh.biSize);
- bh.biWidth=byteswap(bh.biWidth);
- bh.biHeight=byteswap(bh.biHeight);
- bh.biPlanes=byteswap16(bh.biPlanes);
- bh.biBitCount=byteswap16(bh.biBitCount);
- bh.biCompression=byteswap(bh.biCompression);
- bh.biSizeImage=byteswap(bh.biSizeImage);
- bh.biXPelsPerMeter=byteswap(bh.biXPelsPerMeter);
- bh.biYPelsPerMeter=byteswap(bh.biYPelsPerMeter);
- bh.biClrUsed=byteswap(bh.biClrUsed);
- bh.biClrImportant=byteswap(bh.biClrImportant);
+ if((src=jinit_read_bmp(&cinfo))==NULL)
+ _throw("loadbmp(): Could not initialize bitmap loader");
}
+ else if(tempc=='P')
+ {
+ if((src=jinit_read_ppm(&cinfo))==NULL)
+ _throw("loadbmp(): Could not initialize bitmap loader");
+ }
+ else _throw("loadbmp(): Unsupported file type");
- if(bh.bfType!=0x4d42 || bh.bfOffBits<BMPHDRSIZE
- || bh.biWidth<1 || bh.biHeight==0)
- _throw("Corrupt bitmap header");
- if((bh.biBitCount!=24 && bh.biBitCount!=32) || bh.biCompression!=BI_RGB)
- _throw("Only uncompessed RGB bitmaps are supported");
+ src->input_file=file;
+ (*src->start_input)(&cinfo, src);
+ (*cinfo.mem->realize_virt_arrays)((j_common_ptr)&cinfo);
- *w=bh.biWidth; *h=bh.biHeight; srcps=bh.biBitCount/8;
- if(*h<0) {*h=-(*h); srcbottomup=0;}
- srcpitch=(((*w)*srcps)+3)&(~3);
- dstpitch=(((*w)*ps[f])+(align-1))&(~(align-1));
+ *w=cinfo.image_width; *h=cinfo.image_height;
- if(srcpitch*(*h)+bh.bfOffBits!=bh.bfSize) _throw("Corrupt bitmap header");
- if((tempbuf=(unsigned char *)malloc(srcpitch*(*h)))==NULL
- || (*buf=(unsigned char *)malloc(dstpitch*(*h)))==NULL)
- _throw("Memory allocation error");
- if(lseek(fd, (long)bh.bfOffBits, SEEK_SET)!=(long)bh.bfOffBits)
- _throw(strerror(errno));
- _unix(bytesread=read(fd, tempbuf, srcpitch*(*h)));
- if(bytesread!=srcpitch*(*h)) _throw("Read error");
+ if(cinfo.input_components==1 && cinfo.in_color_space==JCS_RGB)
+ srcpf=TJPF_GRAY;
+ else srcpf=TJPF_RGB;
- pixelconvert(tempbuf, BMP_BGR, srcpitch, *buf, f, dstpitch, *w, *h,
- srcbottomup!=dstbottomup);
+ dstps=tjPixelSize[dstpf];
+ if((*buf=(unsigned char *)malloc((*w)*(*h)*dstps))==NULL)
+ _throw("loadbmp(): Memory allocation failure");
- finally:
- if(tempbuf) free(tempbuf);
- if(fd!=-1) close(fd);
- return retcode;
+ while(cinfo.next_scanline<cinfo.image_height)
+ {
+ int i, nlines=(*src->get_pixel_rows)(&cinfo, src);
+ for(i=0; i<nlines; i++)
+ {
+ unsigned char *outbuf; int row;
+ row=cinfo.next_scanline+i;
+ if(bottomup) outbuf=&(*buf)[((*h)-row-1)*(*w)*dstps];
+ else outbuf=&(*buf)[row*(*w)*dstps];
+ pixelconvert(src->buffer[i], srcpf, 0, outbuf, dstpf, bottomup, *w,
+ nlines);
+ }
+ cinfo.next_scanline+=nlines;
+ }
+
+ (*src->finish_input)(&cinfo, src);
+
+ bailout:
+ jpeg_destroy_compress(&cinfo);
+ if(file) fclose(file);
+ if(retval<0 && buf && *buf) {free(*buf); *buf=NULL;}
+ return retval;
}
-#define writeme(fd, addr, size) \
- if((byteswritten=write(fd, addr, (size)))==-1) _throw(strerror(errno)); \
- if(byteswritten!=(size)) _throw("Write error");
-int saveppm(char *filename, unsigned char *buf, int w, int h,
- enum BMPPIXELFORMAT f, int srcpitch, int srcbottomup)
+int savebmp(char *filename, unsigned char *buf, int w, int h, int srcpf,
+ int bottomup)
{
- FILE *fs=NULL; int retcode=0;
- unsigned char *tempbuf=NULL;
+ int retval=0, srcps, dstpf;
+ struct jpeg_decompress_struct dinfo;
+ struct my_error_mgr jerr;
+ djpeg_dest_ptr dst;
+ FILE *file=NULL;
+ char *ptr=NULL;
- if((fs=fopen(filename, "wb"))==NULL) _throw(strerror(errno));
- if(fprintf(fs, "P6\n")<1) _throw("Write error");
- if(fprintf(fs, "%d %d\n", w, h)<1) _throw("Write error");
- if(fprintf(fs, "255\n")<1) _throw("Write error");
+ memset(&dinfo, 0, sizeof(struct jpeg_decompress_struct));
- if((tempbuf=(unsigned char *)malloc(w*h*3))==NULL)
- _throw("Memory allocation error");
+ if(!filename || !buf || w<1 || h<1 || srcpf<0 || srcpf>=TJ_NUMPF)
+ _throw("savebmp(): Invalid argument");
- pixelconvert(buf, f, srcpitch, tempbuf, BMP_RGB, w*3, w, h,
- srcbottomup);
+ if((file=fopen(filename, "wb"))==NULL)
+ _throwunix("savebmp(): Cannot open output file");
- if((fwrite(tempbuf, w*h*3, 1, fs))!=1) _throw("Write error");
+ dinfo.err=jpeg_std_error(&jerr.pub);
+ jerr.pub.error_exit=my_error_exit;
+ jerr.pub.output_message=my_output_message;
- finally:
- if(tempbuf) free(tempbuf);
- if(fs) fclose(fs);
- return retcode;
-}
-
-int savebmp(char *filename, unsigned char *buf, int w, int h,
- enum BMPPIXELFORMAT f, int srcpitch, int srcbottomup)
-{
- int fd=-1, byteswritten, dstpitch, retcode=0;
- int flags=O_RDWR|O_CREAT|O_TRUNC;
- unsigned char *tempbuf=NULL; char *temp;
- bmphdr bh; int mode;
-
- #ifdef _WIN32
- flags|=O_BINARY; mode=_S_IREAD|_S_IWRITE;
- #else
- mode=S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH;
- #endif
- if(!filename || !buf || w<1 || h<1 || f<0 || f>BMPPIXELFORMATS-1 || srcpitch<0)
- _throw("bad argument to savebmp()");
-
- if(srcpitch==0) srcpitch=w*ps[f];
-
- if((temp=strrchr(filename, '.'))!=NULL)
+ if(setjmp(jerr.setjmp_buffer))
{
- if(!stricmp(temp, ".ppm"))
- return saveppm(filename, buf, w, h, f, srcpitch, srcbottomup);
+ /* If we get here, the JPEG code has signaled an error. */
+ retval=-1; goto bailout;
}
- _unix(fd=open(filename, flags, mode));
- dstpitch=((w*3)+3)&(~3);
-
- bh.bfType=0x4d42;
- bh.bfSize=BMPHDRSIZE+dstpitch*h;
- bh.bfReserved1=0; bh.bfReserved2=0;
- bh.bfOffBits=BMPHDRSIZE;
- bh.biSize=40;
- bh.biWidth=w; bh.biHeight=h;
- bh.biPlanes=0; bh.biBitCount=24;
- bh.biCompression=BI_RGB; bh.biSizeImage=0;
- bh.biXPelsPerMeter=0; bh.biYPelsPerMeter=0;
- bh.biClrUsed=0; bh.biClrImportant=0;
-
- if(!littleendian())
+ jpeg_create_decompress(&dinfo);
+ if(srcpf==TJPF_GRAY)
{
- bh.bfType=byteswap16(bh.bfType);
- bh.bfSize=byteswap(bh.bfSize);
- bh.bfOffBits=byteswap(bh.bfOffBits);
- bh.biSize=byteswap(bh.biSize);
- bh.biWidth=byteswap(bh.biWidth);
- bh.biHeight=byteswap(bh.biHeight);
- bh.biPlanes=byteswap16(bh.biPlanes);
- bh.biBitCount=byteswap16(bh.biBitCount);
- bh.biCompression=byteswap(bh.biCompression);
- bh.biSizeImage=byteswap(bh.biSizeImage);
- bh.biXPelsPerMeter=byteswap(bh.biXPelsPerMeter);
- bh.biYPelsPerMeter=byteswap(bh.biYPelsPerMeter);
- bh.biClrUsed=byteswap(bh.biClrUsed);
- bh.biClrImportant=byteswap(bh.biClrImportant);
+ dinfo.out_color_components=dinfo.output_components=1;
+ dinfo.out_color_space=JCS_GRAYSCALE;
+ }
+ else
+ {
+ dinfo.out_color_components=dinfo.output_components=3;
+ dinfo.out_color_space=JCS_RGB;
+ }
+ dinfo.image_width=w; dinfo.image_height=h;
+ dinfo.global_state=DSTATE_READY;
+ dinfo.scale_num=dinfo.scale_denom=1;
+
+ ptr=strrchr(filename, '.');
+ if(ptr && !strcasecmp(ptr, ".bmp"))
+ {
+ if((dst=jinit_write_bmp(&dinfo, 0))==NULL)
+ _throw("savebmp(): Could not initialize bitmap writer");
+ }
+ else
+ {
+ if((dst=jinit_write_ppm(&dinfo))==NULL)
+ _throw("savebmp(): Could not initialize PPM writer");
}
- writeme(fd, &bh.bfType, sizeof(unsigned short));
- writeme(fd, &bh.bfSize, sizeof(unsigned int));
- writeme(fd, &bh.bfReserved1, sizeof(unsigned short));
- writeme(fd, &bh.bfReserved2, sizeof(unsigned short));
- writeme(fd, &bh.bfOffBits, sizeof(unsigned int));
- writeme(fd, &bh.biSize, sizeof(unsigned int));
- writeme(fd, &bh.biWidth, sizeof(int));
- writeme(fd, &bh.biHeight, sizeof(int));
- writeme(fd, &bh.biPlanes, sizeof(unsigned short));
- writeme(fd, &bh.biBitCount, sizeof(unsigned short));
- writeme(fd, &bh.biCompression, sizeof(unsigned int));
- writeme(fd, &bh.biSizeImage, sizeof(unsigned int));
- writeme(fd, &bh.biXPelsPerMeter, sizeof(int));
- writeme(fd, &bh.biYPelsPerMeter, sizeof(int));
- writeme(fd, &bh.biClrUsed, sizeof(unsigned int));
- writeme(fd, &bh.biClrImportant, sizeof(unsigned int));
+ dst->output_file=file;
+ (*dst->start_output)(&dinfo, dst);
+ (*dinfo.mem->realize_virt_arrays)((j_common_ptr)&dinfo);
- if((tempbuf=(unsigned char *)malloc(dstpitch*h))==NULL)
- _throw("Memory allocation error");
+ if(srcpf==TJPF_GRAY) dstpf=srcpf;
+ else dstpf=TJPF_RGB;
+ srcps=tjPixelSize[srcpf];
- pixelconvert(buf, f, srcpitch, tempbuf, BMP_BGR, dstpitch, w, h,
- !srcbottomup);
+ while(dinfo.output_scanline<dinfo.output_height)
+ {
+ int i, nlines=dst->buffer_height;
+ for(i=0; i<nlines; i++)
+ {
+ unsigned char *inbuf; int row;
+ row=dinfo.output_scanline+i;
+ if(bottomup) inbuf=&buf[(h-row-1)*w*srcps];
+ else inbuf=&buf[row*w*srcps];
+ pixelconvert(inbuf, srcpf, bottomup, dst->buffer[i], dstpf, 0, w,
+ nlines);
+ }
+ (*dst->put_pixel_rows)(&dinfo, dst, nlines);
+ dinfo.output_scanline+=nlines;
+ }
- if((byteswritten=write(fd, tempbuf, dstpitch*h))!=dstpitch*h)
- _throw(strerror(errno));
+ (*dst->finish_output)(&dinfo, dst);
- finally:
- if(tempbuf) free(tempbuf);
- if(fd!=-1) close(fd);
- return retcode;
+ bailout:
+ jpeg_destroy_decompress(&dinfo);
+ if(file) fclose(file);
+ return retval;
}
const char *bmpgeterr(void)
{
- return __bmperr;
+ return errStr;
}
diff --git a/bmp.h b/bmp.h
index 055b1ee..0d1e4dc 100644
--- a/bmp.h
+++ b/bmp.h
@@ -1,44 +1,41 @@
-/* Copyright (C)2004 Landmark Graphics Corporation
- * Copyright (C)2005 Sun Microsystems, Inc.
- * Copyright (C)2011 D. R. Commander
+/*
+ * Copyright (C)2011 D. R. Commander. All Rights Reserved.
*
- * This library is free software and may be redistributed and/or modified under
- * the terms of the wxWindows Library License, Version 3.1 or (at your option)
- * any later version. The full license is in the LICENSE.txt file included
- * with this distribution.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * wxWindows Library License for more details.
-*/
-
-// This provides rudimentary facilities for loading and saving true color
-// BMP and PPM files
+ * - 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.
+ */
#ifndef __BMP_H__
#define __BMP_H__
-#define BMPPIXELFORMATS 6
-enum BMPPIXELFORMAT {BMP_RGB=0, BMP_RGBX, BMP_BGR, BMP_BGRX, BMP_XBGR, BMP_XRGB};
+#include "./turbojpeg.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+int loadbmp(char *filename, unsigned char **buf, int *w, int *h, int pf,
+ int bottomup);
-// This will load a Windows bitmap from a file and return a buffer with the
-// specified pixel format, scanline alignment, and orientation. The width and
-// height are returned in w and h.
-
-int loadbmp(char *filename, unsigned char **buf, int *w, int *h,
- enum BMPPIXELFORMAT f, int align, int dstbottomup);
-
-// This will save a buffer with the specified pixel format, pitch, orientation,
-// width, and height as a 24-bit Windows bitmap or PPM (the filename determines
-// which format to use)
-
-int savebmp(char *filename, unsigned char *buf, int w, int h,
- enum BMPPIXELFORMAT f, int srcpitch, int srcbottomup);
+int savebmp(char *filename, unsigned char *buf, int w, int h, int pf,
+ int bottomup);
const char *bmpgeterr(void);
diff --git a/cmakescripts/testclean.cmake b/cmakescripts/testclean.cmake
new file mode 100644
index 0000000..e357787
--- /dev/null
+++ b/cmakescripts/testclean.cmake
@@ -0,0 +1,34 @@
+file(GLOB FILES
+ testout*
+ *_GRAY_*.bmp
+ *_GRAY_*.png
+ *_GRAY_*.ppm
+ *_GRAY_*.jpg
+ *_GRAY.yuv
+ *_420_*.bmp
+ *_420_*.png
+ *_420_*.ppm
+ *_420_*.jpg
+ *_420.yuv
+ *_422_*.bmp
+ *_422_*.png
+ *_422_*.ppm
+ *_422_*.jpg
+ *_422.yuv
+ *_444_*.bmp
+ *_444_*.png
+ *_444_*.ppm
+ *_444_*.jpg
+ *_444.yuv
+ *_440_*.bmp
+ *_440_*.png
+ *_440_*.ppm
+ *_440_*.jpg
+ *_440.yuv)
+
+if(NOT FILES STREQUAL "")
+ message(STATUS "Removing test files")
+ file(REMOVE ${FILES})
+else()
+ message(STATUS "No files to remove")
+endif()
diff --git a/configure.ac b/configure.ac
index b4d037e..bb1c68b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.56])
-AC_INIT([libjpeg-turbo], [1.1.2])
+AC_INIT([libjpeg-turbo], [1.2.0])
BUILD=`date +%Y%m%d`
AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
@@ -16,6 +16,7 @@
SAVED_CPPFLAGS=${CPPFLAGS}
AC_PROG_CPP
AC_PROG_CC
+AM_PROG_AS
AC_PROG_INSTALL
AC_PROG_LIBTOOL
AC_PROG_LN_S
@@ -172,6 +173,20 @@
AM_CONDITIONAL(VERSION_SCRIPT, test "x$VERSION_SCRIPT" = "xyes")
AC_SUBST(VERSION_SCRIPT_FLAG)
+# Check for non-broken inline under various spellings
+AC_MSG_CHECKING(for inline)
+ljt_cv_inline=""
+AC_TRY_COMPILE(, [} __attribute__((always_inline)) int foo() { return 0; }
+int bar() { return foo();], ljt_cv_inline="__attribute__((always_inline))",
+AC_TRY_COMPILE(, [} __inline__ int foo() { return 0; }
+int bar() { return foo();], ljt_cv_inline="__inline__",
+AC_TRY_COMPILE(, [} __inline int foo() { return 0; }
+int bar() { return foo();], ljt_cv_inline="__inline",
+AC_TRY_COMPILE(, [} inline int foo() { return 0; }
+int bar() { return foo();], ljt_cv_inline="inline"))))
+AC_MSG_RESULT($ljt_cv_inline)
+AC_DEFINE_UNQUOTED([INLINE],[$ljt_cv_inline],[How to obtain function inlining.])
+
AC_MSG_CHECKING([whether to include arithmetic encoding support])
AC_ARG_WITH([arith-enc],
AC_HELP_STRING([--without-arith-enc], [Omit arithmetic encoding support]))
@@ -196,6 +211,84 @@
AM_CONDITIONAL([WITH_ARITH], [test "x$with_arith_dec" != "xno" -o "x$with_arith_enc" != "xno"])
+AC_ARG_VAR(JAVAC, [Java compiler command (default: javac)])
+if test "x$JAVAC" = "x"; then
+ JAVAC=javac
+fi
+AC_SUBST(JAVAC)
+AC_ARG_VAR(JAVACFLAGS, [Java compiler flags])
+AC_SUBST(JAVACFLAGS)
+AC_ARG_VAR(JAR, [Java archive command (default: jar)])
+if test "x$JAR" = "x"; then
+ JAR=jar
+fi
+AC_SUBST(JAR)
+AC_ARG_VAR(JAVA, [Java runtime command (default: java)])
+if test "x$JAVA" = "x"; then
+ JAVA=java
+fi
+AC_SUBST(JAVA)
+AC_ARG_VAR(JNI_CFLAGS, [C compiler flags needed to include jni.h (default: -I/System/Library/Frameworks/JavaVM.framework/Headers on OS X, '-I/usr/java/include -I/usr/java/include/solaris' on Solaris, and '-I/usr/java/default/include -I/usr/java/default/include/linux' on Linux)])
+
+AC_MSG_CHECKING([whether to build TurboJPEG/OSS Java wrapper])
+AC_ARG_WITH([java],
+ AC_HELP_STRING([--with-java],[Build Java wrapper for the TurboJPEG/OSS library]))
+
+RPM_CONFIG_ARGS=
+WITH_JAVA=0
+if test "x$with_java" = "xyes"; then
+ AC_MSG_RESULT(yes)
+
+ case $host_os in
+ darwin*)
+ DEFAULT_JNI_CFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
+ ;;
+ solaris*)
+ DEFAULT_JNI_CFLAGS='-I/usr/java/include -I/usr/java/include/solaris'
+ ;;
+ linux*)
+ DEFAULT_JNI_CFLAGS='-I/usr/java/default/include -I/usr/java/default/include/linux'
+ ;;
+ esac
+ if test "x$JNI_CFLAGS" = "x"; then
+ JNI_CFLAGS=$DEFAULT_JNI_CFLAGS
+ fi
+
+ SAVE_CPPFLAGS=${CPPFLAGS}
+ CPPFLAGS="${CPPFLAGS} ${JNI_CFLAGS}"
+ AC_CHECK_HEADERS([jni.h], [DUMMY=1],
+ [AC_MSG_ERROR([Could not find JNI header file])])
+ CPPFLAGS=${SAVE_CPPFLAGS}
+ AC_SUBST(JNI_CFLAGS)
+
+ RPM_CONFIG_ARGS=--with-java
+ JAVA_RPM_CONTENTS_1='%dir /opt/%{name}/classes'
+ JAVA_RPM_CONTENTS_2=/opt/%{name}/classes/turbojpeg.jar
+ WITH_JAVA=1
+else
+ AC_MSG_RESULT(no)
+fi
+AM_CONDITIONAL([WITH_JAVA], [test "x$with_java" = "xyes"])
+AC_SUBST(WITH_JAVA)
+AC_SUBST(JAVA_RPM_CONTENTS_1)
+AC_SUBST(JAVA_RPM_CONTENTS_2)
+AC_SUBST(RPM_CONFIG_ARGS)
+
+# optionally force using gas-preprocessor.pl for compatibility testing
+AC_ARG_WITH([gas-preprocessor],
+ AC_HELP_STRING([--with-gas-preprocessor],[Force using gas-preprocessor.pl on ARM.]))
+if test "x${with_gas_preprocessor}" = "xyes"; then
+ case $host_os in
+ darwin*)
+ CCAS="gas-preprocessor.pl -fix-unreq $CC"
+ ;;
+ *)
+ CCAS="gas-preprocessor.pl -no-fix-unreq $CC"
+ ;;
+ esac
+ AC_SUBST([CCAS])
+fi
+
# SIMD is optional
AC_ARG_WITH([simd],
AC_HELP_STRING([--without-simd],[Omit SIMD extensions.]))
@@ -213,6 +306,16 @@
AC_PROG_NASM
simd_arch=i386
;;
+ arm*)
+ AC_MSG_RESULT([yes (arm)])
+ AC_MSG_CHECKING([if the assembler is GNU-compatible and can be used])
+ AC_CHECK_COMPATIBLE_ARM_ASSEMBLER_IFELSE(
+ [AC_MSG_RESULT([yes])
+ simd_arch=arm],
+ [AC_MSG_RESULT([no])
+ with_simd=no
+ AC_MSG_WARN([SIMD support can't be enabled. Performance will suffer.])])
+ ;;
*)
AC_MSG_RESULT([no ("$host_cpu")])
AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.])
@@ -226,8 +329,10 @@
fi
AM_CONDITIONAL([WITH_SIMD], [test "x$with_simd" != "xno"])
+AM_CONDITIONAL([WITH_SSE_FLOAT_DCT], [test "x$simd_arch" = "xx86_64" -o "x$simd_arch" = "xi386"])
AM_CONDITIONAL([SIMD_I386], [test "x$simd_arch" = "xi386"])
AM_CONDITIONAL([SIMD_X86_64], [test "x$simd_arch" = "xx86_64"])
+AM_CONDITIONAL([SIMD_ARM], [test "x$simd_arch" = "xarm"])
AM_CONDITIONAL([X86_64], [test "x$host_cpu" = "xx86_64" -o "x$host_cpu" = "xamd64"])
case "$host_cpu" in
@@ -263,4 +368,5 @@
AC_CONFIG_FILES([pkgscripts/pkginfo:release/pkginfo.in])
AC_CONFIG_FILES([libjpeg.map])
AC_CONFIG_FILES([Makefile simd/Makefile])
+AC_CONFIG_FILES([java/Makefile])
AC_OUTPUT
diff --git a/djpeg.c b/djpeg.c
index 466973f..0dd4f24 100644
--- a/djpeg.c
+++ b/djpeg.c
@@ -2,7 +2,7 @@
* djpeg.c
*
* Copyright (C) 1991-1997, Thomas G. Lane.
- * Copyright (C) 2010, D. R. Commander.
+ * Copyright (C) 2010-2011, D. R. Commander.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -103,6 +103,7 @@
fprintf(stderr, " -colors N Reduce image to no more than N colors\n");
fprintf(stderr, " -fast Fast, low-quality processing\n");
fprintf(stderr, " -grayscale Force grayscale output\n");
+ fprintf(stderr, " -rgb Force RGB output\n");
#ifdef IDCT_SCALING_SUPPORTED
fprintf(stderr, " -scale M/N Scale output image by fraction M/N, eg, 1/8\n");
#endif
@@ -268,6 +269,10 @@
/* Force monochrome output. */
cinfo->out_color_space = JCS_GRAYSCALE;
+ } else if (keymatch(arg, "rgb", 2)) {
+ /* Force RGB output. */
+ cinfo->out_color_space = JCS_RGB;
+
} else if (keymatch(arg, "map", 3)) {
/* Quantize to a color map taken from an input file. */
if (++argn >= argc) /* advance to next argument */
diff --git a/doc/html/annotated.html b/doc/html/annotated.html
new file mode 100644
index 0000000..a2f4119
--- /dev/null
+++ b/doc/html/annotated.html
@@ -0,0 +1,88 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>TurboJPEG: Data Structures</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="search/search.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
+<!-- Generated by Doxygen 1.7.4 -->
+<script type="text/javascript"><!--
+var searchBox = new SearchBox("searchBox", "search",false,'Search');
+--></script>
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">TurboJPEG <span id="projectnumber">1.2</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li id="searchli">
+ <div id="MSearchBox" class="MSearchBoxInactive">
+ <span class="left">
+ <img id="MSearchSelect" src="search/mag_sel.png"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ alt=""/>
+ <input type="text" id="MSearchField" value="Search" accesskey="S"
+ onfocus="searchBox.OnSearchFieldFocus(true)"
+ onblur="searchBox.OnSearchFieldFocus(false)"
+ onkeyup="searchBox.OnSearchFieldChange(event)"/>
+ </span><span class="right">
+ <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
+ </span>
+ </div>
+ </li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="classes.html"><span>Data Structure Index</span></a></li>
+ <li><a href="functions.html"><span>Data Fields</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">Data Structures</div> </div>
+</div>
+<div class="contents">
+<div class="textblock">Here are the data structures with brief descriptions:</div><table>
+ <tr><td class="indexkey"><a class="el" href="structtjregion.html">tjregion</a></td><td class="indexvalue">Cropping region </td></tr>
+ <tr><td class="indexkey"><a class="el" href="structtjscalingfactor.html">tjscalingfactor</a></td><td class="indexvalue">Scaling factor </td></tr>
+ <tr><td class="indexkey"><a class="el" href="structtjtransform.html">tjtransform</a></td><td class="indexvalue">Lossless transform </td></tr>
+</table>
+</div>
+<!-- window showing the filter options -->
+<div id="MSearchSelectWindow"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ onkeydown="return searchBox.OnSearchSelectKey(event)">
+<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Variables</a></div>
+
+<!-- iframe showing the search results (closed by default) -->
+<div id="MSearchResultsWindow">
+<iframe src="javascript:void(0)" frameborder="0"
+ name="MSearchResults" id="MSearchResults">
+</iframe>
+</div>
+
+<hr class="footer"/><address class="footer"><small>Generated on Tue Sep 20 2011 13:18:32 for TurboJPEG by 
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/doc/html/bc_s.png b/doc/html/bc_s.png
new file mode 100644
index 0000000..e401862
--- /dev/null
+++ b/doc/html/bc_s.png
Binary files differ
diff --git a/doc/html/classes.html b/doc/html/classes.html
new file mode 100644
index 0000000..32f098d
--- /dev/null
+++ b/doc/html/classes.html
@@ -0,0 +1,87 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>TurboJPEG: Data Structure Index</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="search/search.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
+<!-- Generated by Doxygen 1.7.4 -->
+<script type="text/javascript"><!--
+var searchBox = new SearchBox("searchBox", "search",false,'Search');
+--></script>
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">TurboJPEG <span id="projectnumber">1.2</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li id="searchli">
+ <div id="MSearchBox" class="MSearchBoxInactive">
+ <span class="left">
+ <img id="MSearchSelect" src="search/mag_sel.png"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ alt=""/>
+ <input type="text" id="MSearchField" value="Search" accesskey="S"
+ onfocus="searchBox.OnSearchFieldFocus(true)"
+ onblur="searchBox.OnSearchFieldFocus(false)"
+ onkeyup="searchBox.OnSearchFieldChange(event)"/>
+ </span><span class="right">
+ <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
+ </span>
+ </div>
+ </li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li class="current"><a href="classes.html"><span>Data Structure Index</span></a></li>
+ <li><a href="functions.html"><span>Data Fields</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">Data Structure Index</div> </div>
+</div>
+<div class="contents">
+<div class="qindex"><a class="qindex" href="#letter_T">T</a></div>
+<table align="center" width="95%" border="0" cellspacing="0" cellpadding="0">
+<tr><td><a name="letter_T"></a><table border="0" cellspacing="0" cellpadding="0"><tr><td><div class="ah">  T  </div></td></tr></table>
+</td><td><a class="el" href="structtjregion.html">tjregion</a>   </td><td><a class="el" href="structtjscalingfactor.html">tjscalingfactor</a>   </td><td><a class="el" href="structtjtransform.html">tjtransform</a>   </td></tr></table><div class="qindex"><a class="qindex" href="#letter_T">T</a></div>
+</div>
+<!-- window showing the filter options -->
+<div id="MSearchSelectWindow"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ onkeydown="return searchBox.OnSearchSelectKey(event)">
+<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Variables</a></div>
+
+<!-- iframe showing the search results (closed by default) -->
+<div id="MSearchResultsWindow">
+<iframe src="javascript:void(0)" frameborder="0"
+ name="MSearchResults" id="MSearchResults">
+</iframe>
+</div>
+
+<hr class="footer"/><address class="footer"><small>Generated on Tue Sep 20 2011 13:18:32 for TurboJPEG by 
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/doc/html/closed.png b/doc/html/closed.png
new file mode 100644
index 0000000..b7d4bd9
--- /dev/null
+++ b/doc/html/closed.png
Binary files differ
diff --git a/doc/html/doxygen.css b/doc/html/doxygen.css
new file mode 100644
index 0000000..74445fe
--- /dev/null
+++ b/doc/html/doxygen.css
@@ -0,0 +1,835 @@
+/* The standard CSS for doxygen */
+
+body, table, div, p, dl {
+ font-family: Lucida Grande, Verdana, Geneva, Arial, sans-serif;
+ font-size: 12px;
+}
+
+/* @group Heading Levels */
+
+h1 {
+ font-size: 150%;
+}
+
+.title {
+ font-size: 150%;
+ font-weight: bold;
+ margin: 10px 2px;
+}
+
+h2 {
+ font-size: 120%;
+}
+
+h3 {
+ font-size: 100%;
+}
+
+dt {
+ font-weight: bold;
+}
+
+div.multicol {
+ -moz-column-gap: 1em;
+ -webkit-column-gap: 1em;
+ -moz-column-count: 3;
+ -webkit-column-count: 3;
+}
+
+p.startli, p.startdd, p.starttd {
+ margin-top: 2px;
+}
+
+p.endli {
+ margin-bottom: 0px;
+}
+
+p.enddd {
+ margin-bottom: 4px;
+}
+
+p.endtd {
+ margin-bottom: 2px;
+}
+
+/* @end */
+
+caption {
+ font-weight: bold;
+}
+
+span.legend {
+ font-size: 70%;
+ text-align: center;
+}
+
+h3.version {
+ font-size: 90%;
+ text-align: center;
+}
+
+div.qindex, div.navtab{
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
+ text-align: center;
+ margin: 2px;
+ padding: 2px;
+}
+
+div.qindex, div.navpath {
+ width: 100%;
+ line-height: 140%;
+}
+
+div.navtab {
+ margin-right: 15px;
+}
+
+/* @group Link Styling */
+
+a {
+ color: #3D578C;
+ font-weight: normal;
+ text-decoration: none;
+}
+
+.contents a:visited {
+ color: #4665A2;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+a.qindex {
+ font-weight: bold;
+}
+
+a.qindexHL {
+ font-weight: bold;
+ background-color: #9CAFD4;
+ color: #ffffff;
+ border: 1px double #869DCA;
+}
+
+.contents a.qindexHL:visited {
+ color: #ffffff;
+}
+
+a.el {
+ font-weight: bold;
+}
+
+a.elRef {
+}
+
+a.code {
+ color: #4665A2;
+}
+
+a.codeRef {
+ color: #4665A2;
+}
+
+/* @end */
+
+dl.el {
+ margin-left: -1cm;
+}
+
+.fragment {
+ font-family: monospace, fixed;
+ font-size: 105%;
+}
+
+pre.fragment {
+ border: 1px solid #C4CFE5;
+ background-color: #FBFCFD;
+ padding: 4px 6px;
+ margin: 4px 8px 4px 2px;
+ overflow: auto;
+ word-wrap: break-word;
+ font-size: 9pt;
+ line-height: 125%;
+}
+
+div.ah {
+ background-color: black;
+ font-weight: bold;
+ color: #ffffff;
+ margin-bottom: 3px;
+ margin-top: 3px;
+ padding: 0.2em;
+ border: solid thin #333;
+ border-radius: 0.5em;
+ -webkit-border-radius: .5em;
+ -moz-border-radius: .5em;
+ box-shadow: 2px 2px 3px #999;
+ -webkit-box-shadow: 2px 2px 3px #999;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 2px;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#000),color-stop(0.3, #444));
+ background-image: -moz-linear-gradient(center top, #eee 0%, #444 40%, #000);
+}
+
+div.groupHeader {
+ margin-left: 16px;
+ margin-top: 12px;
+ font-weight: bold;
+}
+
+div.groupText {
+ margin-left: 16px;
+ font-style: italic;
+}
+
+body {
+ background: white;
+ color: black;
+ margin: 0;
+}
+
+div.contents {
+ margin-top: 10px;
+ margin-left: 10px;
+ margin-right: 5px;
+}
+
+td.indexkey {
+ background-color: #EBEFF6;
+ font-weight: bold;
+ border: 1px solid #C4CFE5;
+ margin: 2px 0px 2px 0;
+ padding: 2px 10px;
+}
+
+td.indexvalue {
+ background-color: #EBEFF6;
+ border: 1px solid #C4CFE5;
+ padding: 2px 10px;
+ margin: 2px 0px;
+}
+
+tr.memlist {
+ background-color: #EEF1F7;
+}
+
+p.formulaDsp {
+ text-align: center;
+}
+
+img.formulaDsp {
+
+}
+
+img.formulaInl {
+ vertical-align: middle;
+}
+
+div.center {
+ text-align: center;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ padding: 0px;
+}
+
+div.center img {
+ border: 0px;
+}
+
+address.footer {
+ text-align: right;
+ padding-right: 12px;
+}
+
+img.footer {
+ border: 0px;
+ vertical-align: middle;
+}
+
+/* @group Code Colorization */
+
+span.keyword {
+ color: #008000
+}
+
+span.keywordtype {
+ color: #604020
+}
+
+span.keywordflow {
+ color: #e08000
+}
+
+span.comment {
+ color: #800000
+}
+
+span.preprocessor {
+ color: #806020
+}
+
+span.stringliteral {
+ color: #002080
+}
+
+span.charliteral {
+ color: #008080
+}
+
+span.vhdldigit {
+ color: #ff00ff
+}
+
+span.vhdlchar {
+ color: #000000
+}
+
+span.vhdlkeyword {
+ color: #700070
+}
+
+span.vhdllogic {
+ color: #ff0000
+}
+
+/* @end */
+
+/*
+.search {
+ color: #003399;
+ font-weight: bold;
+}
+
+form.search {
+ margin-bottom: 0px;
+ margin-top: 0px;
+}
+
+input.search {
+ font-size: 75%;
+ color: #000080;
+ font-weight: normal;
+ background-color: #e8eef2;
+}
+*/
+
+td.tiny {
+ font-size: 75%;
+}
+
+.dirtab {
+ padding: 4px;
+ border-collapse: collapse;
+ border: 1px solid #A3B4D7;
+}
+
+th.dirtab {
+ background: #EBEFF6;
+ font-weight: bold;
+}
+
+hr {
+ height: 0px;
+ border: none;
+ border-top: 1px solid #4A6AAA;
+}
+
+hr.footer {
+ height: 1px;
+}
+
+/* @group Member Descriptions */
+
+table.memberdecls {
+ border-spacing: 0px;
+ padding: 0px;
+}
+
+.mdescLeft, .mdescRight,
+.memItemLeft, .memItemRight,
+.memTemplItemLeft, .memTemplItemRight, .memTemplParams {
+ background-color: #F9FAFC;
+ border: none;
+ margin: 4px;
+ padding: 1px 0 0 8px;
+}
+
+.mdescLeft, .mdescRight {
+ padding: 0px 8px 4px 8px;
+ color: #555;
+}
+
+.memItemLeft, .memItemRight, .memTemplParams {
+ border-top: 1px solid #C4CFE5;
+}
+
+.memItemLeft, .memTemplItemLeft {
+ white-space: nowrap;
+}
+
+.memItemRight {
+ width: 100%;
+}
+
+.memTemplParams {
+ color: #4665A2;
+ white-space: nowrap;
+}
+
+/* @end */
+
+/* @group Member Details */
+
+/* Styles for detailed member documentation */
+
+.memtemplate {
+ font-size: 80%;
+ color: #4665A2;
+ font-weight: normal;
+ margin-left: 9px;
+}
+
+.memnav {
+ background-color: #EBEFF6;
+ border: 1px solid #A3B4D7;
+ text-align: center;
+ margin: 2px;
+ margin-right: 15px;
+ padding: 2px;
+}
+
+.mempage {
+ width: 100%;
+}
+
+.memitem {
+ padding: 0;
+ margin-bottom: 10px;
+ margin-right: 5px;
+}
+
+.memname {
+ white-space: nowrap;
+ font-weight: bold;
+ margin-left: 6px;
+}
+
+.memproto {
+ border-top: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 6px 0px 6px 0px;
+ color: #253555;
+ font-weight: bold;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+ /* opera specific markup */
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ border-top-right-radius: 8px;
+ border-top-left-radius: 8px;
+ /* firefox specific markup */
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ -moz-border-radius-topright: 8px;
+ -moz-border-radius-topleft: 8px;
+ /* webkit specific markup */
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ -webkit-border-top-right-radius: 8px;
+ -webkit-border-top-left-radius: 8px;
+ background-image:url('nav_f.png');
+ background-repeat:repeat-x;
+ background-color: #E2E8F2;
+
+}
+
+.memdoc {
+ border-bottom: 1px solid #A8B8D9;
+ border-left: 1px solid #A8B8D9;
+ border-right: 1px solid #A8B8D9;
+ padding: 2px 5px;
+ background-color: #FBFCFD;
+ border-top-width: 0;
+ /* opera specific markup */
+ border-bottom-left-radius: 8px;
+ border-bottom-right-radius: 8px;
+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ /* firefox specific markup */
+ -moz-border-radius-bottomleft: 8px;
+ -moz-border-radius-bottomright: 8px;
+ -moz-box-shadow: rgba(0, 0, 0, 0.15) 5px 5px 5px;
+ background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 60%, #F7F8FB 95%, #EEF1F7);
+ /* webkit specific markup */
+ -webkit-border-bottom-left-radius: 8px;
+ -webkit-border-bottom-right-radius: 8px;
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+ background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.6,#FFFFFF), color-stop(0.60,#FFFFFF), color-stop(0.95,#F7F8FB), to(#EEF1F7));
+}
+
+.paramkey {
+ text-align: right;
+}
+
+.paramtype {
+ white-space: nowrap;
+}
+
+.paramname {
+ color: #602020;
+ white-space: nowrap;
+}
+.paramname em {
+ font-style: normal;
+}
+
+.params, .retval, .exception, .tparams {
+ border-spacing: 6px 2px;
+}
+
+.params .paramname, .retval .paramname {
+ font-weight: bold;
+ vertical-align: top;
+}
+
+.params .paramtype {
+ font-style: italic;
+ vertical-align: top;
+}
+
+.params .paramdir {
+ font-family: "courier new",courier,monospace;
+ vertical-align: top;
+}
+
+
+
+
+/* @end */
+
+/* @group Directory (tree) */
+
+/* for the tree view */
+
+.ftvtree {
+ font-family: sans-serif;
+ margin: 0px;
+}
+
+/* these are for tree view when used as main index */
+
+.directory {
+ font-size: 9pt;
+ font-weight: bold;
+ margin: 5px;
+}
+
+.directory h3 {
+ margin: 0px;
+ margin-top: 1em;
+ font-size: 11pt;
+}
+
+/*
+The following two styles can be used to replace the root node title
+with an image of your choice. Simply uncomment the next two styles,
+specify the name of your image and be sure to set 'height' to the
+proper pixel height of your image.
+*/
+
+/*
+.directory h3.swap {
+ height: 61px;
+ background-repeat: no-repeat;
+ background-image: url("yourimage.gif");
+}
+.directory h3.swap span {
+ display: none;
+}
+*/
+
+.directory > h3 {
+ margin-top: 0;
+}
+
+.directory p {
+ margin: 0px;
+ white-space: nowrap;
+}
+
+.directory div {
+ display: none;
+ margin: 0px;
+}
+
+.directory img {
+ vertical-align: -30%;
+}
+
+/* these are for tree view when not used as main index */
+
+.directory-alt {
+ font-size: 100%;
+ font-weight: bold;
+}
+
+.directory-alt h3 {
+ margin: 0px;
+ margin-top: 1em;
+ font-size: 11pt;
+}
+
+.directory-alt > h3 {
+ margin-top: 0;
+}
+
+.directory-alt p {
+ margin: 0px;
+ white-space: nowrap;
+}
+
+.directory-alt div {
+ display: none;
+ margin: 0px;
+}
+
+.directory-alt img {
+ vertical-align: -30%;
+}
+
+/* @end */
+
+div.dynheader {
+ margin-top: 8px;
+}
+
+address {
+ font-style: normal;
+ color: #2A3D61;
+}
+
+table.doxtable {
+ border-collapse:collapse;
+}
+
+table.doxtable td, table.doxtable th {
+ border: 1px solid #2D4068;
+ padding: 3px 7px 2px;
+}
+
+table.doxtable th {
+ background-color: #374F7F;
+ color: #FFFFFF;
+ font-size: 110%;
+ padding-bottom: 4px;
+ padding-top: 5px;
+ text-align:left;
+}
+
+.tabsearch {
+ top: 0px;
+ left: 10px;
+ height: 36px;
+ background-image: url('tab_b.png');
+ z-index: 101;
+ overflow: hidden;
+ font-size: 13px;
+}
+
+.navpath ul
+{
+ font-size: 11px;
+ background-image:url('tab_b.png');
+ background-repeat:repeat-x;
+ height:30px;
+ line-height:30px;
+ color:#8AA0CC;
+ border:solid 1px #C2CDE4;
+ overflow:hidden;
+ margin:0px;
+ padding:0px;
+}
+
+.navpath li
+{
+ list-style-type:none;
+ float:left;
+ padding-left:10px;
+ padding-right:15px;
+ background-image:url('bc_s.png');
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#364D7C;
+}
+
+.navpath li.navelem a
+{
+ height:32px;
+ display:block;
+ text-decoration: none;
+ outline: none;
+}
+
+.navpath li.navelem a:hover
+{
+ color:#6884BD;
+}
+
+.navpath li.footer
+{
+ list-style-type:none;
+ float:right;
+ padding-left:10px;
+ padding-right:15px;
+ background-image:none;
+ background-repeat:no-repeat;
+ background-position:right;
+ color:#364D7C;
+ font-size: 8pt;
+}
+
+
+div.summary
+{
+ float: right;
+ font-size: 8pt;
+ padding-right: 5px;
+ width: 50%;
+ text-align: right;
+}
+
+div.summary a
+{
+ white-space: nowrap;
+}
+
+div.ingroups
+{
+ font-size: 8pt;
+ padding-left: 5px;
+ width: 50%;
+ text-align: left;
+}
+
+div.ingroups a
+{
+ white-space: nowrap;
+}
+
+div.header
+{
+ background-image:url('nav_h.png');
+ background-repeat:repeat-x;
+ background-color: #F9FAFC;
+ margin: 0px;
+ border-bottom: 1px solid #C4CFE5;
+}
+
+div.headertitle
+{
+ padding: 5px 5px 5px 10px;
+}
+
+dl
+{
+ padding: 0 0 0 10px;
+}
+
+dl.note, dl.warning, dl.attention, dl.pre, dl.post, dl.invariant, dl.deprecated, dl.todo, dl.test, dl.bug
+{
+ border-left:4px solid;
+ padding: 0 0 0 6px;
+}
+
+dl.note
+{
+ border-color: #D0C000;
+}
+
+dl.warning, dl.attention
+{
+ border-color: #FF0000;
+}
+
+dl.pre, dl.post, dl.invariant
+{
+ border-color: #00D000;
+}
+
+dl.deprecated
+{
+ border-color: #505050;
+}
+
+dl.todo
+{
+ border-color: #00C0E0;
+}
+
+dl.test
+{
+ border-color: #3030E0;
+}
+
+dl.bug
+{
+ border-color: #C08050;
+}
+
+#projectlogo
+{
+ text-align: center;
+ vertical-align: bottom;
+ border-collapse: separate;
+}
+
+#projectlogo img
+{
+ border: 0px none;
+}
+
+#projectname
+{
+ font: 300% Tahoma, Arial,sans-serif;
+ margin: 0px;
+ padding: 2px 0px;
+}
+
+#projectbrief
+{
+ font: 120% Tahoma, Arial,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+
+#projectnumber
+{
+ font: 50% Tahoma, Arial,sans-serif;
+ margin: 0px;
+ padding: 0px;
+}
+
+#titlearea
+{
+ padding: 0px;
+ margin: 0px;
+ width: 100%;
+ border-bottom: 1px solid #5373B4;
+}
+
+.image
+{
+ text-align: center;
+}
+
+.dotgraph
+{
+ text-align: center;
+}
+
+.mscgraph
+{
+ text-align: center;
+}
+
+.caption
+{
+ font-weight: bold;
+}
+
diff --git a/doc/html/doxygen.png b/doc/html/doxygen.png
new file mode 100644
index 0000000..635ed52
--- /dev/null
+++ b/doc/html/doxygen.png
Binary files differ
diff --git a/doc/html/functions.html b/doc/html/functions.html
new file mode 100644
index 0000000..bf8d526
--- /dev/null
+++ b/doc/html/functions.html
@@ -0,0 +1,120 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>TurboJPEG: Data Fields</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="search/search.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
+<!-- Generated by Doxygen 1.7.4 -->
+<script type="text/javascript"><!--
+var searchBox = new SearchBox("searchBox", "search",false,'Search');
+--></script>
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">TurboJPEG <span id="projectnumber">1.2</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li id="searchli">
+ <div id="MSearchBox" class="MSearchBoxInactive">
+ <span class="left">
+ <img id="MSearchSelect" src="search/mag_sel.png"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ alt=""/>
+ <input type="text" id="MSearchField" value="Search" accesskey="S"
+ onfocus="searchBox.OnSearchFieldFocus(true)"
+ onblur="searchBox.OnSearchFieldFocus(false)"
+ onkeyup="searchBox.OnSearchFieldChange(event)"/>
+ </span><span class="right">
+ <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
+ </span>
+ </div>
+ </li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="classes.html"><span>Data Structure Index</span></a></li>
+ <li class="current"><a href="functions.html"><span>Data Fields</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow3" class="tabs2">
+ <ul class="tablist">
+ <li class="current"><a href="functions.html"><span>All</span></a></li>
+ <li><a href="functions_vars.html"><span>Variables</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="contents">
+<div class="textblock">Here is a list of all documented struct and union fields with links to the struct/union documentation for each field:</div><ul>
+<li>customFilter
+: <a class="el" href="structtjtransform.html#a43ee1bcdd2a8d7249a756774f78793c1">tjtransform</a>
+</li>
+<li>data
+: <a class="el" href="structtjtransform.html#a688fe8f1a8ecc12a538d9e561cf338e3">tjtransform</a>
+</li>
+<li>denom
+: <a class="el" href="structtjscalingfactor.html#aefbcdf3e9e62274b2d312c695f133ce3">tjscalingfactor</a>
+</li>
+<li>h
+: <a class="el" href="structtjregion.html#aecefc45a26f4d8b60dd4d825c1710115">tjregion</a>
+</li>
+<li>num
+: <a class="el" href="structtjscalingfactor.html#a9b011e57f981ee23083e2c1aa5e640ec">tjscalingfactor</a>
+</li>
+<li>op
+: <a class="el" href="structtjtransform.html#a2525aab4ba6978a1c273f74fef50e498">tjtransform</a>
+</li>
+<li>options
+: <a class="el" href="structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6">tjtransform</a>
+</li>
+<li>r
+: <a class="el" href="structtjtransform.html#ac324e5e442abec8a961e5bf219db12cf">tjtransform</a>
+</li>
+<li>w
+: <a class="el" href="structtjregion.html#ab6eb73ceef584fc23c8c8097926dce42">tjregion</a>
+</li>
+<li>x
+: <a class="el" href="structtjregion.html#a4b6a37a93997091b26a75831fa291ad9">tjregion</a>
+</li>
+<li>y
+: <a class="el" href="structtjregion.html#a7b3e0c24cfe87acc80e334cafdcf22c2">tjregion</a>
+</li>
+</ul>
+</div>
+<!-- window showing the filter options -->
+<div id="MSearchSelectWindow"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ onkeydown="return searchBox.OnSearchSelectKey(event)">
+<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Variables</a></div>
+
+<!-- iframe showing the search results (closed by default) -->
+<div id="MSearchResultsWindow">
+<iframe src="javascript:void(0)" frameborder="0"
+ name="MSearchResults" id="MSearchResults">
+</iframe>
+</div>
+
+<hr class="footer"/><address class="footer"><small>Generated on Tue Sep 20 2011 13:18:32 for TurboJPEG by 
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/doc/html/functions_vars.html b/doc/html/functions_vars.html
new file mode 100644
index 0000000..6b34012
--- /dev/null
+++ b/doc/html/functions_vars.html
@@ -0,0 +1,120 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>TurboJPEG: Data Fields - Variables</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="search/search.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
+<!-- Generated by Doxygen 1.7.4 -->
+<script type="text/javascript"><!--
+var searchBox = new SearchBox("searchBox", "search",false,'Search');
+--></script>
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">TurboJPEG <span id="projectnumber">1.2</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li id="searchli">
+ <div id="MSearchBox" class="MSearchBoxInactive">
+ <span class="left">
+ <img id="MSearchSelect" src="search/mag_sel.png"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ alt=""/>
+ <input type="text" id="MSearchField" value="Search" accesskey="S"
+ onfocus="searchBox.OnSearchFieldFocus(true)"
+ onblur="searchBox.OnSearchFieldFocus(false)"
+ onkeyup="searchBox.OnSearchFieldChange(event)"/>
+ </span><span class="right">
+ <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
+ </span>
+ </div>
+ </li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="classes.html"><span>Data Structure Index</span></a></li>
+ <li class="current"><a href="functions.html"><span>Data Fields</span></a></li>
+ </ul>
+ </div>
+ <div id="navrow3" class="tabs2">
+ <ul class="tablist">
+ <li><a href="functions.html"><span>All</span></a></li>
+ <li class="current"><a href="functions_vars.html"><span>Variables</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="contents">
+ <ul>
+<li>customFilter
+: <a class="el" href="structtjtransform.html#a43ee1bcdd2a8d7249a756774f78793c1">tjtransform</a>
+</li>
+<li>data
+: <a class="el" href="structtjtransform.html#a688fe8f1a8ecc12a538d9e561cf338e3">tjtransform</a>
+</li>
+<li>denom
+: <a class="el" href="structtjscalingfactor.html#aefbcdf3e9e62274b2d312c695f133ce3">tjscalingfactor</a>
+</li>
+<li>h
+: <a class="el" href="structtjregion.html#aecefc45a26f4d8b60dd4d825c1710115">tjregion</a>
+</li>
+<li>num
+: <a class="el" href="structtjscalingfactor.html#a9b011e57f981ee23083e2c1aa5e640ec">tjscalingfactor</a>
+</li>
+<li>op
+: <a class="el" href="structtjtransform.html#a2525aab4ba6978a1c273f74fef50e498">tjtransform</a>
+</li>
+<li>options
+: <a class="el" href="structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6">tjtransform</a>
+</li>
+<li>r
+: <a class="el" href="structtjtransform.html#ac324e5e442abec8a961e5bf219db12cf">tjtransform</a>
+</li>
+<li>w
+: <a class="el" href="structtjregion.html#ab6eb73ceef584fc23c8c8097926dce42">tjregion</a>
+</li>
+<li>x
+: <a class="el" href="structtjregion.html#a4b6a37a93997091b26a75831fa291ad9">tjregion</a>
+</li>
+<li>y
+: <a class="el" href="structtjregion.html#a7b3e0c24cfe87acc80e334cafdcf22c2">tjregion</a>
+</li>
+</ul>
+</div>
+<!-- window showing the filter options -->
+<div id="MSearchSelectWindow"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ onkeydown="return searchBox.OnSearchSelectKey(event)">
+<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Variables</a></div>
+
+<!-- iframe showing the search results (closed by default) -->
+<div id="MSearchResultsWindow">
+<iframe src="javascript:void(0)" frameborder="0"
+ name="MSearchResults" id="MSearchResults">
+</iframe>
+</div>
+
+<hr class="footer"/><address class="footer"><small>Generated on Tue Sep 20 2011 13:18:32 for TurboJPEG by 
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/doc/html/group___turbo_j_p_e_g.html b/doc/html/group___turbo_j_p_e_g.html
new file mode 100644
index 0000000..8771d83
--- /dev/null
+++ b/doc/html/group___turbo_j_p_e_g.html
@@ -0,0 +1,1543 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>TurboJPEG: TurboJPEG</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="search/search.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
+<!-- Generated by Doxygen 1.7.4 -->
+<script type="text/javascript"><!--
+var searchBox = new SearchBox("searchBox", "search",false,'Search');
+--></script>
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">TurboJPEG <span id="projectnumber">1.2</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li id="searchli">
+ <div id="MSearchBox" class="MSearchBoxInactive">
+ <span class="left">
+ <img id="MSearchSelect" src="search/mag_sel.png"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ alt=""/>
+ <input type="text" id="MSearchField" value="Search" accesskey="S"
+ onfocus="searchBox.OnSearchFieldFocus(true)"
+ onblur="searchBox.OnSearchFieldFocus(false)"
+ onkeyup="searchBox.OnSearchFieldChange(event)"/>
+ </span><span class="right">
+ <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
+ </span>
+ </div>
+ </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#nested-classes">Data Structures</a> |
+<a href="#define-members">Defines</a> |
+<a href="#typedef-members">Typedefs</a> |
+<a href="#enum-members">Enumerations</a> |
+<a href="#func-members">Functions</a> |
+<a href="#var-members">Variables</a> </div>
+ <div class="headertitle">
+<div class="title">TurboJPEG</div> </div>
+</div>
+<div class="contents">
+
+<p>TurboJPEG API.
+<a href="#details">More...</a></p>
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="nested-classes"></a>
+Data Structures</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjscalingfactor.html">tjscalingfactor</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Scaling factor. <a href="structtjscalingfactor.html#details">More...</a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjregion.html">tjregion</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Cropping region. <a href="structtjregion.html#details">More...</a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html">tjtransform</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Lossless transform. <a href="structtjtransform.html#details">More...</a><br/></td></tr>
+<tr><td colspan="2"><h2><a name="define-members"></a>
+Defines</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga5ef3d169162ce77ce348e292a0b7477c">TJ_NUMSAMP</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">The number of chrominance subsampling options. <a href="#ga5ef3d169162ce77ce348e292a0b7477c"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga7010a4402f54a45ba822ad8675a4655e">TJ_NUMPF</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">The number of pixel formats. <a href="#ga7010a4402f54a45ba822ad8675a4655e"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">TJFLAG_BOTTOMUP</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">The uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order. <a href="#ga72ecf4ebe6eb702d3c6f5ca27455e1ec"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga4e872f11c82f241736fa8297920f24e5">TJFLAG_FORCEMMX</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and 32-bit libjpeg-turbo versions only.) <a href="#ga4e872f11c82f241736fa8297920f24e5"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gae17e63189e8cd730feed3efbd2454f38">TJFLAG_FORCESSE</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use SSE code (32-bit IPP and 32-bit libjpeg-turbo versions only) <a href="#gae17e63189e8cd730feed3efbd2454f38"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga8cf0bca96ea4d472563f4b0ebf8c48e7">TJFLAG_FORCESSE2</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (32-bit IPP and 32-bit libjpeg-turbo versions only) <a href="#ga8cf0bca96ea4d472563f4b0ebf8c48e7"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaf9d49066633404da4386d70820295dd2">TJFLAG_FORCESSE3</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (64-bit IPP version only) <a href="#gaf9d49066633404da4386d70820295dd2"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga4ee4506c81177a06f77e2504a22efd2d">TJFLAG_FASTUPSAMPLE</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Use fast, inaccurate chrominance upsampling routines in the JPEG decompressor (libjpeg and libjpeg-turbo versions only) <a href="#ga4ee4506c81177a06f77e2504a22efd2d"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga8808d403c68b62aaa58a4c1e58e98963">TJFLAG_NOREALLOC</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Disable buffer (re)allocation. <a href="#ga8808d403c68b62aaa58a4c1e58e98963"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga0f6dbd18adf38b7d46ac547f0f4d562c">TJ_NUMXOP</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Number of transform operations. <a href="#ga0f6dbd18adf38b7d46ac547f0f4d562c"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00">TJXOPT_PERFECT</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect. <a href="#ga50e03cb5ed115330e212417429600b00"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga319826b7eb1583c0595bbe7b95428709">TJXOPT_TRIM</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed. <a href="#ga319826b7eb1583c0595bbe7b95428709"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2">TJXOPT_CROP</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">This option will enable lossless cropping. <a href="#ga9c771a757fc1294add611906b89ab2d2"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga3acee7b48ade1b99e5588736007c2589">TJXOPT_GRAY</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">This option will discard the color data in the input image and produce a grayscale output image. <a href="#ga3acee7b48ade1b99e5588736007c2589"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gafbf992bbf6e006705886333703ffab31">TJXOPT_NOOUTPUT</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from outputting a JPEG image for this particular transform (this can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.) <a href="#gafbf992bbf6e006705886333703ffab31"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga0aba955473315e405295d978f0c16511">TJPAD</a>(width)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Pad the given width to the nearest 32-bit boundary. <a href="#ga0aba955473315e405295d978f0c16511"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga84878bb65404204743aa18cac02781df">TJSCALED</a>(dimension, scalingFactor)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Compute the scaled value of <code>dimension</code> using the given scaling factor. <a href="#ga84878bb65404204743aa18cac02781df"></a><br/></td></tr>
+<tr><td colspan="2"><h2><a name="typedef-members"></a>
+Typedefs</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">typedef struct <a class="el" href="structtjtransform.html">tjtransform</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaa29f3189c41be12ec5dee7caec318a31">tjtransform</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Lossless transform. <a href="#gaa29f3189c41be12ec5dee7caec318a31"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">typedef void * </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">TurboJPEG instance handle. <a href="#ga758d2634ecb4949de7815cba621f5763"></a><br/></td></tr>
+<tr><td colspan="2"><h2><a name="enum-members"></a>
+Enumerations</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">TJSAMP</a> { <br/>
+  <a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3">TJSAMP_444</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404">TJSAMP_422</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737">TJSAMP_420</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248">TJSAMP_GRAY</a>,
+<br/>
+  <a class="el" href="group___turbo_j_p_e_g.html#gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974">TJSAMP_440</a>
+<br/>
+ }</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Chrominance subsampling options. <a href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">More...</a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">TJPF</a> { <br/>
+  <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c">TJPF_RGB</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839">TJPF_BGR</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01">TJPF_RGBX</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8">TJPF_BGRX</a>,
+<br/>
+  <a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af">TJPF_XBGR</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84">TJPF_XRGB</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a">TJPF_GRAY</a>
+<br/>
+ }</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Pixel formats. <a href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">More...</a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum  </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">TJXOP</a> { <br/>
+  <a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27">TJXOP_NONE</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce">TJXOP_HFLIP</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d">TJXOP_VFLIP</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d">TJXOP_TRANSPOSE</a>,
+<br/>
+  <a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4">TJXOP_TRANSVERSE</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128">TJXOP_ROT90</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692">TJXOP_ROT180</a>,
+<a class="el" href="group___turbo_j_p_e_g.html#gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08">TJXOP_ROT270</a>
+<br/>
+ }</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Transform operations for <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> <a href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">More...</a><br/></td></tr>
+<tr><td colspan="2"><h2><a name="func-members"></a>
+Functions</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga3d10c47fbe4a2489a2b30c931551d01a">tjInitCompress</a> (void)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a TurboJPEG compressor instance. <a href="#ga3d10c47fbe4a2489a2b30c931551d01a"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2">tjCompress2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Compress an RGB or grayscale image into a JPEG image. <a href="#gaba62b7a98f960839b588579898495cf2"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gaccc5bca7f12fcdcc302e6e1c6d4b311b">tjBufSize</a> (int width, int height, int jpegSubsamp)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. <a href="#gaccc5bca7f12fcdcc302e6e1c6d4b311b"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned long DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9d0cb06fd5052d21b6f2b382db8b219c">tjBufSizeYUV</a> (int width, int height, int subsamp)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters. <a href="#ga9d0cb06fd5052d21b6f2b382db8b219c"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga0fa4e7b1943687c6a0c0304529c55d35">tjEncodeYUV2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int subsamp, int flags)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Encode an RGB or grayscale image into a YUV planar image. <a href="#ga0fa4e7b1943687c6a0c0304529c55d35"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gae5408179d041e2a2f7199c8283cf649e">tjInitDecompress</a> (void)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a TurboJPEG decompressor instance. <a href="#gae5408179d041e2a2f7199c8283cf649e"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gac5675fceb7997b385516cdffdb34e6aa">tjDecompressHeader2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, int *jpegSubsamp)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Retrieve information about a JPEG image without decompressing it. <a href="#gac5675fceb7997b385516cdffdb34e6aa"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="structtjscalingfactor.html">tjscalingfactor</a> *DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga6449044b9af402999ccf52f401333be8">tjGetScalingFactors</a> (int *numscalingfactors)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports. <a href="#ga6449044b9af402999ccf52f401333be8"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gada69cc6443d1bb493b40f1626259e5e9">tjDecompress2</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Decompress a JPEG image to an RGB or grayscale image. <a href="#gada69cc6443d1bb493b40f1626259e5e9"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gad7810af095624a4016e72957a50f77d8">tjDecompressToYUV</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int flags)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Decompress a JPEG image to a YUV planar image. <a href="#gad7810af095624a4016e72957a50f77d8"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga3155b775bfbac9dbba869b95a0367902">tjInitTransform</a> (void)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a new TurboJPEG transformer instance. <a href="#ga3155b775bfbac9dbba869b95a0367902"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616">tjTransform</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, <a class="el" href="structtjtransform.html">tjtransform</a> *transforms, int flags)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Losslessly transform a JPEG image into another JPEG image. <a href="#gae403193ceb4aafb7e0f56ab587b48616"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT int DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga674adee917b95ad4a896f1ba39e12540">tjDestroy</a> (<a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> handle)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Destroy a TurboJPEG compressor, decompressor, or transformer instance. <a href="#ga674adee917b95ad4a896f1ba39e12540"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT unsigned char *DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff">tjAlloc</a> (int bytes)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Allocate an image buffer for use with TurboJPEG. <a href="#ga5c9234bda6d993cdaffdd89bf81a00ff"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT void DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga8c4a1231dc06a450514c835f6471f137">tjFree</a> (unsigned char *buffer)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Free an image buffer previously allocated by TurboJPEG. <a href="#ga8c4a1231dc06a450514c835f6471f137"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">DLLEXPORT char *DLLCALL </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf">tjGetErrorStr</a> (void)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns a descriptive error message explaining why the last command failed. <a href="#ga9af79c908ec131b1ae8d52fe40375abf"></a><br/></td></tr>
+<tr><td colspan="2"><h2><a name="var-members"></a>
+Variables</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c">tjMCUWidth</a> [TJ_NUMSAMP]</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">MCU block width (in pixels) for a given level of chrominance subsampling. <a href="#ga9e61e7cd47a15a173283ba94e781308c"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf">tjMCUHeight</a> [TJ_NUMSAMP]</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">MCU block height (in pixels) for a given level of chrominance subsampling. <a href="#gabd247bb9fecb393eca57366feb8327bf"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8">tjRedOffset</a> [TJ_NUMPF]</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Red offset (in bytes) for a given pixel format. <a href="#gadd9b446742ac8a3923f7992c7988fea8"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f">tjGreenOffset</a> [TJ_NUMPF]</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Green offset (in bytes) for a given pixel format. <a href="#ga82d6e35da441112a411da41923c0ba2f"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea">tjBlueOffset</a> [TJ_NUMPF]</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Blue offset (in bytes) for a given pixel format. <a href="#ga84e2e35d3f08025f976ec1ec53693dea"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">static const int </td><td class="memItemRight" valign="bottom"><a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c">tjPixelSize</a> [TJ_NUMPF]</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Pixel size (in bytes) for a given pixel format. <a href="#gad77cf8fe5b2bfd3cb3f53098146abb4c"></a><br/></td></tr>
+</table>
+<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
+<p>TurboJPEG API. </p>
+<p>This API provides an interface for generating, decoding, and transforming planar YUV and JPEG images in memory. </p>
+<hr/><h2>Define Documentation</h2>
+<a class="anchor" id="ga7010a4402f54a45ba822ad8675a4655e"></a><!-- doxytag: member="turbojpeg.h::TJ_NUMPF" ref="ga7010a4402f54a45ba822ad8675a4655e" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJ_NUMPF</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>The number of pixel formats. </p>
+
+</div>
+</div>
+<a class="anchor" id="ga5ef3d169162ce77ce348e292a0b7477c"></a><!-- doxytag: member="turbojpeg.h::TJ_NUMSAMP" ref="ga5ef3d169162ce77ce348e292a0b7477c" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJ_NUMSAMP</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>The number of chrominance subsampling options. </p>
+
+</div>
+</div>
+<a class="anchor" id="ga0f6dbd18adf38b7d46ac547f0f4d562c"></a><!-- doxytag: member="turbojpeg.h::TJ_NUMXOP" ref="ga0f6dbd18adf38b7d46ac547f0f4d562c" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJ_NUMXOP</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Number of transform operations. </p>
+
+</div>
+</div>
+<a class="anchor" id="ga72ecf4ebe6eb702d3c6f5ca27455e1ec"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_BOTTOMUP" ref="ga72ecf4ebe6eb702d3c6f5ca27455e1ec" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJFLAG_BOTTOMUP</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>The uncompressed source/destination image is stored in bottom-up (Windows, OpenGL) order, not top-down (X11) order. </p>
+
+</div>
+</div>
+<a class="anchor" id="ga4ee4506c81177a06f77e2504a22efd2d"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FASTUPSAMPLE" ref="ga4ee4506c81177a06f77e2504a22efd2d" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJFLAG_FASTUPSAMPLE</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Use fast, inaccurate chrominance upsampling routines in the JPEG decompressor (libjpeg and libjpeg-turbo versions only) </p>
+
+</div>
+</div>
+<a class="anchor" id="ga4e872f11c82f241736fa8297920f24e5"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FORCEMMX" ref="ga4e872f11c82f241736fa8297920f24e5" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJFLAG_FORCEMMX</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and 32-bit libjpeg-turbo versions only.) </p>
+
+</div>
+</div>
+<a class="anchor" id="gae17e63189e8cd730feed3efbd2454f38"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FORCESSE" ref="gae17e63189e8cd730feed3efbd2454f38" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJFLAG_FORCESSE</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Turn off CPU auto-detection and force TurboJPEG to use SSE code (32-bit IPP and 32-bit libjpeg-turbo versions only) </p>
+
+</div>
+</div>
+<a class="anchor" id="ga8cf0bca96ea4d472563f4b0ebf8c48e7"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FORCESSE2" ref="ga8cf0bca96ea4d472563f4b0ebf8c48e7" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJFLAG_FORCESSE2</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (32-bit IPP and 32-bit libjpeg-turbo versions only) </p>
+
+</div>
+</div>
+<a class="anchor" id="gaf9d49066633404da4386d70820295dd2"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_FORCESSE3" ref="gaf9d49066633404da4386d70820295dd2" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJFLAG_FORCESSE3</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (64-bit IPP version only) </p>
+
+</div>
+</div>
+<a class="anchor" id="ga8808d403c68b62aaa58a4c1e58e98963"></a><!-- doxytag: member="turbojpeg.h::TJFLAG_NOREALLOC" ref="ga8808d403c68b62aaa58a4c1e58e98963" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJFLAG_NOREALLOC</td>
+ </tr>
+ </table>
+</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#gaba62b7a98f960839b588579898495cf2" title="Compress an RGB or grayscale image into a JPEG image.">tjCompress2()</a> or <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" 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>
+
+</div>
+</div>
+<a class="anchor" id="ga0aba955473315e405295d978f0c16511"></a><!-- doxytag: member="turbojpeg.h::TJPAD" ref="ga0aba955473315e405295d978f0c16511" args="(width)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJPAD</td>
+ <td>(</td>
+ <td class="paramtype"> </td>
+ <td class="paramname">width</td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Pad the given width to the nearest 32-bit boundary. </p>
+
+</div>
+</div>
+<a class="anchor" id="ga84878bb65404204743aa18cac02781df"></a><!-- doxytag: member="turbojpeg.h::TJSCALED" ref="ga84878bb65404204743aa18cac02781df" args="(dimension, scalingFactor)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJSCALED</td>
+ <td>(</td>
+ <td class="paramtype"> </td>
+ <td class="paramname">dimension, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"> </td>
+ <td class="paramname">scalingFactor </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Compute the scaled value of <code>dimension</code> using the given scaling factor. </p>
+<p>This macro performs the integer equivalent of <code>ceil(dimension * scalingFactor)</code>. </p>
+
+</div>
+</div>
+<a class="anchor" id="ga9c771a757fc1294add611906b89ab2d2"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_CROP" ref="ga9c771a757fc1294add611906b89ab2d2" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJXOPT_CROP</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>This option will enable lossless cropping. </p>
+<p>See <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> for more information. </p>
+
+</div>
+</div>
+<a class="anchor" id="ga3acee7b48ade1b99e5588736007c2589"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_GRAY" ref="ga3acee7b48ade1b99e5588736007c2589" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJXOPT_GRAY</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>This option will discard the color data in the input image and produce a grayscale output image. </p>
+
+</div>
+</div>
+<a class="anchor" id="gafbf992bbf6e006705886333703ffab31"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_NOOUTPUT" ref="gafbf992bbf6e006705886333703ffab31" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJXOPT_NOOUTPUT</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>This option will prevent <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> from outputting a JPEG image for this particular transform (this can be used in conjunction with a custom filter to capture the transformed DCT coefficients without transcoding them.) </p>
+
+</div>
+</div>
+<a class="anchor" id="ga50e03cb5ed115330e212417429600b00"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_PERFECT" ref="ga50e03cb5ed115330e212417429600b00" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJXOPT_PERFECT</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to return an error if the transform is not perfect. </p>
+<p>Lossless transforms operate on MCU blocks, whose size depends on the level of chrominance subsampling used (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> and <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>.) If the image's width or height is not evenly divisible by the MCU block size, then there will be partial MCU blocks on the right and/or bottom edges. It is not possible to move these partial MCU blocks to the top or left of the image, so any transform that would require that is "imperfect." If this option is not specified, then any partial MCU blocks that cannot be transformed will be left in place, which will create odd-looking strips on the right or bottom edge of the image. </p>
+
+</div>
+</div>
+<a class="anchor" id="ga319826b7eb1583c0595bbe7b95428709"></a><!-- doxytag: member="turbojpeg.h::TJXOPT_TRIM" ref="ga319826b7eb1583c0595bbe7b95428709" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">#define TJXOPT_TRIM</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>This option will cause <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> to discard any partial MCU blocks that cannot be transformed. </p>
+
+</div>
+</div>
+<hr/><h2>Typedef Documentation</h2>
+<a class="anchor" id="ga758d2634ecb4949de7815cba621f5763"></a><!-- doxytag: member="turbojpeg.h::tjhandle" ref="ga758d2634ecb4949de7815cba621f5763" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">typedef void* <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>TurboJPEG instance handle. </p>
+
+</div>
+</div>
+<a class="anchor" id="gaa29f3189c41be12ec5dee7caec318a31"></a><!-- doxytag: member="turbojpeg.h::tjtransform" ref="gaa29f3189c41be12ec5dee7caec318a31" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">typedef struct <a class="el" href="structtjtransform.html">tjtransform</a> <a class="el" href="structtjtransform.html">tjtransform</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Lossless transform. </p>
+
+</div>
+</div>
+<hr/><h2>Enumeration Type Documentation</h2>
+<a class="anchor" id="gac916144e26c3817ac514e64ae5d12e2a"></a><!-- doxytag: member="turbojpeg.h::TJPF" ref="gac916144e26c3817ac514e64ae5d12e2a" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">TJPF</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Pixel formats. </p>
+<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c"></a><!-- doxytag: member="TJPF_RGB" ref="ggac916144e26c3817ac514e64ae5d12e2aa7ce93230bff449518ce387c17e6ed37c" args="" -->TJPF_RGB</em> </td><td>
+<p>RGB pixel format. </p>
+<p>The red, green, and blue components in the image are stored in 3-byte pixels in the order R, G, B from lowest to highest byte address within each pixel. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839"></a><!-- doxytag: member="TJPF_BGR" ref="ggac916144e26c3817ac514e64ae5d12e2aab10624437fb8ef495a0b153e65749839" args="" -->TJPF_BGR</em> </td><td>
+<p>BGR pixel format. </p>
+<p>The red, green, and blue components in the image are stored in 3-byte pixels in the order B, G, R from lowest to highest byte address within each pixel. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01"></a><!-- doxytag: member="TJPF_RGBX" ref="ggac916144e26c3817ac514e64ae5d12e2aa83973bebb7e2dc6fa8bae89ff3f42e01" args="" -->TJPF_RGBX</em> </td><td>
+<p>RGBX pixel format. </p>
+<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from lowest to highest byte address within each pixel. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8"></a><!-- doxytag: member="TJPF_BGRX" ref="ggac916144e26c3817ac514e64ae5d12e2aa2a1fbf569ca79897eae886e3376ca4c8" args="" -->TJPF_BGRX</em> </td><td>
+<p>BGRX pixel format. </p>
+<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from lowest to highest byte address within each pixel. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af"></a><!-- doxytag: member="TJPF_XBGR" ref="ggac916144e26c3817ac514e64ae5d12e2aaf6603b27147de47e212e75dac027b2af" args="" -->TJPF_XBGR</em> </td><td>
+<p>XBGR pixel format. </p>
+<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order R, G, B from highest to lowest byte address within each pixel. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84"></a><!-- doxytag: member="TJPF_XRGB" ref="ggac916144e26c3817ac514e64ae5d12e2aadae996905efcfa3b42a0bb3bea7f9d84" args="" -->TJPF_XRGB</em> </td><td>
+<p>XRGB pixel format. </p>
+<p>The red, green, and blue components in the image are stored in 4-byte pixels in the order B, G, R from highest to lowest byte address within each pixel. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a"></a><!-- doxytag: member="TJPF_GRAY" ref="ggac916144e26c3817ac514e64ae5d12e2aa5431b54b015337705f13118073711a1a" args="" -->TJPF_GRAY</em> </td><td>
+<p>Grayscale pixel format. </p>
+<p>Each 1-byte pixel represents a luminance (brightness) level from 0 to 255. </p>
+</td></tr>
+</table>
+</dd>
+</dl>
+
+</div>
+</div>
+<a class="anchor" id="ga1d047060ea80bb9820d540bb928e9074"></a><!-- doxytag: member="turbojpeg.h::TJSAMP" ref="ga1d047060ea80bb9820d540bb928e9074" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">TJSAMP</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Chrominance subsampling options. </p>
+<p>When an image is converted from the RGB to the YCbCr colorspace as part of the JPEG compression process, some of the Cb and Cr (chrominance) components can be discarded or averaged together to produce a smaller image with little perceptible loss of image clarity (the human eye is more sensitive to small changes in brightness than small changes in color.) This is called "chrominance subsampling". </p>
+<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
+<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3"></a><!-- doxytag: member="TJSAMP_444" ref="gga1d047060ea80bb9820d540bb928e9074afb8da4f44197837bdec0a4f593dacae3" args="" -->TJSAMP_444</em> </td><td>
+<p>4:4:4 chrominance subsampling (no chrominance subsampling). </p>
+<p>The JPEG or YUV image will contain one chrominance component for every pixel in the source image. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404"></a><!-- doxytag: member="TJSAMP_422" ref="gga1d047060ea80bb9820d540bb928e9074a136130902cc578f11f32429b59368404" args="" -->TJSAMP_422</em> </td><td>
+<p>4:2:2 chrominance subsampling. </p>
+<p>The JPEG or YUV image will contain one chrominance component for every 2x1 block of pixels in the source image. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737"></a><!-- doxytag: member="TJSAMP_420" ref="gga1d047060ea80bb9820d540bb928e9074a63085dbf683cfe39e513cdb6343e3737" args="" -->TJSAMP_420</em> </td><td>
+<p>4:2:0 chrominance subsampling. </p>
+<p>The JPEG or YUV image will contain one chrominance component for every 2x2 block of pixels in the source image. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248"></a><!-- doxytag: member="TJSAMP_GRAY" ref="gga1d047060ea80bb9820d540bb928e9074a3f1c9504842ddc7a48d0f690754b6248" args="" -->TJSAMP_GRAY</em> </td><td>
+<p>Grayscale. </p>
+<p>The JPEG or YUV image will contain no chrominance components. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974"></a><!-- doxytag: member="TJSAMP_440" ref="gga1d047060ea80bb9820d540bb928e9074accf740e6f3aa6ba20ba922cad13cb974" args="" -->TJSAMP_440</em> </td><td>
+<p>4:4:0 chrominance subsampling. </p>
+<p>The JPEG or YUV image will contain one chrominance component for every 1x2 block of pixels in the source image. </p>
+</td></tr>
+</table>
+</dd>
+</dl>
+
+</div>
+</div>
+<a class="anchor" id="ga2de531af4e7e6c4f124908376b354866"></a><!-- doxytag: member="turbojpeg.h::TJXOP" ref="ga2de531af4e7e6c4f124908376b354866" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">enum <a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">TJXOP</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Transform operations for <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a> </p>
+<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27"></a><!-- doxytag: member="TJXOP_NONE" ref="gga2de531af4e7e6c4f124908376b354866aad88c0366cd3f7d0eac9d7a3fa1c2c27" args="" -->TJXOP_NONE</em> </td><td>
+<p>Do not transform the position of the image pixels. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce"></a><!-- doxytag: member="TJXOP_HFLIP" ref="gga2de531af4e7e6c4f124908376b354866aa0df69776caa30f0fa28e26332d311ce" args="" -->TJXOP_HFLIP</em> </td><td>
+<p>Flip (mirror) image horizontally. </p>
+<p>This transform is imperfect if there are any partial MCU blocks on the right edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d"></a><!-- doxytag: member="TJXOP_VFLIP" ref="gga2de531af4e7e6c4f124908376b354866a324eddfbec53b7e691f61e56929d0d5d" args="" -->TJXOP_VFLIP</em> </td><td>
+<p>Flip (mirror) image vertically. </p>
+<p>This transform is imperfect if there are any partial MCU blocks on the bottom edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d"></a><!-- doxytag: member="TJXOP_TRANSPOSE" ref="gga2de531af4e7e6c4f124908376b354866a31060aed199f886afdd417f80499c32d" args="" -->TJXOP_TRANSPOSE</em> </td><td>
+<p>Transpose image (flip/mirror along upper left to lower right axis.) This transform is always perfect. </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4"></a><!-- doxytag: member="TJXOP_TRANSVERSE" ref="gga2de531af4e7e6c4f124908376b354866af3b14d488aea6ece9e5b3df73a74d6a4" args="" -->TJXOP_TRANSVERSE</em> </td><td>
+<p>Transverse transpose image (flip/mirror along upper right to lower left axis.) This transform is imperfect if there are any partial MCU blocks in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128"></a><!-- doxytag: member="TJXOP_ROT90" ref="gga2de531af4e7e6c4f124908376b354866a43b2bbb23bc4bd548422d43fbe9af128" args="" -->TJXOP_ROT90</em> </td><td>
+<p>Rotate image clockwise by 90 degrees. </p>
+<p>This transform is imperfect if there are any partial MCU blocks on the bottom edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692"></a><!-- doxytag: member="TJXOP_ROT180" ref="gga2de531af4e7e6c4f124908376b354866a140952eb8dd0300accfcc22726d69692" args="" -->TJXOP_ROT180</em> </td><td>
+<p>Rotate image 180 degrees. </p>
+<p>This transform is imperfect if there are any partial MCU blocks in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
+</td></tr>
+<tr><td valign="top"><em><a class="anchor" id="gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08"></a><!-- doxytag: member="TJXOP_ROT270" ref="gga2de531af4e7e6c4f124908376b354866a3064ee5dfb7f032df332818587567a08" args="" -->TJXOP_ROT270</em> </td><td>
+<p>Rotate image counter-clockwise by 90 degrees. </p>
+<p>This transform is imperfect if there are any partial MCU blocks on the right edge (see <a class="el" href="group___turbo_j_p_e_g.html#ga50e03cb5ed115330e212417429600b00" title="This option will cause tjTransform() to return an error if the transform is not perfect.">TJXOPT_PERFECT</a>.) </p>
+</td></tr>
+</table>
+</dd>
+</dl>
+
+</div>
+</div>
+<hr/><h2>Function Documentation</h2>
+<a class="anchor" id="ga5c9234bda6d993cdaffdd89bf81a00ff"></a><!-- doxytag: member="turbojpeg.h::tjAlloc" ref="ga5c9234bda6d993cdaffdd89bf81a00ff" args="(int bytes)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT unsigned char* DLLCALL tjAlloc </td>
+ <td>(</td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>bytes</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</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#gaba62b7a98f960839b588579898495cf2" title="Compress an RGB or grayscale image into a JPEG image.">tjCompress2()</a> and <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" 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>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">bytes</td><td>the number of bytes to allocate</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>a pointer to a newly-allocated buffer with the specified number of bytes</dd></dl>
+<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group___turbo_j_p_e_g.html#ga8c4a1231dc06a450514c835f6471f137" title="Free an image buffer previously allocated by TurboJPEG.">tjFree()</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gaccc5bca7f12fcdcc302e6e1c6d4b311b"></a><!-- doxytag: member="turbojpeg.h::tjBufSize" ref="gaccc5bca7f12fcdcc302e6e1c6d4b311b" args="(int width, int height, int jpegSubsamp)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT unsigned long DLLCALL tjBufSize </td>
+ <td>(</td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>width</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>height</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>jpegSubsamp</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>The maximum size of the buffer (in bytes) required to hold a JPEG image with the given parameters. </p>
+<p>The number of bytes returned by this function is larger than the size of the uncompressed source image. The reason for this is that the JPEG format uses 16-bit coefficients, and it is thus possible for a very high-quality JPEG image with very high frequency content to expand rather than compress when converted to the JPEG format. Such images represent a very rare corner case, but since there is no way to predict the size of a JPEG image prior to compression, the corner case has to be handled.</p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">width</td><td>width of the image (in pixels) </td></tr>
+ <tr><td class="paramname">height</td><td>height of the image (in pixels) </td></tr>
+ <tr><td class="paramname">jpegSubsamp</td><td>the level of chrominance subsampling to be used when generating the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the maximum size of the buffer (in bytes) required to hold the image, or -1 if the arguments are out of bounds. </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga9d0cb06fd5052d21b6f2b382db8b219c"></a><!-- doxytag: member="turbojpeg.h::tjBufSizeYUV" ref="ga9d0cb06fd5052d21b6f2b382db8b219c" args="(int width, int height, int subsamp)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT unsigned long DLLCALL tjBufSizeYUV </td>
+ <td>(</td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>width</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>height</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>subsamp</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">width</td><td>width of the image (in pixels) </td></tr>
+ <tr><td class="paramname">height</td><td>height of the image (in pixels) </td></tr>
+ <tr><td class="paramname">subsamp</td><td>level of chrominance subsampling in the image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>the size of the buffer (in bytes) required to hold the image, or -1 if the arguments are out of bounds. </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gaba62b7a98f960839b588579898495cf2"></a><!-- doxytag: member="turbojpeg.h::tjCompress2" ref="gaba62b7a98f960839b588579898495cf2" args="(tjhandle handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf, unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT int DLLCALL tjCompress2 </td>
+ <td>(</td>
+ <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> </td>
+ <td class="paramname"><em>handle</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned char * </td>
+ <td class="paramname"><em>srcBuf</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>width</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>pitch</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>height</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>pixelFormat</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned char ** </td>
+ <td class="paramname"><em>jpegBuf</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned long * </td>
+ <td class="paramname"><em>jpegSize</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>jpegSubsamp</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>jpegQual</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>flags</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Compress an RGB or grayscale image into a JPEG image. </p>
+<dl><dt><b>Parameters:</b></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 compressed </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 of 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>
+ <tr><td class="paramname">pixelFormat</td><td>pixel format of the source image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) </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>
+</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 which 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.) </td></tr>
+ <tr><td class="paramname">jpegSubsamp</td><td>the level of chrominance subsampling to be used when generating the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) </td></tr>
+ <tr><td class="paramname">jpegQual</td><td>the image quality of the generated JPEG image (1 = worst, 100 = best) </td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gada69cc6443d1bb493b40f1626259e5e9"></a><!-- doxytag: member="turbojpeg.h::tjDecompress2" ref="gada69cc6443d1bb493b40f1626259e5e9" args="(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch, int height, int pixelFormat, int flags)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT int DLLCALL tjDecompress2 </td>
+ <td>(</td>
+ <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> </td>
+ <td class="paramname"><em>handle</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned char * </td>
+ <td class="paramname"><em>jpegBuf</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned long </td>
+ <td class="paramname"><em>jpegSize</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned char * </td>
+ <td class="paramname"><em>dstBuf</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>width</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>pitch</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>height</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>pixelFormat</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>flags</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Decompress a JPEG image to an RGB or grayscale image. </p>
+<dl><dt><b>Parameters:</b></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">jpegSize</td><td>size of the JPEG image (in bytes) </td></tr>
+ <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer which 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 dstBuf 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 smaller 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 width is set to 0, then only the height will be considered when determining the scaled image size. </td></tr>
+ <tr><td class="paramname">pitch</td><td>bytes per line of the destination image. Normally, this is <code>scaledWidth * <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 decompressed image is unpadded, else <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>(scaledWidth * <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 decompressed image is padded to the nearest 32-bit boundary, as is the case for Windows bitmaps. (NOTE: <code>scaledWidth</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 width 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>.) You can also be clever and use the pitch parameter to skip lines, etc. Setting this parameter to 0 is the equivalent of setting it to <code>scaledWidth * <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>desired height (in pixels) of the destination image. If this is smaller than the height 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 height. If height is set to 0, then only the width will be considered when determining the scaled image size. </td></tr>
+ <tr><td class="paramname">pixelFormat</td><td>pixel format of the destination image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) </td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gac5675fceb7997b385516cdffdb34e6aa"></a><!-- doxytag: member="turbojpeg.h::tjDecompressHeader2" ref="gac5675fceb7997b385516cdffdb34e6aa" args="(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height, int *jpegSubsamp)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT int DLLCALL tjDecompressHeader2 </td>
+ <td>(</td>
+ <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> </td>
+ <td class="paramname"><em>handle</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned char * </td>
+ <td class="paramname"><em>jpegBuf</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned long </td>
+ <td class="paramname"><em>jpegSize</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int * </td>
+ <td class="paramname"><em>width</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int * </td>
+ <td class="paramname"><em>height</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int * </td>
+ <td class="paramname"><em>jpegSubsamp</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Retrieve information about a JPEG image without decompressing it. </p>
+<dl><dt><b>Parameters:</b></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">jpegSize</td><td>size of the JPEG image (in bytes) </td></tr>
+ <tr><td class="paramname">width</td><td>pointer to an integer variable which will receive the width (in pixels) of the JPEG image </td></tr>
+ <tr><td class="paramname">height</td><td>pointer to an integer variable which will receive the height (in pixels) of the JPEG image </td></tr>
+ <tr><td class="paramname">jpegSubsamp</td><td>pointer to an integer variable which will receive the level of chrominance subsampling used when compressing the JPEG image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.)</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gad7810af095624a4016e72957a50f77d8"></a><!-- doxytag: member="turbojpeg.h::tjDecompressToYUV" ref="gad7810af095624a4016e72957a50f77d8" args="(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf, int flags)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT int DLLCALL tjDecompressToYUV </td>
+ <td>(</td>
+ <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> </td>
+ <td class="paramname"><em>handle</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned char * </td>
+ <td class="paramname"><em>jpegBuf</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned long </td>
+ <td class="paramname"><em>jpegSize</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned char * </td>
+ <td class="paramname"><em>dstBuf</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>flags</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Decompress a JPEG image to a YUV planar image. </p>
+<p>This function performs JPEG decompression but leaves out the color conversion step, so a planar YUV image is generated instead of an RGB image. The padding of the planes in this image is the same as the images generated by <a class="el" href="group___turbo_j_p_e_g.html#ga0fa4e7b1943687c6a0c0304529c55d35" title="Encode an RGB or grayscale image into a YUV planar image.">tjEncodeYUV2()</a>. Note that, if the width or height of the image is not an even multiple of the MCU block size (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> and <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.</p>
+<dl><dt><b>Parameters:</b></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">jpegSize</td><td>size of the JPEG image (in bytes) </td></tr>
+ <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer which will receive the YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#ga9d0cb06fd5052d21b6f2b382db8b219c" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV</a> to determine the appropriate size for this buffer based on the image width, height, and level of subsampling. </td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga674adee917b95ad4a896f1ba39e12540"></a><!-- doxytag: member="turbojpeg.h::tjDestroy" ref="ga674adee917b95ad4a896f1ba39e12540" args="(tjhandle handle)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT int DLLCALL tjDestroy </td>
+ <td>(</td>
+ <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> </td>
+ <td class="paramname"><em>handle</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Destroy a TurboJPEG compressor, decompressor, or transformer instance. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">handle</td><td>a handle to a TurboJPEG compressor, decompressor or transformer instance</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga0fa4e7b1943687c6a0c0304529c55d35"></a><!-- doxytag: member="turbojpeg.h::tjEncodeYUV2" ref="ga0fa4e7b1943687c6a0c0304529c55d35" args="(tjhandle handle, unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf, int subsamp, int flags)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT int DLLCALL tjEncodeYUV2 </td>
+ <td>(</td>
+ <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> </td>
+ <td class="paramname"><em>handle</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned char * </td>
+ <td class="paramname"><em>srcBuf</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>width</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>pitch</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>height</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>pixelFormat</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned char * </td>
+ <td class="paramname"><em>dstBuf</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>subsamp</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>flags</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Encode an RGB or grayscale image into a YUV planar image. </p>
+<p>This function uses the accelerated color conversion routines in TurboJPEG's underlying codec to produce a planar YUV image that is suitable for X Video. Specifically, if the chrominance components are subsampled along the horizontal dimension, then the width of the luminance plane is padded to 2 in the output image (same goes for the height of the luminance plane, if the chrominance components are subsampled along the vertical dimension.) Also, each line of each plane in the output image is padded to 4 bytes. Although this will work with any subsampling option, it is really only useful in combination with TJ_420, which produces an image compatible with the I420 (AKA "YUV420P") format.</p>
+<dl><dt><b>Parameters:</b></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">width</td><td>width (in pixels) of the source image </td></tr>
+ <tr><td class="paramname">pitch</td><td>bytes per line of 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>
+ <tr><td class="paramname">pixelFormat</td><td>pixel format of the source image (see <a class="el" href="group___turbo_j_p_e_g.html#gac916144e26c3817ac514e64ae5d12e2a">Pixel formats</a>.) </td></tr>
+ <tr><td class="paramname">dstBuf</td><td>pointer to an image buffer which will receive the YUV image. Use <a class="el" href="group___turbo_j_p_e_g.html#ga9d0cb06fd5052d21b6f2b382db8b219c" title="The size of the buffer (in bytes) required to hold a YUV planar image with the given parameters...">tjBufSizeYUV()</a> to determine the appropriate size for this buffer based on the image width, height, and level of chrominance subsampling. </td></tr>
+ <tr><td class="paramname">subsamp</td><td>the level of chrominance subsampling to be used when generating the YUV image (see <a class="el" href="group___turbo_j_p_e_g.html#ga1d047060ea80bb9820d540bb928e9074">Chrominance subsampling options</a>.) </td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga8c4a1231dc06a450514c835f6471f137"></a><!-- doxytag: member="turbojpeg.h::tjFree" ref="ga8c4a1231dc06a450514c835f6471f137" args="(unsigned char *buffer)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT void DLLCALL tjFree </td>
+ <td>(</td>
+ <td class="paramtype">unsigned char * </td>
+ <td class="paramname"><em>buffer</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</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#gaba62b7a98f960839b588579898495cf2" title="Compress an RGB or grayscale image into a JPEG image.">tjCompress2()</a> or <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" 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>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">buffer</td><td>address of the buffer to free</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="group___turbo_j_p_e_g.html#ga5c9234bda6d993cdaffdd89bf81a00ff" title="Allocate an image buffer for use with TurboJPEG.">tjAlloc()</a> </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga9af79c908ec131b1ae8d52fe40375abf"></a><!-- doxytag: member="turbojpeg.h::tjGetErrorStr" ref="ga9af79c908ec131b1ae8d52fe40375abf" args="(void)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT char* DLLCALL tjGetErrorStr </td>
+ <td>(</td>
+ <td class="paramtype">void </td>
+ <td class="paramname"></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Returns a descriptive error message explaining why the last command failed. </p>
+<dl class="return"><dt><b>Returns:</b></dt><dd>a descriptive error message explaining why the last command failed. </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga6449044b9af402999ccf52f401333be8"></a><!-- doxytag: member="turbojpeg.h::tjGetScalingFactors" ref="ga6449044b9af402999ccf52f401333be8" args="(int *numscalingfactors)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT <a class="el" href="structtjscalingfactor.html">tjscalingfactor</a>* DLLCALL tjGetScalingFactors </td>
+ <td>(</td>
+ <td class="paramtype">int * </td>
+ <td class="paramname"><em>numscalingfactors</em></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Returns a list of fractional scaling factors that the JPEG decompressor in this implementation of TurboJPEG supports. </p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">numscalingfactors</td><td>pointer to an integer variable that will receive the number of elements in the list</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>a pointer to a list of fractional scaling factors, or NULL if an error is encountered (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga3d10c47fbe4a2489a2b30c931551d01a"></a><!-- doxytag: member="turbojpeg.h::tjInitCompress" ref="ga3d10c47fbe4a2489a2b30c931551d01a" args="(void)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL tjInitCompress </td>
+ <td>(</td>
+ <td class="paramtype">void </td>
+ <td class="paramname"></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Create a TurboJPEG compressor instance. </p>
+<dl class="return"><dt><b>Returns:</b></dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gae5408179d041e2a2f7199c8283cf649e"></a><!-- doxytag: member="turbojpeg.h::tjInitDecompress" ref="gae5408179d041e2a2f7199c8283cf649e" args="(void)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL tjInitDecompress </td>
+ <td>(</td>
+ <td class="paramtype">void </td>
+ <td class="paramname"></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Create a TurboJPEG decompressor instance. </p>
+<dl class="return"><dt><b>Returns:</b></dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="ga3155b775bfbac9dbba869b95a0367902"></a><!-- doxytag: member="turbojpeg.h::tjInitTransform" ref="ga3155b775bfbac9dbba869b95a0367902" args="(void)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT <a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> DLLCALL tjInitTransform </td>
+ <td>(</td>
+ <td class="paramtype">void </td>
+ <td class="paramname"></td><td>)</td>
+ <td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Create a new TurboJPEG transformer instance. </p>
+<dl class="return"><dt><b>Returns:</b></dt><dd>a handle to the newly-created instance, or NULL if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="gae403193ceb4aafb7e0f56ab587b48616"></a><!-- doxytag: member="turbojpeg.h::tjTransform" ref="gae403193ceb4aafb7e0f56ab587b48616" args="(tjhandle handle, unsigned char *jpegBuf, unsigned long jpegSize, int n, unsigned char **dstBufs, unsigned long *dstSizes, tjtransform *transforms, int flags)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">DLLEXPORT int DLLCALL tjTransform </td>
+ <td>(</td>
+ <td class="paramtype"><a class="el" href="group___turbo_j_p_e_g.html#ga758d2634ecb4949de7815cba621f5763">tjhandle</a> </td>
+ <td class="paramname"><em>handle</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned char * </td>
+ <td class="paramname"><em>jpegBuf</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned long </td>
+ <td class="paramname"><em>jpegSize</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>n</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned char ** </td>
+ <td class="paramname"><em>dstBufs</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">unsigned long * </td>
+ <td class="paramname"><em>dstSizes</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype"><a class="el" href="structtjtransform.html">tjtransform</a> * </td>
+ <td class="paramname"><em>transforms</em>, </td>
+ </tr>
+ <tr>
+ <td class="paramkey"></td>
+ <td></td>
+ <td class="paramtype">int </td>
+ <td class="paramname"><em>flags</em> </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>)</td>
+ <td></td><td></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Losslessly transform a JPEG image into another JPEG image. </p>
+<p>Lossless transforms work by moving the raw coefficients from one JPEG image structure to another without altering the values of the coefficients. While this is typically faster than decompressing the image, transforming it, and re-compressing it, lossless transforms are not free. Each lossless transform requires reading and Huffman decoding all of the coefficients in the source image, regardless of the size of the destination image. Thus, this function provides a means of generating multiple transformed images from the same source or of applying multiple transformations simultaneously, in order to eliminate the need to read the source coefficients multiple times.</p>
+<dl><dt><b>Parameters:</b></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 image to transform </td></tr>
+ <tr><td class="paramname">jpegSize</td><td>size of the JPEG 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">
+<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 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>
+</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 which 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>
+ <tr><td class="paramname">transforms</td><td>pointer to an array of n tjtransform structures, each of which specifies the transform parameters and/or cropping region for the corresponding transformed output image. </td></tr>
+ <tr><td class="paramname">flags</td><td>the bitwise OR of one or more of the <a class="el" href="group___turbo_j_p_e_g.html#ga72ecf4ebe6eb702d3c6f5ca27455e1ec">flags</a>.</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if successful, or -1 if an error occurred (see <a class="el" href="group___turbo_j_p_e_g.html#ga9af79c908ec131b1ae8d52fe40375abf" title="Returns a descriptive error message explaining why the last command failed.">tjGetErrorStr()</a>.) </dd></dl>
+
+</div>
+</div>
+<hr/><h2>Variable Documentation</h2>
+<a class="anchor" id="ga84e2e35d3f08025f976ec1ec53693dea"></a><!-- doxytag: member="turbojpeg.h::tjBlueOffset" ref="ga84e2e35d3f08025f976ec1ec53693dea" args="[TJ_NUMPF]" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#ga84e2e35d3f08025f976ec1ec53693dea">tjBlueOffset</a>[TJ_NUMPF]<code> [static]</code></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Blue offset (in bytes) for a given pixel format. </p>
+<p>This specifies the number of bytes that the Blue component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the blue component will be <code>pixel[tjBlueOffset[TJ_BGRX]]</code>. </p>
+
+</div>
+</div>
+<a class="anchor" id="ga82d6e35da441112a411da41923c0ba2f"></a><!-- doxytag: member="turbojpeg.h::tjGreenOffset" ref="ga82d6e35da441112a411da41923c0ba2f" args="[TJ_NUMPF]" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#ga82d6e35da441112a411da41923c0ba2f">tjGreenOffset</a>[TJ_NUMPF]<code> [static]</code></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Green offset (in bytes) for a given pixel format. </p>
+<p>This specifies the number of bytes that the green component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the green component will be <code>pixel[tjGreenOffset[TJ_BGRX]]</code>. </p>
+
+</div>
+</div>
+<a class="anchor" id="gabd247bb9fecb393eca57366feb8327bf"></a><!-- doxytag: member="turbojpeg.h::tjMCUHeight" ref="gabd247bb9fecb393eca57366feb8327bf" args="[TJ_NUMSAMP]" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#gabd247bb9fecb393eca57366feb8327bf">tjMCUHeight</a>[TJ_NUMSAMP]<code> [static]</code></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>MCU block height (in pixels) for a given level of chrominance subsampling. </p>
+<p>MCU block sizes:</p>
+<ul>
+<li>8x8 for no subsampling or grayscale</li>
+<li>16x8 for 4:2:2</li>
+<li>8x16 for 4:4:0</li>
+<li>16x16 for 4:2:0 </li>
+</ul>
+
+</div>
+</div>
+<a class="anchor" id="ga9e61e7cd47a15a173283ba94e781308c"></a><!-- doxytag: member="turbojpeg.h::tjMCUWidth" ref="ga9e61e7cd47a15a173283ba94e781308c" args="[TJ_NUMSAMP]" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#ga9e61e7cd47a15a173283ba94e781308c">tjMCUWidth</a>[TJ_NUMSAMP]<code> [static]</code></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>MCU block width (in pixels) for a given level of chrominance subsampling. </p>
+<p>MCU block sizes:</p>
+<ul>
+<li>8x8 for no subsampling or grayscale</li>
+<li>16x8 for 4:2:2</li>
+<li>8x16 for 4:4:0</li>
+<li>16x16 for 4:2:0 </li>
+</ul>
+
+</div>
+</div>
+<a class="anchor" id="gad77cf8fe5b2bfd3cb3f53098146abb4c"></a><!-- doxytag: member="turbojpeg.h::tjPixelSize" ref="gad77cf8fe5b2bfd3cb3f53098146abb4c" args="[TJ_NUMPF]" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#gad77cf8fe5b2bfd3cb3f53098146abb4c">tjPixelSize</a>[TJ_NUMPF]<code> [static]</code></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Pixel size (in bytes) for a given pixel format. </p>
+
+</div>
+</div>
+<a class="anchor" id="gadd9b446742ac8a3923f7992c7988fea8"></a><!-- doxytag: member="turbojpeg.h::tjRedOffset" ref="gadd9b446742ac8a3923f7992c7988fea8" args="[TJ_NUMPF]" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">const int <a class="el" href="group___turbo_j_p_e_g.html#gadd9b446742ac8a3923f7992c7988fea8">tjRedOffset</a>[TJ_NUMPF]<code> [static]</code></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Red offset (in bytes) for a given pixel format. </p>
+<p>This specifies the number of bytes that the red component is offset from the start of the pixel. For instance, if a pixel of format TJ_BGRX is stored in <code>char pixel[]</code>, then the red component will be <code>pixel[tjRedOffset[TJ_BGRX]]</code>. </p>
+
+</div>
+</div>
+</div>
+<!-- window showing the filter options -->
+<div id="MSearchSelectWindow"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ onkeydown="return searchBox.OnSearchSelectKey(event)">
+<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Variables</a></div>
+
+<!-- iframe showing the search results (closed by default) -->
+<div id="MSearchResultsWindow">
+<iframe src="javascript:void(0)" frameborder="0"
+ name="MSearchResults" id="MSearchResults">
+</iframe>
+</div>
+
+<hr class="footer"/><address class="footer"><small>Generated on Tue Sep 20 2011 13:18:32 for TurboJPEG by 
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/doc/html/index.html b/doc/html/index.html
new file mode 100644
index 0000000..d8af71c
--- /dev/null
+++ b/doc/html/index.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>TurboJPEG: Main Page</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="search/search.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
+<!-- Generated by Doxygen 1.7.4 -->
+<script type="text/javascript"><!--
+var searchBox = new SearchBox("searchBox", "search",false,'Search');
+--></script>
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">TurboJPEG <span id="projectnumber">1.2</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li class="current"><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li id="searchli">
+ <div id="MSearchBox" class="MSearchBoxInactive">
+ <span class="left">
+ <img id="MSearchSelect" src="search/mag_sel.png"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ alt=""/>
+ <input type="text" id="MSearchField" value="Search" accesskey="S"
+ onfocus="searchBox.OnSearchFieldFocus(true)"
+ onblur="searchBox.OnSearchFieldFocus(false)"
+ onkeyup="searchBox.OnSearchFieldChange(event)"/>
+ </span><span class="right">
+ <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
+ </span>
+ </div>
+ </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">TurboJPEG Documentation</div> </div>
+</div>
+<div class="contents">
+</div>
+<!-- window showing the filter options -->
+<div id="MSearchSelectWindow"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ onkeydown="return searchBox.OnSearchSelectKey(event)">
+<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Variables</a></div>
+
+<!-- iframe showing the search results (closed by default) -->
+<div id="MSearchResultsWindow">
+<iframe src="javascript:void(0)" frameborder="0"
+ name="MSearchResults" id="MSearchResults">
+</iframe>
+</div>
+
+<hr class="footer"/><address class="footer"><small>Generated on Tue Sep 20 2011 13:18:32 for TurboJPEG by 
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/doc/html/installdox b/doc/html/installdox
new file mode 100755
index 0000000..edf5bbf
--- /dev/null
+++ b/doc/html/installdox
@@ -0,0 +1,112 @@
+#!/usr/bin/perl
+
+%subst = ( );
+$quiet = 0;
+
+while ( @ARGV ) {
+ $_ = shift @ARGV;
+ if ( s/^-// ) {
+ if ( /^l(.*)/ ) {
+ $v = ($1 eq "") ? shift @ARGV : $1;
+ ($v =~ /\/$/) || ($v .= "/");
+ $_ = $v;
+ if ( /(.+)\@(.+)/ ) {
+ if ( exists $subst{$1} ) {
+ $subst{$1} = $2;
+ } else {
+ print STDERR "Unknown tag file $1 given with option -l\n";
+ &usage();
+ }
+ } else {
+ print STDERR "Argument $_ is invalid for option -l\n";
+ &usage();
+ }
+ }
+ elsif ( /^q/ ) {
+ $quiet = 1;
+ }
+ elsif ( /^\?|^h/ ) {
+ &usage();
+ }
+ else {
+ print STDERR "Illegal option -$_\n";
+ &usage();
+ }
+ }
+ else {
+ push (@files, $_ );
+ }
+}
+
+foreach $sub (keys %subst)
+{
+ if ( $subst{$sub} eq "" )
+ {
+ print STDERR "No substitute given for tag file `$sub'\n";
+ &usage();
+ }
+ elsif ( ! $quiet && $sub ne "_doc" && $sub ne "_cgi" )
+ {
+ print "Substituting $subst{$sub} for each occurrence of tag file $sub\n";
+ }
+}
+
+if ( ! @files ) {
+ if (opendir(D,".")) {
+ foreach $file ( readdir(D) ) {
+ $match = ".html";
+ next if ( $file =~ /^\.\.?$/ );
+ ($file =~ /$match/) && (push @files, $file);
+ ($file =~ /\.svg/) && (push @files, $file);
+ ($file =~ "navtree.js") && (push @files, $file);
+ }
+ closedir(D);
+ }
+}
+
+if ( ! @files ) {
+ print STDERR "Warning: No input files given and none found!\n";
+}
+
+foreach $f (@files)
+{
+ if ( ! $quiet ) {
+ print "Editing: $f...\n";
+ }
+ $oldf = $f;
+ $f .= ".bak";
+ unless (rename $oldf,$f) {
+ print STDERR "Error: cannot rename file $oldf\n";
+ exit 1;
+ }
+ if (open(F,"<$f")) {
+ unless (open(G,">$oldf")) {
+ print STDERR "Error: opening file $oldf for writing\n";
+ exit 1;
+ }
+ if ($oldf ne "tree.js") {
+ while (<F>) {
+ s/doxygen\=\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\" (xlink:href|href|src)=\"\2/doxygen\=\"$1:$subst{$1}\" \3=\"$subst{$1}/g;
+ print G "$_";
+ }
+ }
+ else {
+ while (<F>) {
+ s/\"([^ \"\:\t\>\<]*)\:([^ \"\t\>\<]*)\", \"\2/\"$1:$subst{$1}\" ,\"$subst{$1}/g;
+ print G "$_";
+ }
+ }
+ }
+ else {
+ print STDERR "Warning file $f does not exist\n";
+ }
+ unlink $f;
+}
+
+sub usage {
+ print STDERR "Usage: installdox [options] [html-file [html-file ...]]\n";
+ print STDERR "Options:\n";
+ print STDERR " -l tagfile\@linkName tag file + URL or directory \n";
+ print STDERR " -q Quiet mode\n\n";
+ exit 1;
+}
diff --git a/doc/html/jquery.js b/doc/html/jquery.js
new file mode 100644
index 0000000..c052173
--- /dev/null
+++ b/doc/html/jquery.js
@@ -0,0 +1,54 @@
+/*
+ * jQuery JavaScript Library v1.3.2
+ * http://jquery.com/
+ *
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
+ *
+ * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
+ * Revision: 6246
+ */
+(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},append:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.appendChild(E)}})},prepend:function(){return this.domManip(arguments,true,function(E){if(this.nodeType==1){this.insertBefore(E,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){
+var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
+/*
+ * Sizzle CSS Selector Engine - v0.9.3
+ * Copyright 2009, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0)
+{I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function()
+{G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})();
+/*
+ * jQuery UI 1.7.2
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI
+ */
+jQuery.ui||(function(c){var i=c.fn.remove,d=c.browser.mozilla&&(parseFloat(c.browser.version)<1.9);c.ui={version:"1.7.2",plugin:{add:function(k,l,n){var m=c.ui[k].prototype;for(var j in n){m.plugins[j]=m.plugins[j]||[];m.plugins[j].push([l,n[j]])}},call:function(j,l,k){var n=j.plugins[l];if(!n||!j.element[0].parentNode){return}for(var m=0;m<n.length;m++){if(j.options[n[m][0]]){n[m][1].apply(j.element,k)}}}},contains:function(k,j){return document.compareDocumentPosition?k.compareDocumentPosition(j)&16:k!==j&&k.contains(j)},hasScroll:function(m,k){if(c(m).css("overflow")=="hidden"){return false}var j=(k&&k=="left")?"scrollLeft":"scrollTop",l=false;if(m[j]>0){return true}m[j]=1;l=(m[j]>0);m[j]=0;return l},isOverAxis:function(k,j,l){return(k>j)&&(k<(j+l))},isOver:function(o,k,n,m,j,l){return c.ui.isOverAxis(o,n,j)&&c.ui.isOverAxis(k,m,l)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};if(d){var f=c.attr,e=c.fn.removeAttr,h="http://www.w3.org/2005/07/aaa",a=/^aria-/,b=/^wairole:/;c.attr=function(k,j,l){var m=l!==undefined;return(j=="role"?(m?f.call(this,k,j,"wairole:"+l):(f.apply(this,arguments)||"").replace(b,"")):(a.test(j)?(m?k.setAttributeNS(h,j.replace(a,"aaa:"),l):f.call(this,k,j.replace(a,"aaa:"))):f.apply(this,arguments)))};c.fn.removeAttr=function(j){return(a.test(j)?this.each(function(){this.removeAttributeNS(h,j.replace(a,""))}):e.call(this,j))}}c.fn.extend({remove:function(){c("*",this).add(this).each(function(){c(this).triggerHandler("remove")});return i.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var j;if((c.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){j=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(c.curCSS(this,"position",1))&&(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}else{j=this.parents().filter(function(){return(/(auto|scroll)/).test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!j.length?c(document):j}});c.extend(c.expr[":"],{data:function(l,k,j){return !!c.data(l,j[3])},focusable:function(k){var l=k.nodeName.toLowerCase(),j=c.attr(k,"tabindex");return(/input|select|textarea|button|object/.test(l)?!k.disabled:"a"==l||"area"==l?k.href||!isNaN(j):!isNaN(j))&&!c(k)["area"==l?"parents":"closest"](":hidden").length},tabbable:function(k){var j=c.attr(k,"tabindex");return(isNaN(j)||j>=0)&&c(k).is(":focusable")}});function g(m,n,o,l){function k(q){var p=c[m][n][q]||[];return(typeof p=="string"?p.split(/,?\s+/):p)}var j=k("getter");if(l.length==1&&typeof l[0]=="string"){j=j.concat(k("getterSetter"))}return(c.inArray(o,j)!=-1)}c.widget=function(k,j){var l=k.split(".")[0];k=k.split(".")[1];c.fn[k]=function(p){var n=(typeof p=="string"),o=Array.prototype.slice.call(arguments,1);if(n&&p.substring(0,1)=="_"){return this}if(n&&g(l,k,p,o)){var m=c.data(this[0],k);return(m?m[p].apply(m,o):undefined)}return this.each(function(){var q=c.data(this,k);(!q&&!n&&c.data(this,k,new c[l][k](this,p))._init());(q&&n&&c.isFunction(q[p])&&q[p].apply(q,o))})};c[l]=c[l]||{};c[l][k]=function(o,n){var m=this;this.namespace=l;this.widgetName=k;this.widgetEventPrefix=c[l][k].eventPrefix||k;this.widgetBaseClass=l+"-"+k;this.options=c.extend({},c.widget.defaults,c[l][k].defaults,c.metadata&&c.metadata.get(o)[k],n);this.element=c(o).bind("setData."+k,function(q,p,r){if(q.target==o){return m._setData(p,r)}}).bind("getData."+k,function(q,p){if(q.target==o){return m._getData(p)}}).bind("remove",function(){return m.destroy()})};c[l][k].prototype=c.extend({},c.widget.prototype,j);c[l][k].getterSetter="option"};c.widget.prototype={_init:function(){},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled")},option:function(l,m){var k=l,j=this;if(typeof l=="string"){if(m===undefined){return this._getData(l)}k={};k[l]=m}c.each(k,function(n,o){j._setData(n,o)})},_getData:function(j){return this.options[j]},_setData:function(j,k){this.options[j]=k;if(j=="disabled"){this.element[k?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",k)}},enable:function(){this._setData("disabled",false)},disable:function(){this._setData("disabled",true)},_trigger:function(l,m,n){var p=this.options[l],j=(l==this.widgetEventPrefix?l:this.widgetEventPrefix+l);m=c.Event(m);m.type=j;if(m.originalEvent){for(var k=c.event.props.length,o;k;){o=c.event.props[--k];m[o]=m.originalEvent[o]}}this.element.trigger(m,n);return !(c.isFunction(p)&&p.call(this.element[0],m,n)===false||m.isDefaultPrevented())}};c.widget.defaults={disabled:false};c.ui.mouse={_mouseInit:function(){var j=this;this.element.bind("mousedown."+this.widgetName,function(k){return j._mouseDown(k)}).bind("click."+this.widgetName,function(k){if(j._preventClickEvent){j._preventClickEvent=false;k.stopImmediatePropagation();return false}});if(c.browser.msie){this._mouseUnselectable=this.element.attr("unselectable");this.element.attr("unselectable","on")}this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName);(c.browser.msie&&this.element.attr("unselectable",this._mouseUnselectable))},_mouseDown:function(l){l.originalEvent=l.originalEvent||{};if(l.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(l));this._mouseDownEvent=l;var k=this,m=(l.which==1),j=(typeof this.options.cancel=="string"?c(l.target).parents().add(l.target).filter(this.options.cancel).length:false);if(!m||j||!this._mouseCapture(l)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){k.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(l)&&this._mouseDelayMet(l)){this._mouseStarted=(this._mouseStart(l)!==false);if(!this._mouseStarted){l.preventDefault();return true}}this._mouseMoveDelegate=function(n){return k._mouseMove(n)};this._mouseUpDelegate=function(n){return k._mouseUp(n)};c(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(c.browser.safari||l.preventDefault());l.originalEvent.mouseHandled=true;return true},_mouseMove:function(j){if(c.browser.msie&&!j.button){return this._mouseUp(j)}if(this._mouseStarted){this._mouseDrag(j);return j.preventDefault()}if(this._mouseDistanceMet(j)&&this._mouseDelayMet(j)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,j)!==false);(this._mouseStarted?this._mouseDrag(j):this._mouseUp(j))}return !this._mouseStarted},_mouseUp:function(j){c(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(j.target==this._mouseDownEvent.target);this._mouseStop(j)}return false},_mouseDistanceMet:function(j){return(Math.max(Math.abs(this._mouseDownEvent.pageX-j.pageX),Math.abs(this._mouseDownEvent.pageY-j.pageY))>=this.options.distance)},_mouseDelayMet:function(j){return this.mouseDelayMet},_mouseStart:function(j){},_mouseDrag:function(j){},_mouseStop:function(j){},_mouseCapture:function(j){return true}};c.ui.mouse.defaults={cancel:null,distance:1,delay:0}})(jQuery);;/* * jQuery UI Resizable 1.7.2
+ *
+ * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ *
+ * http://docs.jquery.com/UI/Resizables
+ *
+ * Depends:
+ * ui.core.js
+ */
+(function(c){c.widget("ui.resizable",c.extend({},c.ui.mouse,{_init:function(){var e=this,j=this.options;this.element.addClass("ui-resizable");c.extend(this,{_aspectRatio:!!(j.aspectRatio),aspectRatio:j.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:j.helper||j.ghost||j.animate?j.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){if(/relative/.test(this.element.css("position"))&&c.browser.opera){this.element.css({position:"relative",top:"auto",left:"auto"})}this.element.wrap(c('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=j.handles||(!c(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all"){this.handles="n,e,s,w,se,sw,ne,nw"}var k=this.handles.split(",");this.handles={};for(var f=0;f<k.length;f++){var h=c.trim(k[f]),d="ui-resizable-"+h;var g=c('<div class="ui-resizable-handle '+d+'"></div>');if(/sw|se|ne|nw/.test(h)){g.css({zIndex:++j.zIndex})}if("se"==h){g.addClass("ui-icon ui-icon-gripsmall-diagonal-se")}this.handles[h]=".ui-resizable-"+h;this.element.append(g)}}this._renderAxis=function(p){p=p||this.element;for(var m in this.handles){if(this.handles[m].constructor==String){this.handles[m]=c(this.handles[m],this.element).show()}if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var n=c(this.handles[m],this.element),o=0;o=/sw|ne|nw|se|n|s/.test(m)?n.outerHeight():n.outerWidth();var l=["padding",/ne|nw|n/.test(m)?"Top":/se|sw|s/.test(m)?"Bottom":/^e$/.test(m)?"Right":"Left"].join("");p.css(l,o);this._proportionallyResize()}if(!c(this.handles[m]).length){continue}}};this._renderAxis(this.element);this._handles=c(".ui-resizable-handle",this.element).disableSelection();this._handles.mouseover(function(){if(!e.resizing){if(this.className){var i=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)}e.axis=i&&i[1]?i[1]:"se"}});if(j.autoHide){this._handles.hide();c(this.element).addClass("ui-resizable-autohide").hover(function(){c(this).removeClass("ui-resizable-autohide");e._handles.show()},function(){if(!e.resizing){c(this).addClass("ui-resizable-autohide");e._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var d=function(f){c(f).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){d(this.element);var e=this.element;e.parent().append(this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")})).end().remove()}this.originalElement.css("resize",this.originalResizeStyle);d(this.originalElement)},_mouseCapture:function(e){var f=false;for(var d in this.handles){if(c(this.handles[d])[0]==e.target){f=true}}return this.options.disabled||!!f},_mouseStart:function(f){var i=this.options,e=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:c(document).scrollTop(),left:c(document).scrollLeft()};if(d.is(".ui-draggable")||(/absolute/).test(d.css("position"))){d.css({position:"absolute",top:e.top,left:e.left})}if(c.browser.opera&&(/relative/).test(d.css("position"))){d.css({position:"relative",top:"auto",left:"auto"})}this._renderProxy();var j=b(this.helper.css("left")),g=b(this.helper.css("top"));if(i.containment){j+=c(i.containment).scrollLeft()||0;g+=c(i.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:j,top:g};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:j,top:g};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:f.pageX,top:f.pageY};this.aspectRatio=(typeof i.aspectRatio=="number")?i.aspectRatio:((this.originalSize.width/this.originalSize.height)||1);var h=c(".ui-resizable-"+this.axis).css("cursor");c("body").css("cursor",h=="auto"?this.axis+"-resize":h);d.addClass("ui-resizable-resizing");this._propagate("start",f);return true},_mouseDrag:function(d){var g=this.helper,f=this.options,l={},p=this,i=this.originalMousePosition,m=this.axis;var q=(d.pageX-i.left)||0,n=(d.pageY-i.top)||0;var h=this._change[m];if(!h){return false}var k=h.apply(this,[d,q,n]),j=c.browser.msie&&c.browser.version<7,e=this.sizeDiff;if(this._aspectRatio||d.shiftKey){k=this._updateRatio(k,d)}k=this._respectSize(k,d);this._propagate("resize",d);g.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});if(!this._helper&&this._proportionallyResizeElements.length){this._proportionallyResize()}this._updateCache(k);this._trigger("resize",d,this.ui());return false},_mouseStop:function(g){this.resizing=false;var h=this.options,l=this;if(this._helper){var f=this._proportionallyResizeElements,d=f.length&&(/textarea/i).test(f[0].nodeName),e=d&&c.ui.hasScroll(f[0],"left")?0:l.sizeDiff.height,j=d?0:l.sizeDiff.width;var m={width:(l.size.width-j),height:(l.size.height-e)},i=(parseInt(l.element.css("left"),10)+(l.position.left-l.originalPosition.left))||null,k=(parseInt(l.element.css("top"),10)+(l.position.top-l.originalPosition.top))||null;if(!h.animate){this.element.css(c.extend(m,{top:k,left:i}))}l.helper.height(l.size.height);l.helper.width(l.size.width);if(this._helper&&!h.animate){this._proportionallyResize()}}c("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",g);if(this._helper){this.helper.remove()}return false},_updateCache:function(d){var e=this.options;this.offset=this.helper.offset();if(a(d.left)){this.position.left=d.left}if(a(d.top)){this.position.top=d.top}if(a(d.height)){this.size.height=d.height}if(a(d.width)){this.size.width=d.width}},_updateRatio:function(g,f){var h=this.options,i=this.position,e=this.size,d=this.axis;if(g.height){g.width=(e.height*this.aspectRatio)}else{if(g.width){g.height=(e.width/this.aspectRatio)}}if(d=="sw"){g.left=i.left+(e.width-g.width);g.top=null}if(d=="nw"){g.top=i.top+(e.height-g.height);g.left=i.left+(e.width-g.width)}return g},_respectSize:function(k,f){var i=this.helper,h=this.options,q=this._aspectRatio||f.shiftKey,p=this.axis,s=a(k.width)&&h.maxWidth&&(h.maxWidth<k.width),l=a(k.height)&&h.maxHeight&&(h.maxHeight<k.height),g=a(k.width)&&h.minWidth&&(h.minWidth>k.width),r=a(k.height)&&h.minHeight&&(h.minHeight>k.height);if(g){k.width=h.minWidth}if(r){k.height=h.minHeight}if(s){k.width=h.maxWidth}if(l){k.height=h.maxHeight}var e=this.originalPosition.left+this.originalSize.width,n=this.position.top+this.size.height;var j=/sw|nw|w/.test(p),d=/nw|ne|n/.test(p);if(g&&j){k.left=e-h.minWidth}if(s&&j){k.left=e-h.maxWidth}if(r&&d){k.top=n-h.minHeight}if(l&&d){k.top=n-h.maxHeight}var m=!k.width&&!k.height;if(m&&!k.left&&k.top){k.top=null}else{if(m&&!k.top&&k.left){k.left=null}}return k},_proportionallyResize:function(){var j=this.options;if(!this._proportionallyResizeElements.length){return}var f=this.helper||this.element;for(var e=0;e<this._proportionallyResizeElements.length;e++){var g=this._proportionallyResizeElements[e];if(!this.borderDif){var d=[g.css("borderTopWidth"),g.css("borderRightWidth"),g.css("borderBottomWidth"),g.css("borderLeftWidth")],h=[g.css("paddingTop"),g.css("paddingRight"),g.css("paddingBottom"),g.css("paddingLeft")];this.borderDif=c.map(d,function(k,m){var l=parseInt(k,10)||0,n=parseInt(h[m],10)||0;return l+n})}if(c.browser.msie&&!(!(c(f).is(":hidden")||c(f).parents(":hidden").length))){continue}g.css({height:(f.height()-this.borderDif[0]-this.borderDif[2])||0,width:(f.width()-this.borderDif[1]-this.borderDif[3])||0})}},_renderProxy:function(){var e=this.element,h=this.options;this.elementOffset=e.offset();if(this._helper){this.helper=this.helper||c('<div style="overflow:hidden;"></div>');var d=c.browser.msie&&c.browser.version<7,f=(d?1:0),g=(d?2:-1);this.helper.addClass(this._helper).css({width:this.element.outerWidth()+g,height:this.element.outerHeight()+g,position:"absolute",left:this.elementOffset.left-f+"px",top:this.elementOffset.top-f+"px",zIndex:++h.zIndex});this.helper.appendTo("body").disableSelection()}else{this.helper=this.element}},_change:{e:function(f,e,d){return{width:this.originalSize.width+e}},w:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{left:h.left+e,width:f.width-e}},n:function(g,e,d){var i=this.options,f=this.originalSize,h=this.originalPosition;return{top:h.top+d,height:f.height-d}},s:function(f,e,d){return{height:this.originalSize.height+d}},se:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},sw:function(f,e,d){return c.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[f,e,d]))},ne:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[f,e,d]))},nw:function(f,e,d){return c.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[f,e,d]))}},_propagate:function(e,d){c.ui.plugin.call(this,e,[d,this.ui()]);(e!="resize"&&this._trigger(e,d,this.ui()))},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}));c.extend(c.ui.resizable,{version:"1.7.2",eventPrefix:"resize",defaults:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,cancel:":input,option",containment:false,delay:0,distance:1,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1000}});c.ui.plugin.add("resizable","alsoResize",{start:function(e,f){var d=c(this).data("resizable"),g=d.options;_store=function(h){c(h).each(function(){c(this).data("resizable-alsoresize",{width:parseInt(c(this).width(),10),height:parseInt(c(this).height(),10),left:parseInt(c(this).css("left"),10),top:parseInt(c(this).css("top"),10)})})};if(typeof(g.alsoResize)=="object"&&!g.alsoResize.parentNode){if(g.alsoResize.length){g.alsoResize=g.alsoResize[0];_store(g.alsoResize)}else{c.each(g.alsoResize,function(h,i){_store(h)})}}else{_store(g.alsoResize)}},resize:function(f,h){var e=c(this).data("resizable"),i=e.options,g=e.originalSize,k=e.originalPosition;var j={height:(e.size.height-g.height)||0,width:(e.size.width-g.width)||0,top:(e.position.top-k.top)||0,left:(e.position.left-k.left)||0},d=function(l,m){c(l).each(function(){var p=c(this),q=c(this).data("resizable-alsoresize"),o={},n=m&&m.length?m:["width","height","top","left"];c.each(n||["width","height","top","left"],function(r,t){var s=(q[t]||0)+(j[t]||0);if(s&&s>=0){o[t]=s||null}});if(/relative/.test(p.css("position"))&&c.browser.opera){e._revertToRelativePosition=true;p.css({position:"absolute",top:"auto",left:"auto"})}p.css(o)})};if(typeof(i.alsoResize)=="object"&&!i.alsoResize.nodeType){c.each(i.alsoResize,function(l,m){d(l,m)})}else{d(i.alsoResize)}},stop:function(e,f){var d=c(this).data("resizable");if(d._revertToRelativePosition&&c.browser.opera){d._revertToRelativePosition=false;el.css({position:"relative"})}c(this).removeData("resizable-alsoresize-start")}});c.ui.plugin.add("resizable","animate",{stop:function(h,m){var n=c(this).data("resizable"),i=n.options;var g=n._proportionallyResizeElements,d=g.length&&(/textarea/i).test(g[0].nodeName),e=d&&c.ui.hasScroll(g[0],"left")?0:n.sizeDiff.height,k=d?0:n.sizeDiff.width;var f={width:(n.size.width-k),height:(n.size.height-e)},j=(parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left))||null,l=(parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top))||null;n.element.animate(c.extend(f,l&&j?{top:l,left:j}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var o={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};if(g&&g.length){c(g[0]).css({width:o.width,height:o.height})}n._updateCache(o);n._propagate("resize",h)}})}});c.ui.plugin.add("resizable","containment",{start:function(e,q){var s=c(this).data("resizable"),i=s.options,k=s.element;var f=i.containment,j=(f instanceof c)?f.get(0):(/parent/.test(f))?k.parent().get(0):f;if(!j){return}s.containerElement=c(j);if(/document/.test(f)||f==document){s.containerOffset={left:0,top:0};s.containerPosition={left:0,top:0};s.parentData={element:c(document),left:0,top:0,width:c(document).width(),height:c(document).height()||document.body.parentNode.scrollHeight}}else{var m=c(j),h=[];c(["Top","Right","Left","Bottom"]).each(function(p,o){h[p]=b(m.css("padding"+o))});s.containerOffset=m.offset();s.containerPosition=m.position();s.containerSize={height:(m.innerHeight()-h[3]),width:(m.innerWidth()-h[1])};var n=s.containerOffset,d=s.containerSize.height,l=s.containerSize.width,g=(c.ui.hasScroll(j,"left")?j.scrollWidth:l),r=(c.ui.hasScroll(j)?j.scrollHeight:d);s.parentData={element:j,left:n.left,top:n.top,width:g,height:r}}},resize:function(f,p){var s=c(this).data("resizable"),h=s.options,e=s.containerSize,n=s.containerOffset,l=s.size,m=s.position,q=s._aspectRatio||f.shiftKey,d={top:0,left:0},g=s.containerElement;if(g[0]!=document&&(/static/).test(g.css("position"))){d=n}if(m.left<(s._helper?n.left:0)){s.size.width=s.size.width+(s._helper?(s.position.left-n.left):(s.position.left-d.left));if(q){s.size.height=s.size.width/h.aspectRatio}s.position.left=h.helper?n.left:0}if(m.top<(s._helper?n.top:0))
+{s.size.height=s.size.height+(s._helper?(s.position.top-n.top):s.position.top);if(q){s.size.width=s.size.height*h.aspectRatio}s.position.top=s._helper?n.top:0}s.offset.left=s.parentData.left+s.position.left;s.offset.top=s.parentData.top+s.position.top;var k=Math.abs((s._helper?s.offset.left-d.left:(s.offset.left-d.left))+s.sizeDiff.width),r=Math.abs((s._helper?s.offset.top-d.top:(s.offset.top-n.top))+s.sizeDiff.height);var j=s.containerElement.get(0)==s.element.parent().get(0),i=/relative|absolute/.test(s.containerElement.css("position"));if(j&&i){k-=s.parentData.left}if(k+s.size.width>=s.parentData.width){s.size.width=s.parentData.width-k;if(q){s.size.height=s.size.width/s.aspectRatio}}if(r+s.size.height>=s.parentData.height){s.size.height=s.parentData.height-r;if(q){s.size.width=s.size.height*s.aspectRatio}}},stop:function(e,m){var p=c(this).data("resizable"),f=p.options,k=p.position,l=p.containerOffset,d=p.containerPosition,g=p.containerElement;var i=c(p.helper),q=i.offset(),n=i.outerWidth()-p.sizeDiff.width,j=i.outerHeight()-p.sizeDiff.height;if(p._helper&&!f.animate&&(/relative/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}if(p._helper&&!f.animate&&(/static/).test(g.css("position"))){c(this).css({left:q.left-d.left-l.left,width:n,height:j})}}});c.ui.plugin.add("resizable","ghost",{start:function(f,g){var d=c(this).data("resizable"),h=d.options,e=d.size;d.ghost=d.originalElement.clone();d.ghost.css({opacity:0.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof h.ghost=="string"?h.ghost:"");d.ghost.appendTo(d.helper)},resize:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost){d.ghost.css({position:"relative",height:d.size.height,width:d.size.width})}},stop:function(e,f){var d=c(this).data("resizable"),g=d.options;if(d.ghost&&d.helper){d.helper.get(0).removeChild(d.ghost.get(0))}}});c.ui.plugin.add("resizable","grid",{resize:function(d,l){var n=c(this).data("resizable"),g=n.options,j=n.size,h=n.originalSize,i=n.originalPosition,m=n.axis,k=g._aspectRatio||d.shiftKey;g.grid=typeof g.grid=="number"?[g.grid,g.grid]:g.grid;var f=Math.round((j.width-h.width)/(g.grid[0]||1))*(g.grid[0]||1),e=Math.round((j.height-h.height)/(g.grid[1]||1))*(g.grid[1]||1);if(/^(se|s|e)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e}else{if(/^(ne)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e}else{if(/^(sw)$/.test(m)){n.size.width=h.width+f;n.size.height=h.height+e;n.position.left=i.left-f}else{n.size.width=h.width+f;n.size.height=h.height+e;n.position.top=i.top-e;n.position.left=i.left-f}}}}});var b=function(d){return parseInt(d,10)||0};var a=function(d){return !isNaN(parseInt(d,10))}})(jQuery);;
+/**
+ * jQuery.ScrollTo - Easy element scrolling using jQuery.
+ * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com
+ * Licensed under GPL license (http://www.opensource.org/licenses/gpl-license.php).
+ * Date: 2/8/2008
+ * @author Ariel Flesler
+ * @version 1.3.2
+ */
+;(function($){var o=$.scrollTo=function(a,b,c){o.window().scrollTo(a,b,c)};o.defaults={axis:'y',duration:1};o.window=function(){return $($.browser.safari?'body':'html')};$.fn.scrollTo=function(l,m,n){if(typeof m=='object'){n=m;m=0}n=$.extend({},o.defaults,n);m=m||n.speed||n.duration;n.queue=n.queue&&n.axis.length>1;if(n.queue)m/=2;n.offset=j(n.offset);n.over=j(n.over);return this.each(function(){var a=this,b=$(a),t=l,c,d={},w=b.is('html,body');switch(typeof t){case'number':case'string':if(/^([+-]=)?\d+(px)?$/.test(t)){t=j(t);break}t=$(t,this);case'object':if(t.is||t.style)c=(t=$(t)).offset()}$.each(n.axis.split(''),function(i,f){var P=f=='x'?'Left':'Top',p=P.toLowerCase(),k='scroll'+P,e=a[k],D=f=='x'?'Width':'Height';if(c){d[k]=c[p]+(w?0:e-b.offset()[p]);if(n.margin){d[k]-=parseInt(t.css('margin'+P))||0;d[k]-=parseInt(t.css('border'+P+'Width'))||0}d[k]+=n.offset[p]||0;if(n.over[p])d[k]+=t[D.toLowerCase()]()*n.over[p]}else d[k]=t[p];if(/^\d+$/.test(d[k]))d[k]=d[k]<=0?0:Math.min(d[k],h(D));if(!i&&n.queue){if(e!=d[k])g(n.onAfterFirst);delete d[k]}});g(n.onAfter);function g(a){b.animate(d,m,n.easing,a&&function(){a.call(this,l)})};function h(D){var b=w?$.browser.opera?document.body:document.documentElement:a;return b['scroll'+D]-b['client'+D]}})};function j(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
+
diff --git a/doc/html/modules.html b/doc/html/modules.html
new file mode 100644
index 0000000..ecf0251
--- /dev/null
+++ b/doc/html/modules.html
@@ -0,0 +1,79 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>TurboJPEG: Modules</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="search/search.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
+<!-- Generated by Doxygen 1.7.4 -->
+<script type="text/javascript"><!--
+var searchBox = new SearchBox("searchBox", "search",false,'Search');
+--></script>
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">TurboJPEG <span id="projectnumber">1.2</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li class="current"><a href="modules.html"><span>Modules</span></a></li>
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li id="searchli">
+ <div id="MSearchBox" class="MSearchBoxInactive">
+ <span class="left">
+ <img id="MSearchSelect" src="search/mag_sel.png"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ alt=""/>
+ <input type="text" id="MSearchField" value="Search" accesskey="S"
+ onfocus="searchBox.OnSearchFieldFocus(true)"
+ onblur="searchBox.OnSearchFieldFocus(false)"
+ onkeyup="searchBox.OnSearchFieldChange(event)"/>
+ </span><span class="right">
+ <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
+ </span>
+ </div>
+ </li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="headertitle">
+<div class="title">Modules</div> </div>
+</div>
+<div class="contents">
+<div class="textblock">Here is a list of all modules:</div><ul>
+<li><a class="el" href="group___turbo_j_p_e_g.html">TurboJPEG</a></li>
+</ul>
+</div>
+<!-- window showing the filter options -->
+<div id="MSearchSelectWindow"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ onkeydown="return searchBox.OnSearchSelectKey(event)">
+<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Variables</a></div>
+
+<!-- iframe showing the search results (closed by default) -->
+<div id="MSearchResultsWindow">
+<iframe src="javascript:void(0)" frameborder="0"
+ name="MSearchResults" id="MSearchResults">
+</iframe>
+</div>
+
+<hr class="footer"/><address class="footer"><small>Generated on Tue Sep 20 2011 13:18:32 for TurboJPEG by 
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/doc/html/nav_f.png b/doc/html/nav_f.png
new file mode 100644
index 0000000..1b07a16
--- /dev/null
+++ b/doc/html/nav_f.png
Binary files differ
diff --git a/doc/html/nav_h.png b/doc/html/nav_h.png
new file mode 100644
index 0000000..01f5fa6
--- /dev/null
+++ b/doc/html/nav_h.png
Binary files differ
diff --git a/doc/html/open.png b/doc/html/open.png
new file mode 100644
index 0000000..7b35d2c
--- /dev/null
+++ b/doc/html/open.png
Binary files differ
diff --git a/doc/html/search/all_63.html b/doc/html/search/all_63.html
new file mode 100644
index 0000000..8cfc38f
--- /dev/null
+++ b/doc/html/search/all_63.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_customfilter">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjtransform.html#a43ee1bcdd2a8d7249a756774f78793c1" target="_parent">customFilter</a>
+ <span class="SRScope">tjtransform</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/all_64.html b/doc/html/search/all_64.html
new file mode 100644
index 0000000..2e53b02
--- /dev/null
+++ b/doc/html/search/all_64.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_data">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjtransform.html#a688fe8f1a8ecc12a538d9e561cf338e3" target="_parent">data</a>
+ <span class="SRScope">tjtransform</span>
+ </div>
+</div>
+<div class="SRResult" id="SR_denom">
+ <div class="SREntry">
+ <a id="Item1" onkeydown="return searchResults.Nav(event,1)" onkeypress="return searchResults.Nav(event,1)" onkeyup="return searchResults.Nav(event,1)" class="SRSymbol" href="../structtjscalingfactor.html#aefbcdf3e9e62274b2d312c695f133ce3" target="_parent">denom</a>
+ <span class="SRScope">tjscalingfactor</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/all_68.html b/doc/html/search/all_68.html
new file mode 100644
index 0000000..ccb671d
--- /dev/null
+++ b/doc/html/search/all_68.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_h">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjregion.html#aecefc45a26f4d8b60dd4d825c1710115" target="_parent">h</a>
+ <span class="SRScope">tjregion</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/all_6e.html b/doc/html/search/all_6e.html
new file mode 100644
index 0000000..b9f5b05
--- /dev/null
+++ b/doc/html/search/all_6e.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_num">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjscalingfactor.html#a9b011e57f981ee23083e2c1aa5e640ec" target="_parent">num</a>
+ <span class="SRScope">tjscalingfactor</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/all_6f.html b/doc/html/search/all_6f.html
new file mode 100644
index 0000000..d95bbef
--- /dev/null
+++ b/doc/html/search/all_6f.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_op">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjtransform.html#a2525aab4ba6978a1c273f74fef50e498" target="_parent">op</a>
+ <span class="SRScope">tjtransform</span>
+ </div>
+</div>
+<div class="SRResult" id="SR_options">
+ <div class="SREntry">
+ <a id="Item1" onkeydown="return searchResults.Nav(event,1)" onkeypress="return searchResults.Nav(event,1)" onkeyup="return searchResults.Nav(event,1)" class="SRSymbol" href="../structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6" target="_parent">options</a>
+ <span class="SRScope">tjtransform</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/all_72.html b/doc/html/search/all_72.html
new file mode 100644
index 0000000..465fe88
--- /dev/null
+++ b/doc/html/search/all_72.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_r">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjtransform.html#ac324e5e442abec8a961e5bf219db12cf" target="_parent">r</a>
+ <span class="SRScope">tjtransform</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/all_74.html b/doc/html/search/all_74.html
new file mode 100644
index 0000000..fd77663
--- /dev/null
+++ b/doc/html/search/all_74.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_tjregion">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjregion.html" target="_parent">tjregion</a>
+ </div>
+</div>
+<div class="SRResult" id="SR_tjscalingfactor">
+ <div class="SREntry">
+ <a id="Item1" onkeydown="return searchResults.Nav(event,1)" onkeypress="return searchResults.Nav(event,1)" onkeyup="return searchResults.Nav(event,1)" class="SRSymbol" href="../structtjscalingfactor.html" target="_parent">tjscalingfactor</a>
+ </div>
+</div>
+<div class="SRResult" id="SR_tjtransform">
+ <div class="SREntry">
+ <a id="Item2" onkeydown="return searchResults.Nav(event,2)" onkeypress="return searchResults.Nav(event,2)" onkeyup="return searchResults.Nav(event,2)" class="SRSymbol" href="../structtjtransform.html" target="_parent">tjtransform</a>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/all_77.html b/doc/html/search/all_77.html
new file mode 100644
index 0000000..b4c8d88
--- /dev/null
+++ b/doc/html/search/all_77.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_w">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjregion.html#ab6eb73ceef584fc23c8c8097926dce42" target="_parent">w</a>
+ <span class="SRScope">tjregion</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/all_78.html b/doc/html/search/all_78.html
new file mode 100644
index 0000000..a357691
--- /dev/null
+++ b/doc/html/search/all_78.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_x">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjregion.html#a4b6a37a93997091b26a75831fa291ad9" target="_parent">x</a>
+ <span class="SRScope">tjregion</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/all_79.html b/doc/html/search/all_79.html
new file mode 100644
index 0000000..a883bd1
--- /dev/null
+++ b/doc/html/search/all_79.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_y">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjregion.html#a7b3e0c24cfe87acc80e334cafdcf22c2" target="_parent">y</a>
+ <span class="SRScope">tjregion</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/classes_74.html b/doc/html/search/classes_74.html
new file mode 100644
index 0000000..fd77663
--- /dev/null
+++ b/doc/html/search/classes_74.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_tjregion">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjregion.html" target="_parent">tjregion</a>
+ </div>
+</div>
+<div class="SRResult" id="SR_tjscalingfactor">
+ <div class="SREntry">
+ <a id="Item1" onkeydown="return searchResults.Nav(event,1)" onkeypress="return searchResults.Nav(event,1)" onkeyup="return searchResults.Nav(event,1)" class="SRSymbol" href="../structtjscalingfactor.html" target="_parent">tjscalingfactor</a>
+ </div>
+</div>
+<div class="SRResult" id="SR_tjtransform">
+ <div class="SREntry">
+ <a id="Item2" onkeydown="return searchResults.Nav(event,2)" onkeypress="return searchResults.Nav(event,2)" onkeyup="return searchResults.Nav(event,2)" class="SRSymbol" href="../structtjtransform.html" target="_parent">tjtransform</a>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/close.png b/doc/html/search/close.png
new file mode 100644
index 0000000..9342d3d
--- /dev/null
+++ b/doc/html/search/close.png
Binary files differ
diff --git a/doc/html/search/mag_sel.png b/doc/html/search/mag_sel.png
new file mode 100644
index 0000000..81f6040
--- /dev/null
+++ b/doc/html/search/mag_sel.png
Binary files differ
diff --git a/doc/html/search/nomatches.html b/doc/html/search/nomatches.html
new file mode 100644
index 0000000..b1ded27
--- /dev/null
+++ b/doc/html/search/nomatches.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="NoMatches">No Matches</div>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/search.css b/doc/html/search/search.css
new file mode 100644
index 0000000..50249e5
--- /dev/null
+++ b/doc/html/search/search.css
@@ -0,0 +1,240 @@
+/*---------------- Search Box */
+
+#FSearchBox {
+ float: left;
+}
+
+#searchli {
+ float: right;
+ display: block;
+ width: 170px;
+ height: 36px;
+}
+
+#MSearchBox {
+ white-space : nowrap;
+ position: absolute;
+ float: none;
+ display: inline;
+ margin-top: 8px;
+ right: 0px;
+ width: 170px;
+ z-index: 102;
+}
+
+#MSearchBox .left
+{
+ display:block;
+ position:absolute;
+ left:10px;
+ width:20px;
+ height:19px;
+ background:url('search_l.png') no-repeat;
+ background-position:right;
+}
+
+#MSearchSelect {
+ display:block;
+ position:absolute;
+ width:20px;
+ height:19px;
+}
+
+.left #MSearchSelect {
+ left:4px;
+}
+
+.right #MSearchSelect {
+ right:5px;
+}
+
+#MSearchField {
+ display:block;
+ position:absolute;
+ height:19px;
+ background:url('search_m.png') repeat-x;
+ border:none;
+ width:116px;
+ margin-left:20px;
+ padding-left:4px;
+ color: #909090;
+ outline: none;
+ font: 9pt Arial, Verdana, sans-serif;
+}
+
+#FSearchBox #MSearchField {
+ margin-left:15px;
+}
+
+#MSearchBox .right {
+ display:block;
+ position:absolute;
+ right:10px;
+ top:0px;
+ width:20px;
+ height:19px;
+ background:url('search_r.png') no-repeat;
+ background-position:left;
+}
+
+#MSearchClose {
+ display: none;
+ position: absolute;
+ top: 4px;
+ background : none;
+ border: none;
+ margin: 0px 4px 0px 0px;
+ padding: 0px 0px;
+ outline: none;
+}
+
+.left #MSearchClose {
+ left: 6px;
+}
+
+.right #MSearchClose {
+ right: 2px;
+}
+
+.MSearchBoxActive #MSearchField {
+ color: #000000;
+}
+
+/*---------------- Search filter selection */
+
+#MSearchSelectWindow {
+ display: none;
+ position: absolute;
+ left: 0; top: 0;
+ border: 1px solid #90A5CE;
+ background-color: #F9FAFC;
+ z-index: 1;
+ padding-top: 4px;
+ padding-bottom: 4px;
+ -moz-border-radius: 4px;
+ -webkit-border-top-left-radius: 4px;
+ -webkit-border-top-right-radius: 4px;
+ -webkit-border-bottom-left-radius: 4px;
+ -webkit-border-bottom-right-radius: 4px;
+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);
+}
+
+.SelectItem {
+ font: 8pt Arial, Verdana, sans-serif;
+ padding-left: 2px;
+ padding-right: 12px;
+ border: 0px;
+}
+
+span.SelectionMark {
+ margin-right: 4px;
+ font-family: monospace;
+ outline-style: none;
+ text-decoration: none;
+}
+
+a.SelectItem {
+ display: block;
+ outline-style: none;
+ color: #000000;
+ text-decoration: none;
+ padding-left: 6px;
+ padding-right: 12px;
+}
+
+a.SelectItem:focus,
+a.SelectItem:active {
+ color: #000000;
+ outline-style: none;
+ text-decoration: none;
+}
+
+a.SelectItem:hover {
+ color: #FFFFFF;
+ background-color: #3D578C;
+ outline-style: none;
+ text-decoration: none;
+ cursor: pointer;
+ display: block;
+}
+
+/*---------------- Search results window */
+
+iframe#MSearchResults {
+ width: 60ex;
+ height: 15em;
+}
+
+#MSearchResultsWindow {
+ display: none;
+ position: absolute;
+ left: 0; top: 0;
+ border: 1px solid #000;
+ background-color: #EEF1F7;
+}
+
+/* ----------------------------------- */
+
+
+#SRIndex {
+ clear:both;
+ padding-bottom: 15px;
+}
+
+.SREntry {
+ font-size: 10pt;
+ padding-left: 1ex;
+}
+
+.SRPage .SREntry {
+ font-size: 8pt;
+ padding: 1px 5px;
+}
+
+body.SRPage {
+ margin: 5px 2px;
+}
+
+.SRChildren {
+ padding-left: 3ex; padding-bottom: .5em
+}
+
+.SRPage .SRChildren {
+ display: none;
+}
+
+.SRSymbol {
+ font-weight: bold;
+ color: #425E97;
+ font-family: Arial, Verdana, sans-serif;
+ text-decoration: none;
+ outline: none;
+}
+
+a.SRScope {
+ display: block;
+ color: #425E97;
+ font-family: Arial, Verdana, sans-serif;
+ text-decoration: none;
+ outline: none;
+}
+
+a.SRSymbol:focus, a.SRSymbol:active,
+a.SRScope:focus, a.SRScope:active {
+ text-decoration: underline;
+}
+
+.SRPage .SRStatus {
+ padding: 2px 5px;
+ font-size: 8pt;
+ font-style: italic;
+}
+
+.SRResult {
+ display: none;
+}
+
+DIV.searchresults {
+ margin-left: 10px;
+ margin-right: 10px;
+}
diff --git a/doc/html/search/search.js b/doc/html/search/search.js
new file mode 100644
index 0000000..0a9c356
--- /dev/null
+++ b/doc/html/search/search.js
@@ -0,0 +1,730 @@
+// Search script generated by doxygen
+// Copyright (C) 2009 by Dimitri van Heesch.
+
+// The code in this file is loosly based on main.js, part of Natural Docs,
+// which is Copyright (C) 2003-2008 Greg Valure
+// Natural Docs is licensed under the GPL.
+
+var indexSectionsWithContent =
+{
+ 0: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100010000011001010011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 1: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ 2: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001100010000011001000011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
+};
+
+var indexSectionNames =
+{
+ 0: "all",
+ 1: "classes",
+ 2: "variables"
+};
+
+function convertToId(search)
+{
+ var result = '';
+ for (i=0;i<search.length;i++)
+ {
+ var c = search.charAt(i);
+ var cn = c.charCodeAt(0);
+ if (c.match(/[a-z0-9]/))
+ {
+ result+=c;
+ }
+ else if (cn<16)
+ {
+ result+="_0"+cn.toString(16);
+ }
+ else
+ {
+ result+="_"+cn.toString(16);
+ }
+ }
+ return result;
+}
+
+function getXPos(item)
+{
+ var x = 0;
+ if (item.offsetWidth)
+ {
+ while (item && item!=document.body)
+ {
+ x += item.offsetLeft;
+ item = item.offsetParent;
+ }
+ }
+ return x;
+}
+
+function getYPos(item)
+{
+ var y = 0;
+ if (item.offsetWidth)
+ {
+ while (item && item!=document.body)
+ {
+ y += item.offsetTop;
+ item = item.offsetParent;
+ }
+ }
+ return y;
+}
+
+/* A class handling everything associated with the search panel.
+
+ Parameters:
+ name - The name of the global variable that will be
+ storing this instance. Is needed to be able to set timeouts.
+ resultPath - path to use for external files
+*/
+function SearchBox(name, resultsPath, inFrame, label)
+{
+ if (!name || !resultsPath) { alert("Missing parameters to SearchBox."); }
+
+ // ---------- Instance variables
+ this.name = name;
+ this.resultsPath = resultsPath;
+ this.keyTimeout = 0;
+ this.keyTimeoutLength = 500;
+ this.closeSelectionTimeout = 300;
+ this.lastSearchValue = "";
+ this.lastResultsPage = "";
+ this.hideTimeout = 0;
+ this.searchIndex = 0;
+ this.searchActive = false;
+ this.insideFrame = inFrame;
+ this.searchLabel = label;
+
+ // ----------- DOM Elements
+
+ this.DOMSearchField = function()
+ { return document.getElementById("MSearchField"); }
+
+ this.DOMSearchSelect = function()
+ { return document.getElementById("MSearchSelect"); }
+
+ this.DOMSearchSelectWindow = function()
+ { return document.getElementById("MSearchSelectWindow"); }
+
+ this.DOMPopupSearchResults = function()
+ { return document.getElementById("MSearchResults"); }
+
+ this.DOMPopupSearchResultsWindow = function()
+ { return document.getElementById("MSearchResultsWindow"); }
+
+ this.DOMSearchClose = function()
+ { return document.getElementById("MSearchClose"); }
+
+ this.DOMSearchBox = function()
+ { return document.getElementById("MSearchBox"); }
+
+ // ------------ Event Handlers
+
+ // Called when focus is added or removed from the search field.
+ this.OnSearchFieldFocus = function(isActive)
+ {
+ this.Activate(isActive);
+ }
+
+ this.OnSearchSelectShow = function()
+ {
+ var searchSelectWindow = this.DOMSearchSelectWindow();
+ var searchField = this.DOMSearchSelect();
+
+ if (this.insideFrame)
+ {
+ var left = getXPos(searchField);
+ var top = getYPos(searchField);
+ left += searchField.offsetWidth + 6;
+ top += searchField.offsetHeight;
+
+ // show search selection popup
+ searchSelectWindow.style.display='block';
+ left -= searchSelectWindow.offsetWidth;
+ searchSelectWindow.style.left = left + 'px';
+ searchSelectWindow.style.top = top + 'px';
+ }
+ else
+ {
+ var left = getXPos(searchField);
+ var top = getYPos(searchField);
+ top += searchField.offsetHeight;
+
+ // show search selection popup
+ searchSelectWindow.style.display='block';
+ searchSelectWindow.style.left = left + 'px';
+ searchSelectWindow.style.top = top + 'px';
+ }
+
+ // stop selection hide timer
+ if (this.hideTimeout)
+ {
+ clearTimeout(this.hideTimeout);
+ this.hideTimeout=0;
+ }
+ return false; // to avoid "image drag" default event
+ }
+
+ this.OnSearchSelectHide = function()
+ {
+ this.hideTimeout = setTimeout(this.name +".CloseSelectionWindow()",
+ this.closeSelectionTimeout);
+ }
+
+ // Called when the content of the search field is changed.
+ this.OnSearchFieldChange = function(evt)
+ {
+ if (this.keyTimeout) // kill running timer
+ {
+ clearTimeout(this.keyTimeout);
+ this.keyTimeout = 0;
+ }
+
+ var e = (evt) ? evt : window.event; // for IE
+ if (e.keyCode==40 || e.keyCode==13)
+ {
+ if (e.shiftKey==1)
+ {
+ this.OnSearchSelectShow();
+ var win=this.DOMSearchSelectWindow();
+ for (i=0;i<win.childNodes.length;i++)
+ {
+ var child = win.childNodes[i]; // get span within a
+ if (child.className=='SelectItem')
+ {
+ child.focus();
+ return;
+ }
+ }
+ return;
+ }
+ else if (window.frames.MSearchResults.searchResults)
+ {
+ var elem = window.frames.MSearchResults.searchResults.NavNext(0);
+ if (elem) elem.focus();
+ }
+ }
+ else if (e.keyCode==27) // Escape out of the search field
+ {
+ this.DOMSearchField().blur();
+ this.DOMPopupSearchResultsWindow().style.display = 'none';
+ this.DOMSearchClose().style.display = 'none';
+ this.lastSearchValue = '';
+ this.Activate(false);
+ return;
+ }
+
+ // strip whitespaces
+ var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
+
+ if (searchValue != this.lastSearchValue) // search value has changed
+ {
+ if (searchValue != "") // non-empty search
+ {
+ // set timer for search update
+ this.keyTimeout = setTimeout(this.name + '.Search()',
+ this.keyTimeoutLength);
+ }
+ else // empty search field
+ {
+ this.DOMPopupSearchResultsWindow().style.display = 'none';
+ this.DOMSearchClose().style.display = 'none';
+ this.lastSearchValue = '';
+ }
+ }
+ }
+
+ this.SelectItemCount = function(id)
+ {
+ var count=0;
+ var win=this.DOMSearchSelectWindow();
+ for (i=0;i<win.childNodes.length;i++)
+ {
+ var child = win.childNodes[i]; // get span within a
+ if (child.className=='SelectItem')
+ {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ this.SelectItemSet = function(id)
+ {
+ var i,j=0;
+ var win=this.DOMSearchSelectWindow();
+ for (i=0;i<win.childNodes.length;i++)
+ {
+ var child = win.childNodes[i]; // get span within a
+ if (child.className=='SelectItem')
+ {
+ var node = child.firstChild;
+ if (j==id)
+ {
+ node.innerHTML='•';
+ }
+ else
+ {
+ node.innerHTML=' ';
+ }
+ j++;
+ }
+ }
+ }
+
+ // Called when an search filter selection is made.
+ // set item with index id as the active item
+ this.OnSelectItem = function(id)
+ {
+ this.searchIndex = id;
+ this.SelectItemSet(id);
+ var searchValue = this.DOMSearchField().value.replace(/ +/g, "");
+ if (searchValue!="" && this.searchActive) // something was found -> do a search
+ {
+ this.Search();
+ }
+ }
+
+ this.OnSearchSelectKey = function(evt)
+ {
+ var e = (evt) ? evt : window.event; // for IE
+ if (e.keyCode==40 && this.searchIndex<this.SelectItemCount()) // Down
+ {
+ this.searchIndex++;
+ this.OnSelectItem(this.searchIndex);
+ }
+ else if (e.keyCode==38 && this.searchIndex>0) // Up
+ {
+ this.searchIndex--;
+ this.OnSelectItem(this.searchIndex);
+ }
+ else if (e.keyCode==13 || e.keyCode==27)
+ {
+ this.OnSelectItem(this.searchIndex);
+ this.CloseSelectionWindow();
+ this.DOMSearchField().focus();
+ }
+ return false;
+ }
+
+ // --------- Actions
+
+ // Closes the results window.
+ this.CloseResultsWindow = function()
+ {
+ this.DOMPopupSearchResultsWindow().style.display = 'none';
+ this.DOMSearchClose().style.display = 'none';
+ this.Activate(false);
+ }
+
+ this.CloseSelectionWindow = function()
+ {
+ this.DOMSearchSelectWindow().style.display = 'none';
+ }
+
+ // Performs a search.
+ this.Search = function()
+ {
+ this.keyTimeout = 0;
+
+ // strip leading whitespace
+ var searchValue = this.DOMSearchField().value.replace(/^ +/, "");
+
+ var code = searchValue.toLowerCase().charCodeAt(0);
+ var hexCode;
+ if (code<16)
+ {
+ hexCode="0"+code.toString(16);
+ }
+ else
+ {
+ hexCode=code.toString(16);
+ }
+
+ var resultsPage;
+ var resultsPageWithSearch;
+ var hasResultsPage;
+
+ if (indexSectionsWithContent[this.searchIndex].charAt(code) == '1')
+ {
+ resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + '.html';
+ resultsPageWithSearch = resultsPage+'?'+escape(searchValue);
+ hasResultsPage = true;
+ }
+ else // nothing available for this search term
+ {
+ resultsPage = this.resultsPath + '/nomatches.html';
+ resultsPageWithSearch = resultsPage;
+ hasResultsPage = false;
+ }
+
+ window.frames.MSearchResults.location.href = resultsPageWithSearch;
+ var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow();
+
+ if (domPopupSearchResultsWindow.style.display!='block')
+ {
+ var domSearchBox = this.DOMSearchBox();
+ this.DOMSearchClose().style.display = 'inline';
+ if (this.insideFrame)
+ {
+ var domPopupSearchResults = this.DOMPopupSearchResults();
+ domPopupSearchResultsWindow.style.position = 'relative';
+ domPopupSearchResultsWindow.style.display = 'block';
+ var width = document.body.clientWidth - 8; // the -8 is for IE :-(
+ domPopupSearchResultsWindow.style.width = width + 'px';
+ domPopupSearchResults.style.width = width + 'px';
+ }
+ else
+ {
+ var domPopupSearchResults = this.DOMPopupSearchResults();
+ var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth;
+ var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1;
+ domPopupSearchResultsWindow.style.display = 'block';
+ left -= domPopupSearchResults.offsetWidth;
+ domPopupSearchResultsWindow.style.top = top + 'px';
+ domPopupSearchResultsWindow.style.left = left + 'px';
+ }
+ }
+
+ this.lastSearchValue = searchValue;
+ this.lastResultsPage = resultsPage;
+ }
+
+ // -------- Activation Functions
+
+ // Activates or deactivates the search panel, resetting things to
+ // their default values if necessary.
+ this.Activate = function(isActive)
+ {
+ if (isActive || // open it
+ this.DOMPopupSearchResultsWindow().style.display == 'block'
+ )
+ {
+ this.DOMSearchBox().className = 'MSearchBoxActive';
+
+ var searchField = this.DOMSearchField();
+
+ if (searchField.value == this.searchLabel) // clear "Search" term upon entry
+ {
+ searchField.value = '';
+ this.searchActive = true;
+ }
+ }
+ else if (!isActive) // directly remove the panel
+ {
+ this.DOMSearchBox().className = 'MSearchBoxInactive';
+ this.DOMSearchField().value = this.searchLabel;
+ this.searchActive = false;
+ this.lastSearchValue = ''
+ this.lastResultsPage = '';
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+// The class that handles everything on the search results page.
+function SearchResults(name)
+{
+ // The number of matches from the last run of <Search()>.
+ this.lastMatchCount = 0;
+ this.lastKey = 0;
+ this.repeatOn = false;
+
+ // Toggles the visibility of the passed element ID.
+ this.FindChildElement = function(id)
+ {
+ var parentElement = document.getElementById(id);
+ var element = parentElement.firstChild;
+
+ while (element && element!=parentElement)
+ {
+ if (element.nodeName == 'DIV' && element.className == 'SRChildren')
+ {
+ return element;
+ }
+
+ if (element.nodeName == 'DIV' && element.hasChildNodes())
+ {
+ element = element.firstChild;
+ }
+ else if (element.nextSibling)
+ {
+ element = element.nextSibling;
+ }
+ else
+ {
+ do
+ {
+ element = element.parentNode;
+ }
+ while (element && element!=parentElement && !element.nextSibling);
+
+ if (element && element!=parentElement)
+ {
+ element = element.nextSibling;
+ }
+ }
+ }
+ }
+
+ this.Toggle = function(id)
+ {
+ var element = this.FindChildElement(id);
+ if (element)
+ {
+ if (element.style.display == 'block')
+ {
+ element.style.display = 'none';
+ }
+ else
+ {
+ element.style.display = 'block';
+ }
+ }
+ }
+
+ // Searches for the passed string. If there is no parameter,
+ // it takes it from the URL query.
+ //
+ // Always returns true, since other documents may try to call it
+ // and that may or may not be possible.
+ this.Search = function(search)
+ {
+ if (!search) // get search word from URL
+ {
+ search = window.location.search;
+ search = search.substring(1); // Remove the leading '?'
+ search = unescape(search);
+ }
+
+ search = search.replace(/^ +/, ""); // strip leading spaces
+ search = search.replace(/ +$/, ""); // strip trailing spaces
+ search = search.toLowerCase();
+ search = convertToId(search);
+
+ var resultRows = document.getElementsByTagName("div");
+ var matches = 0;
+
+ var i = 0;
+ while (i < resultRows.length)
+ {
+ var row = resultRows.item(i);
+ if (row.className == "SRResult")
+ {
+ var rowMatchName = row.id.toLowerCase();
+ rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_'
+
+ if (search.length<=rowMatchName.length &&
+ rowMatchName.substr(0, search.length)==search)
+ {
+ row.style.display = 'block';
+ matches++;
+ }
+ else
+ {
+ row.style.display = 'none';
+ }
+ }
+ i++;
+ }
+ document.getElementById("Searching").style.display='none';
+ if (matches == 0) // no results
+ {
+ document.getElementById("NoMatches").style.display='block';
+ }
+ else // at least one result
+ {
+ document.getElementById("NoMatches").style.display='none';
+ }
+ this.lastMatchCount = matches;
+ return true;
+ }
+
+ // return the first item with index index or higher that is visible
+ this.NavNext = function(index)
+ {
+ var focusItem;
+ while (1)
+ {
+ var focusName = 'Item'+index;
+ focusItem = document.getElementById(focusName);
+ if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
+ {
+ break;
+ }
+ else if (!focusItem) // last element
+ {
+ break;
+ }
+ focusItem=null;
+ index++;
+ }
+ return focusItem;
+ }
+
+ this.NavPrev = function(index)
+ {
+ var focusItem;
+ while (1)
+ {
+ var focusName = 'Item'+index;
+ focusItem = document.getElementById(focusName);
+ if (focusItem && focusItem.parentNode.parentNode.style.display=='block')
+ {
+ break;
+ }
+ else if (!focusItem) // last element
+ {
+ break;
+ }
+ focusItem=null;
+ index--;
+ }
+ return focusItem;
+ }
+
+ this.ProcessKeys = function(e)
+ {
+ if (e.type == "keydown")
+ {
+ this.repeatOn = false;
+ this.lastKey = e.keyCode;
+ }
+ else if (e.type == "keypress")
+ {
+ if (!this.repeatOn)
+ {
+ if (this.lastKey) this.repeatOn = true;
+ return false; // ignore first keypress after keydown
+ }
+ }
+ else if (e.type == "keyup")
+ {
+ this.lastKey = 0;
+ this.repeatOn = false;
+ }
+ return this.lastKey!=0;
+ }
+
+ this.Nav = function(evt,itemIndex)
+ {
+ var e = (evt) ? evt : window.event; // for IE
+ if (e.keyCode==13) return true;
+ if (!this.ProcessKeys(e)) return false;
+
+ if (this.lastKey==38) // Up
+ {
+ var newIndex = itemIndex-1;
+ var focusItem = this.NavPrev(newIndex);
+ if (focusItem)
+ {
+ var child = this.FindChildElement(focusItem.parentNode.parentNode.id);
+ if (child && child.style.display == 'block') // children visible
+ {
+ var n=0;
+ var tmpElem;
+ while (1) // search for last child
+ {
+ tmpElem = document.getElementById('Item'+newIndex+'_c'+n);
+ if (tmpElem)
+ {
+ focusItem = tmpElem;
+ }
+ else // found it!
+ {
+ break;
+ }
+ n++;
+ }
+ }
+ }
+ if (focusItem)
+ {
+ focusItem.focus();
+ }
+ else // return focus to search field
+ {
+ parent.document.getElementById("MSearchField").focus();
+ }
+ }
+ else if (this.lastKey==40) // Down
+ {
+ var newIndex = itemIndex+1;
+ var focusItem;
+ var item = document.getElementById('Item'+itemIndex);
+ var elem = this.FindChildElement(item.parentNode.parentNode.id);
+ if (elem && elem.style.display == 'block') // children visible
+ {
+ focusItem = document.getElementById('Item'+itemIndex+'_c0');
+ }
+ if (!focusItem) focusItem = this.NavNext(newIndex);
+ if (focusItem) focusItem.focus();
+ }
+ else if (this.lastKey==39) // Right
+ {
+ var item = document.getElementById('Item'+itemIndex);
+ var elem = this.FindChildElement(item.parentNode.parentNode.id);
+ if (elem) elem.style.display = 'block';
+ }
+ else if (this.lastKey==37) // Left
+ {
+ var item = document.getElementById('Item'+itemIndex);
+ var elem = this.FindChildElement(item.parentNode.parentNode.id);
+ if (elem) elem.style.display = 'none';
+ }
+ else if (this.lastKey==27) // Escape
+ {
+ parent.searchBox.CloseResultsWindow();
+ parent.document.getElementById("MSearchField").focus();
+ }
+ else if (this.lastKey==13) // Enter
+ {
+ return true;
+ }
+ return false;
+ }
+
+ this.NavChild = function(evt,itemIndex,childIndex)
+ {
+ var e = (evt) ? evt : window.event; // for IE
+ if (e.keyCode==13) return true;
+ if (!this.ProcessKeys(e)) return false;
+
+ if (this.lastKey==38) // Up
+ {
+ if (childIndex>0)
+ {
+ var newIndex = childIndex-1;
+ document.getElementById('Item'+itemIndex+'_c'+newIndex).focus();
+ }
+ else // already at first child, jump to parent
+ {
+ document.getElementById('Item'+itemIndex).focus();
+ }
+ }
+ else if (this.lastKey==40) // Down
+ {
+ var newIndex = childIndex+1;
+ var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex);
+ if (!elem) // last child, jump to parent next parent
+ {
+ elem = this.NavNext(itemIndex+1);
+ }
+ if (elem)
+ {
+ elem.focus();
+ }
+ }
+ else if (this.lastKey==27) // Escape
+ {
+ parent.searchBox.CloseResultsWindow();
+ parent.document.getElementById("MSearchField").focus();
+ }
+ else if (this.lastKey==13) // Enter
+ {
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/doc/html/search/search_l.png b/doc/html/search/search_l.png
new file mode 100644
index 0000000..c872f4d
--- /dev/null
+++ b/doc/html/search/search_l.png
Binary files differ
diff --git a/doc/html/search/search_m.png b/doc/html/search/search_m.png
new file mode 100644
index 0000000..b429a16
--- /dev/null
+++ b/doc/html/search/search_m.png
Binary files differ
diff --git a/doc/html/search/search_r.png b/doc/html/search/search_r.png
new file mode 100644
index 0000000..97ee8b4
--- /dev/null
+++ b/doc/html/search/search_r.png
Binary files differ
diff --git a/doc/html/search/variables_63.html b/doc/html/search/variables_63.html
new file mode 100644
index 0000000..8cfc38f
--- /dev/null
+++ b/doc/html/search/variables_63.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_customfilter">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjtransform.html#a43ee1bcdd2a8d7249a756774f78793c1" target="_parent">customFilter</a>
+ <span class="SRScope">tjtransform</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/variables_64.html b/doc/html/search/variables_64.html
new file mode 100644
index 0000000..2e53b02
--- /dev/null
+++ b/doc/html/search/variables_64.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_data">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjtransform.html#a688fe8f1a8ecc12a538d9e561cf338e3" target="_parent">data</a>
+ <span class="SRScope">tjtransform</span>
+ </div>
+</div>
+<div class="SRResult" id="SR_denom">
+ <div class="SREntry">
+ <a id="Item1" onkeydown="return searchResults.Nav(event,1)" onkeypress="return searchResults.Nav(event,1)" onkeyup="return searchResults.Nav(event,1)" class="SRSymbol" href="../structtjscalingfactor.html#aefbcdf3e9e62274b2d312c695f133ce3" target="_parent">denom</a>
+ <span class="SRScope">tjscalingfactor</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/variables_68.html b/doc/html/search/variables_68.html
new file mode 100644
index 0000000..ccb671d
--- /dev/null
+++ b/doc/html/search/variables_68.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_h">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjregion.html#aecefc45a26f4d8b60dd4d825c1710115" target="_parent">h</a>
+ <span class="SRScope">tjregion</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/variables_6e.html b/doc/html/search/variables_6e.html
new file mode 100644
index 0000000..b9f5b05
--- /dev/null
+++ b/doc/html/search/variables_6e.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_num">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjscalingfactor.html#a9b011e57f981ee23083e2c1aa5e640ec" target="_parent">num</a>
+ <span class="SRScope">tjscalingfactor</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/variables_6f.html b/doc/html/search/variables_6f.html
new file mode 100644
index 0000000..d95bbef
--- /dev/null
+++ b/doc/html/search/variables_6f.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_op">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjtransform.html#a2525aab4ba6978a1c273f74fef50e498" target="_parent">op</a>
+ <span class="SRScope">tjtransform</span>
+ </div>
+</div>
+<div class="SRResult" id="SR_options">
+ <div class="SREntry">
+ <a id="Item1" onkeydown="return searchResults.Nav(event,1)" onkeypress="return searchResults.Nav(event,1)" onkeyup="return searchResults.Nav(event,1)" class="SRSymbol" href="../structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6" target="_parent">options</a>
+ <span class="SRScope">tjtransform</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/variables_72.html b/doc/html/search/variables_72.html
new file mode 100644
index 0000000..465fe88
--- /dev/null
+++ b/doc/html/search/variables_72.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_r">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjtransform.html#ac324e5e442abec8a961e5bf219db12cf" target="_parent">r</a>
+ <span class="SRScope">tjtransform</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/variables_77.html b/doc/html/search/variables_77.html
new file mode 100644
index 0000000..b4c8d88
--- /dev/null
+++ b/doc/html/search/variables_77.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_w">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjregion.html#ab6eb73ceef584fc23c8c8097926dce42" target="_parent">w</a>
+ <span class="SRScope">tjregion</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/variables_78.html b/doc/html/search/variables_78.html
new file mode 100644
index 0000000..a357691
--- /dev/null
+++ b/doc/html/search/variables_78.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_x">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjregion.html#a4b6a37a93997091b26a75831fa291ad9" target="_parent">x</a>
+ <span class="SRScope">tjregion</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/search/variables_79.html b/doc/html/search/variables_79.html
new file mode 100644
index 0000000..a883bd1
--- /dev/null
+++ b/doc/html/search/variables_79.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html><head><title></title>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<link rel="stylesheet" type="text/css" href="search.css"/>
+<script type="text/javascript" src="search.js"></script>
+</head>
+<body class="SRPage">
+<div id="SRIndex">
+<div class="SRStatus" id="Loading">Loading...</div>
+<div class="SRResult" id="SR_y">
+ <div class="SREntry">
+ <a id="Item0" onkeydown="return searchResults.Nav(event,0)" onkeypress="return searchResults.Nav(event,0)" onkeyup="return searchResults.Nav(event,0)" class="SRSymbol" href="../structtjregion.html#a7b3e0c24cfe87acc80e334cafdcf22c2" target="_parent">y</a>
+ <span class="SRScope">tjregion</span>
+ </div>
+</div>
+<div class="SRStatus" id="Searching">Searching...</div>
+<div class="SRStatus" id="NoMatches">No Matches</div>
+<script type="text/javascript"><!--
+document.getElementById("Loading").style.display="none";
+document.getElementById("NoMatches").style.display="none";
+var searchResults = new SearchResults("searchResults");
+searchResults.Search();
+--></script>
+</div>
+</body>
+</html>
diff --git a/doc/html/structtjregion.html b/doc/html/structtjregion.html
new file mode 100644
index 0000000..904d780
--- /dev/null
+++ b/doc/html/structtjregion.html
@@ -0,0 +1,172 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>TurboJPEG: tjregion Struct Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="search/search.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
+<!-- Generated by Doxygen 1.7.4 -->
+<script type="text/javascript"><!--
+var searchBox = new SearchBox("searchBox", "search",false,'Search');
+--></script>
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">TurboJPEG <span id="projectnumber">1.2</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li id="searchli">
+ <div id="MSearchBox" class="MSearchBoxInactive">
+ <span class="left">
+ <img id="MSearchSelect" src="search/mag_sel.png"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ alt=""/>
+ <input type="text" id="MSearchField" value="Search" accesskey="S"
+ onfocus="searchBox.OnSearchFieldFocus(true)"
+ onblur="searchBox.OnSearchFieldFocus(false)"
+ onkeyup="searchBox.OnSearchFieldChange(event)"/>
+ </span><span class="right">
+ <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
+ </span>
+ </div>
+ </li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="classes.html"><span>Data Structure Index</span></a></li>
+ <li><a href="functions.html"><span>Data Fields</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#pub-attribs">Data Fields</a> </div>
+ <div class="headertitle">
+<div class="title">tjregion Struct Reference<div class="ingroups"><a class="el" href="group___turbo_j_p_e_g.html">TurboJPEG</a></div></div> </div>
+</div>
+<div class="contents">
+<!-- doxytag: class="tjregion" -->
+<p>Cropping region.
+ <a href="structtjregion.html#details">More...</a></p>
+
+<p><code>#include <turbojpeg.h></code></p>
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="pub-attribs"></a>
+Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjregion.html#a4b6a37a93997091b26a75831fa291ad9">x</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">The left boundary of the cropping region. <a href="#a4b6a37a93997091b26a75831fa291ad9"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjregion.html#a7b3e0c24cfe87acc80e334cafdcf22c2">y</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">The upper boundary of the cropping region. <a href="#a7b3e0c24cfe87acc80e334cafdcf22c2"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjregion.html#ab6eb73ceef584fc23c8c8097926dce42">w</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">The width of the cropping region. <a href="#ab6eb73ceef584fc23c8c8097926dce42"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjregion.html#aecefc45a26f4d8b60dd4d825c1710115">h</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">The height of the cropping region. <a href="#aecefc45a26f4d8b60dd4d825c1710115"></a><br/></td></tr>
+</table>
+<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
+<div class="textblock"><p>Cropping region. </p>
+</div><hr/><h2>Field Documentation</h2>
+<a class="anchor" id="aecefc45a26f4d8b60dd4d825c1710115"></a><!-- doxytag: member="tjregion::h" ref="aecefc45a26f4d8b60dd4d825c1710115" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int <a class="el" href="structtjregion.html#aecefc45a26f4d8b60dd4d825c1710115">tjregion::h</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>The height of the cropping region. </p>
+<p>Setting this to 0 is the equivalent of setting it to the height of the source JPEG image - y. </p>
+
+</div>
+</div>
+<a class="anchor" id="ab6eb73ceef584fc23c8c8097926dce42"></a><!-- doxytag: member="tjregion::w" ref="ab6eb73ceef584fc23c8c8097926dce42" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int <a class="el" href="structtjregion.html#ab6eb73ceef584fc23c8c8097926dce42">tjregion::w</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>The width of the cropping region. </p>
+<p>Setting this to 0 is the equivalent of setting it to the width of the source JPEG image - x. </p>
+
+</div>
+</div>
+<a class="anchor" id="a4b6a37a93997091b26a75831fa291ad9"></a><!-- doxytag: member="tjregion::x" ref="a4b6a37a93997091b26a75831fa291ad9" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int <a class="el" href="structtjregion.html#a4b6a37a93997091b26a75831fa291ad9">tjregion::x</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>The left boundary of the cropping region. </p>
+<p>This must be evenly divisible by 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>.) </p>
+
+</div>
+</div>
+<a class="anchor" id="a7b3e0c24cfe87acc80e334cafdcf22c2"></a><!-- doxytag: member="tjregion::y" ref="a7b3e0c24cfe87acc80e334cafdcf22c2" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int <a class="el" href="structtjregion.html#a7b3e0c24cfe87acc80e334cafdcf22c2">tjregion::y</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>The upper boundary of the cropping region. </p>
+<p>This must be evenly divisible by 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>.) </p>
+
+</div>
+</div>
+<hr/>The documentation for this struct was generated from the following file:<ul>
+<li>turbojpeg.h</li>
+</ul>
+</div>
+<!-- window showing the filter options -->
+<div id="MSearchSelectWindow"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ onkeydown="return searchBox.OnSearchSelectKey(event)">
+<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Variables</a></div>
+
+<!-- iframe showing the search results (closed by default) -->
+<div id="MSearchResultsWindow">
+<iframe src="javascript:void(0)" frameborder="0"
+ name="MSearchResults" id="MSearchResults">
+</iframe>
+</div>
+
+<hr class="footer"/><address class="footer"><small>Generated on Tue Sep 20 2011 13:18:32 for TurboJPEG by 
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/doc/html/structtjscalingfactor.html b/doc/html/structtjscalingfactor.html
new file mode 100644
index 0000000..6513420
--- /dev/null
+++ b/doc/html/structtjscalingfactor.html
@@ -0,0 +1,134 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>TurboJPEG: tjscalingfactor Struct Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="search/search.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
+<!-- Generated by Doxygen 1.7.4 -->
+<script type="text/javascript"><!--
+var searchBox = new SearchBox("searchBox", "search",false,'Search');
+--></script>
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">TurboJPEG <span id="projectnumber">1.2</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li id="searchli">
+ <div id="MSearchBox" class="MSearchBoxInactive">
+ <span class="left">
+ <img id="MSearchSelect" src="search/mag_sel.png"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ alt=""/>
+ <input type="text" id="MSearchField" value="Search" accesskey="S"
+ onfocus="searchBox.OnSearchFieldFocus(true)"
+ onblur="searchBox.OnSearchFieldFocus(false)"
+ onkeyup="searchBox.OnSearchFieldChange(event)"/>
+ </span><span class="right">
+ <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
+ </span>
+ </div>
+ </li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="classes.html"><span>Data Structure Index</span></a></li>
+ <li><a href="functions.html"><span>Data Fields</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#pub-attribs">Data Fields</a> </div>
+ <div class="headertitle">
+<div class="title">tjscalingfactor Struct Reference<div class="ingroups"><a class="el" href="group___turbo_j_p_e_g.html">TurboJPEG</a></div></div> </div>
+</div>
+<div class="contents">
+<!-- doxytag: class="tjscalingfactor" -->
+<p>Scaling factor.
+ <a href="structtjscalingfactor.html#details">More...</a></p>
+
+<p><code>#include <turbojpeg.h></code></p>
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="pub-attribs"></a>
+Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjscalingfactor.html#a9b011e57f981ee23083e2c1aa5e640ec">num</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Numerator. <a href="#a9b011e57f981ee23083e2c1aa5e640ec"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjscalingfactor.html#aefbcdf3e9e62274b2d312c695f133ce3">denom</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Denominator. <a href="#aefbcdf3e9e62274b2d312c695f133ce3"></a><br/></td></tr>
+</table>
+<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
+<div class="textblock"><p>Scaling factor. </p>
+</div><hr/><h2>Field Documentation</h2>
+<a class="anchor" id="aefbcdf3e9e62274b2d312c695f133ce3"></a><!-- doxytag: member="tjscalingfactor::denom" ref="aefbcdf3e9e62274b2d312c695f133ce3" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int <a class="el" href="structtjscalingfactor.html#aefbcdf3e9e62274b2d312c695f133ce3">tjscalingfactor::denom</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Denominator. </p>
+
+</div>
+</div>
+<a class="anchor" id="a9b011e57f981ee23083e2c1aa5e640ec"></a><!-- doxytag: member="tjscalingfactor::num" ref="a9b011e57f981ee23083e2c1aa5e640ec" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int <a class="el" href="structtjscalingfactor.html#a9b011e57f981ee23083e2c1aa5e640ec">tjscalingfactor::num</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Numerator. </p>
+
+</div>
+</div>
+<hr/>The documentation for this struct was generated from the following file:<ul>
+<li>turbojpeg.h</li>
+</ul>
+</div>
+<!-- window showing the filter options -->
+<div id="MSearchSelectWindow"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ onkeydown="return searchBox.OnSearchSelectKey(event)">
+<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Variables</a></div>
+
+<!-- iframe showing the search results (closed by default) -->
+<div id="MSearchResultsWindow">
+<iframe src="javascript:void(0)" frameborder="0"
+ name="MSearchResults" id="MSearchResults">
+</iframe>
+</div>
+
+<hr class="footer"/><address class="footer"><small>Generated on Tue Sep 20 2011 13:18:32 for TurboJPEG by 
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/doc/html/structtjtransform.html b/doc/html/structtjtransform.html
new file mode 100644
index 0000000..11ed60e
--- /dev/null
+++ b/doc/html/structtjtransform.html
@@ -0,0 +1,198 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
+<title>TurboJPEG: tjtransform Struct Reference</title>
+<link href="tabs.css" rel="stylesheet" type="text/css"/>
+<link href="search/search.css" rel="stylesheet" type="text/css"/>
+<script type="text/javascript" src="search/search.js"></script>
+<link href="doxygen.css" rel="stylesheet" type="text/css"/>
+</head>
+<body onload='searchBox.OnSelectItem(0);'>
+<!-- Generated by Doxygen 1.7.4 -->
+<script type="text/javascript"><!--
+var searchBox = new SearchBox("searchBox", "search",false,'Search');
+--></script>
+<div id="top">
+<div id="titlearea">
+<table cellspacing="0" cellpadding="0">
+ <tbody>
+ <tr style="height: 56px;">
+ <td style="padding-left: 0.5em;">
+ <div id="projectname">TurboJPEG <span id="projectnumber">1.2</span></div>
+ </td>
+ </tr>
+ </tbody>
+</table>
+</div>
+ <div id="navrow1" class="tabs">
+ <ul class="tablist">
+ <li><a href="index.html"><span>Main Page</span></a></li>
+ <li><a href="modules.html"><span>Modules</span></a></li>
+ <li class="current"><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li id="searchli">
+ <div id="MSearchBox" class="MSearchBoxInactive">
+ <span class="left">
+ <img id="MSearchSelect" src="search/mag_sel.png"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ alt=""/>
+ <input type="text" id="MSearchField" value="Search" accesskey="S"
+ onfocus="searchBox.OnSearchFieldFocus(true)"
+ onblur="searchBox.OnSearchFieldFocus(false)"
+ onkeyup="searchBox.OnSearchFieldChange(event)"/>
+ </span><span class="right">
+ <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
+ </span>
+ </div>
+ </li>
+ </ul>
+ </div>
+ <div id="navrow2" class="tabs2">
+ <ul class="tablist">
+ <li><a href="annotated.html"><span>Data Structures</span></a></li>
+ <li><a href="classes.html"><span>Data Structure Index</span></a></li>
+ <li><a href="functions.html"><span>Data Fields</span></a></li>
+ </ul>
+ </div>
+</div>
+<div class="header">
+ <div class="summary">
+<a href="#pub-attribs">Data Fields</a> </div>
+ <div class="headertitle">
+<div class="title">tjtransform Struct Reference<div class="ingroups"><a class="el" href="group___turbo_j_p_e_g.html">TurboJPEG</a></div></div> </div>
+</div>
+<div class="contents">
+<!-- doxytag: class="tjtransform" -->
+<p>Lossless transform.
+ <a href="structtjtransform.html#details">More...</a></p>
+
+<p><code>#include <turbojpeg.h></code></p>
+<table class="memberdecls">
+<tr><td colspan="2"><h2><a name="pub-attribs"></a>
+Data Fields</h2></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="structtjregion.html">tjregion</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#ac324e5e442abec8a961e5bf219db12cf">r</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Cropping region. <a href="#ac324e5e442abec8a961e5bf219db12cf"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#a2525aab4ba6978a1c273f74fef50e498">op</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">One of the <a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">transform operations</a>. <a href="#a2525aab4ba6978a1c273f74fef50e498"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6">options</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">The bitwise OR of one of more of the <a class="el" href="group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2">transform options</a>. <a href="#ac0e74655baa4402209a21e1ae481c8f6"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void * </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#a688fe8f1a8ecc12a538d9e561cf338e3">data</a></td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">Arbitrary data that can be accessed within the body of the callback function. <a href="#a688fe8f1a8ecc12a538d9e561cf338e3"></a><br/></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int(* </td><td class="memItemRight" valign="bottom"><a class="el" href="structtjtransform.html#a43ee1bcdd2a8d7249a756774f78793c1">customFilter</a> )(short *coeffs, <a class="el" href="structtjregion.html">tjregion</a> arrayRegion, <a class="el" href="structtjregion.html">tjregion</a> planeRegion, int componentIndex, int transformIndex, struct <a class="el" href="structtjtransform.html">tjtransform</a> *transform)</td></tr>
+<tr><td class="mdescLeft"> </td><td class="mdescRight">A callback function that can be used to modify the DCT coefficients after they are losslessly transformed but before they are transcoded to a new JPEG file. <a href="#a43ee1bcdd2a8d7249a756774f78793c1"></a><br/></td></tr>
+</table>
+<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
+<div class="textblock"><p>Lossless transform. </p>
+</div><hr/><h2>Field Documentation</h2>
+<a class="anchor" id="a43ee1bcdd2a8d7249a756774f78793c1"></a><!-- doxytag: member="tjtransform::customFilter" ref="a43ee1bcdd2a8d7249a756774f78793c1" args=")(short *coeffs, tjregion arrayRegion, tjregion planeRegion, int componentIndex, int transformIndex, struct tjtransform *transform)" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int(* <a class="el" href="structtjtransform.html#a43ee1bcdd2a8d7249a756774f78793c1">tjtransform::customFilter</a>)(short *coeffs, <a class="el" href="structtjregion.html">tjregion</a> arrayRegion, <a class="el" href="structtjregion.html">tjregion</a> planeRegion, int componentIndex, int transformIndex, struct <a class="el" href="structtjtransform.html">tjtransform</a> *transform)</td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>A callback function that can be used to modify the DCT coefficients after they are losslessly transformed but before they are transcoded to a new JPEG file. </p>
+<p>This allows for custom filters or other transformations to be applied in the frequency domain.</p>
+<dl><dt><b>Parameters:</b></dt><dd>
+ <table class="params">
+ <tr><td class="paramname">coeffs</td><td>pointer to an array of transformed DCT coefficients. (NOTE: this pointer is not guaranteed to be valid once the callback returns, so applications wishing to hand off the DCT coefficients to another function or library should make a copy of them within the body of the callback.) </td></tr>
+ <tr><td class="paramname">arrayRegion</td><td><a class="el" href="structtjregion.html" title="Cropping region.">tjregion</a> structure containing the width and height of the array pointed to by <code>coeffs</code> as well as its offset relative to the component plane. TurboJPEG implementations may choose to split each component plane into multiple DCT coefficient arrays and call the callback function once for each array. </td></tr>
+ <tr><td class="paramname">planeRegion</td><td><a class="el" href="structtjregion.html" title="Cropping region.">tjregion</a> structure containing the width and height of the component plane to which <code>coeffs</code> belongs </td></tr>
+ <tr><td class="paramname">componentID</td><td>ID number of the component plane to which <code>coeffs</code> belongs (Y, Cb, and Cr have, respectively, ID's of 0, 1, and 2 in typical JPEG images.) </td></tr>
+ <tr><td class="paramname">transformID</td><td>ID number of the transformed image to which <code>coeffs</code> belongs. This is the same as the index of the transform in the transforms array that was passed to <a class="el" href="group___turbo_j_p_e_g.html#gae403193ceb4aafb7e0f56ab587b48616" title="Losslessly transform a JPEG image into another JPEG image.">tjTransform()</a>. </td></tr>
+ <tr><td class="paramname">transform</td><td>a pointer to a <a class="el" href="structtjtransform.html" title="Lossless transform.">tjtransform</a> structure that specifies the parameters and/or cropping region for this transform</td></tr>
+ </table>
+ </dd>
+</dl>
+<dl class="return"><dt><b>Returns:</b></dt><dd>0 if the callback was successful, or -1 if an error occurred. </dd></dl>
+
+</div>
+</div>
+<a class="anchor" id="a688fe8f1a8ecc12a538d9e561cf338e3"></a><!-- doxytag: member="tjtransform::data" ref="a688fe8f1a8ecc12a538d9e561cf338e3" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">void* <a class="el" href="structtjtransform.html#a688fe8f1a8ecc12a538d9e561cf338e3">tjtransform::data</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Arbitrary data that can be accessed within the body of the callback function. </p>
+
+</div>
+</div>
+<a class="anchor" id="a2525aab4ba6978a1c273f74fef50e498"></a><!-- doxytag: member="tjtransform::op" ref="a2525aab4ba6978a1c273f74fef50e498" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int <a class="el" href="structtjtransform.html#a2525aab4ba6978a1c273f74fef50e498">tjtransform::op</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>One of the <a class="el" href="group___turbo_j_p_e_g.html#ga2de531af4e7e6c4f124908376b354866">transform operations</a>. </p>
+
+</div>
+</div>
+<a class="anchor" id="ac0e74655baa4402209a21e1ae481c8f6"></a><!-- doxytag: member="tjtransform::options" ref="ac0e74655baa4402209a21e1ae481c8f6" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname">int <a class="el" href="structtjtransform.html#ac0e74655baa4402209a21e1ae481c8f6">tjtransform::options</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>The bitwise OR of one of more of the <a class="el" href="group___turbo_j_p_e_g.html#ga9c771a757fc1294add611906b89ab2d2">transform options</a>. </p>
+
+</div>
+</div>
+<a class="anchor" id="ac324e5e442abec8a961e5bf219db12cf"></a><!-- doxytag: member="tjtransform::r" ref="ac324e5e442abec8a961e5bf219db12cf" args="" -->
+<div class="memitem">
+<div class="memproto">
+ <table class="memname">
+ <tr>
+ <td class="memname"><a class="el" href="structtjregion.html">tjregion</a> <a class="el" href="structtjtransform.html#ac324e5e442abec8a961e5bf219db12cf">tjtransform::r</a></td>
+ </tr>
+ </table>
+</div>
+<div class="memdoc">
+
+<p>Cropping region. </p>
+
+</div>
+</div>
+<hr/>The documentation for this struct was generated from the following file:<ul>
+<li>turbojpeg.h</li>
+</ul>
+</div>
+<!-- window showing the filter options -->
+<div id="MSearchSelectWindow"
+ onmouseover="return searchBox.OnSearchSelectShow()"
+ onmouseout="return searchBox.OnSearchSelectHide()"
+ onkeydown="return searchBox.OnSearchSelectKey(event)">
+<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Variables</a></div>
+
+<!-- iframe showing the search results (closed by default) -->
+<div id="MSearchResultsWindow">
+<iframe src="javascript:void(0)" frameborder="0"
+ name="MSearchResults" id="MSearchResults">
+</iframe>
+</div>
+
+<hr class="footer"/><address class="footer"><small>Generated on Tue Sep 20 2011 13:18:32 for TurboJPEG by 
+<a href="http://www.doxygen.org/index.html">
+<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
+</body>
+</html>
diff --git a/doc/html/tab_a.png b/doc/html/tab_a.png
new file mode 100644
index 0000000..2d99ef2
--- /dev/null
+++ b/doc/html/tab_a.png
Binary files differ
diff --git a/doc/html/tab_b.png b/doc/html/tab_b.png
new file mode 100644
index 0000000..b2c3d2b
--- /dev/null
+++ b/doc/html/tab_b.png
Binary files differ
diff --git a/doc/html/tab_h.png b/doc/html/tab_h.png
new file mode 100644
index 0000000..c11f48f
--- /dev/null
+++ b/doc/html/tab_h.png
Binary files differ
diff --git a/doc/html/tab_s.png b/doc/html/tab_s.png
new file mode 100644
index 0000000..978943a
--- /dev/null
+++ b/doc/html/tab_s.png
Binary files differ
diff --git a/doc/html/tabs.css b/doc/html/tabs.css
new file mode 100644
index 0000000..2192056
--- /dev/null
+++ b/doc/html/tabs.css
@@ -0,0 +1,59 @@
+.tabs, .tabs2, .tabs3 {
+ background-image: url('tab_b.png');
+ width: 100%;
+ z-index: 101;
+ font-size: 13px;
+}
+
+.tabs2 {
+ font-size: 10px;
+}
+.tabs3 {
+ font-size: 9px;
+}
+
+.tablist {
+ margin: 0;
+ padding: 0;
+ display: table;
+}
+
+.tablist li {
+ float: left;
+ display: table-cell;
+ background-image: url('tab_b.png');
+ line-height: 36px;
+ list-style: none;
+}
+
+.tablist a {
+ display: block;
+ padding: 0 20px;
+ font-weight: bold;
+ background-image:url('tab_s.png');
+ background-repeat:no-repeat;
+ background-position:right;
+ color: #283A5D;
+ text-shadow: 0px 1px 1px rgba(255, 255, 255, 0.9);
+ text-decoration: none;
+ outline: none;
+}
+
+.tabs3 .tablist a {
+ padding: 0 10px;
+}
+
+.tablist a:hover {
+ background-image: url('tab_h.png');
+ background-repeat:repeat-x;
+ color: #fff;
+ text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
+ text-decoration: none;
+}
+
+.tablist li.current a {
+ background-image: url('tab_a.png');
+ background-repeat:repeat-x;
+ color: #fff;
+ text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0);
+}
diff --git a/doxygen.config b/doxygen.config
new file mode 100644
index 0000000..5fb34b3
--- /dev/null
+++ b/doxygen.config
@@ -0,0 +1,14 @@
+PROJECT_NAME = TurboJPEG
+PROJECT_NUMBER = 1.2
+OUTPUT_DIRECTORY = doc/
+USE_WINDOWS_ENCODING = NO
+OPTIMIZE_OUTPUT_FOR_C = YES
+WARN_NO_PARAMDOC = YES
+GENERATE_LATEX = NO
+FILE_PATTERNS = turbojpeg.h
+HIDE_UNDOC_MEMBERS = YES
+VERBATIM_HEADERS = NO
+EXTRACT_STATIC = YES
+JAVADOC_AUTOBRIEF = YES
+MAX_INITIALIZER_LINES = 0
+ALWAYS_DETAILED_SEC = YES
diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt
new file mode 100644
index 0000000..87f8ec6
--- /dev/null
+++ b/java/CMakeLists.txt
@@ -0,0 +1,54 @@
+set(JAR_FILE turbojpeg.jar)
+set(MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/MANIFEST.MF)
+
+set(JAVA_CLASSNAMES org/libjpegturbo/turbojpeg/TJ
+ org/libjpegturbo/turbojpeg/TJCompressor
+ org/libjpegturbo/turbojpeg/TJCustomFilter
+ org/libjpegturbo/turbojpeg/TJDecompressor
+ org/libjpegturbo/turbojpeg/TJScalingFactor
+ org/libjpegturbo/turbojpeg/TJTransform
+ org/libjpegturbo/turbojpeg/TJTransformer
+ TJUnitTest
+ TJExample)
+
+if(MSVC_IDE)
+ set(OBJDIR "${CMAKE_CURRENT_BINARY_DIR}/$(OutDir)")
+else()
+ set(OBJDIR ${CMAKE_CURRENT_BINARY_DIR})
+endif()
+
+set(TURBOJPEG_DLL_NAME "turbojpeg")
+if(MINGW)
+ set(TURBOJPEG_DLL_NAME "libturbojpeg")
+endif()
+configure_file(org/libjpegturbo/turbojpeg/TJLoader.java.in
+ ${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java)
+
+set(JAVA_SOURCES "")
+set(JAVA_CLASSES "")
+set(JAVA_CLASSES_FULL "")
+foreach(class ${JAVA_CLASSNAMES})
+ set(JAVA_SOURCES ${JAVA_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/${class}.java)
+ set(JAVA_CLASSES ${JAVA_CLASSES} ${class}.class)
+ set(JAVA_CLASSES_FULL ${JAVA_CLASSES_FULL} ${OBJDIR}/${class}.class)
+endforeach()
+
+set(JAVA_SOURCES ${JAVA_SOURCES}
+ ${CMAKE_CURRENT_BINARY_DIR}/org/libjpegturbo/turbojpeg/TJLoader.java)
+set(JAVA_CLASSES ${JAVA_CLASSES}
+ org/libjpegturbo/turbojpeg/TJLoader.class)
+set(JAVA_CLASSES_FULL ${JAVA_CLASSES_FULL}
+ ${OBJDIR}/org/libjpegturbo/turbojpeg/TJLoader.class)
+
+string(REGEX REPLACE " " ";" JAVACFLAGS "${JAVACFLAGS}")
+add_custom_command(OUTPUT ${JAVA_CLASSES_FULL} DEPENDS ${JAVA_SOURCES}
+ COMMAND ${JAVA_COMPILE} ARGS ${JAVACFLAGS} -d ${OBJDIR} ${JAVA_SOURCES})
+
+add_custom_command(OUTPUT ${JAR_FILE} DEPENDS ${JAVA_CLASSES_FULL}
+ ${MANIFEST_FILE}
+ COMMAND ${JAVA_ARCHIVE} cfm ${JAR_FILE} ${MANIFEST_FILE} ${JAVA_CLASSES}
+ WORKING_DIRECTORY ${OBJDIR})
+
+add_custom_target(java ALL DEPENDS ${JAR_FILE})
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${JAR_FILE} DESTINATION classes)
diff --git a/java/MANIFEST.MF b/java/MANIFEST.MF
new file mode 100644
index 0000000..723bc51
--- /dev/null
+++ b/java/MANIFEST.MF
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Main-Class: TJExample
diff --git a/java/Makefile.am b/java/Makefile.am
new file mode 100644
index 0000000..4a1b34e
--- /dev/null
+++ b/java/Makefile.am
@@ -0,0 +1,63 @@
+JAVAROOT = .
+
+JAVASOURCES = org/libjpegturbo/turbojpeg/TJ.java \
+ org/libjpegturbo/turbojpeg/TJCompressor.java \
+ org/libjpegturbo/turbojpeg/TJCustomFilter.java \
+ org/libjpegturbo/turbojpeg/TJDecompressor.java \
+ org/libjpegturbo/turbojpeg/TJLoader.java \
+ org/libjpegturbo/turbojpeg/TJScalingFactor.java \
+ org/libjpegturbo/turbojpeg/TJTransform.java \
+ org/libjpegturbo/turbojpeg/TJTransformer.java \
+ TJExample.java \
+ TJUnitTest.java
+
+JNIHEADERS = org_libjpegturbo_turbojpeg_TJ.h \
+ org_libjpegturbo_turbojpeg_TJCompressor.h \
+ org_libjpegturbo_turbojpeg_TJDecompressor.h \
+ org_libjpegturbo_turbojpeg_TJTransformer.h
+
+if WITH_JAVA
+
+dist_noinst_JAVA = ${JAVASOURCES}
+
+JAVA_CLASSES = org/libjpegturbo/turbojpeg/TJ.class \
+ org/libjpegturbo/turbojpeg/TJCompressor.class \
+ org/libjpegturbo/turbojpeg/TJCustomFilter.class \
+ org/libjpegturbo/turbojpeg/TJDecompressor.class \
+ org/libjpegturbo/turbojpeg/TJLoader.class \
+ org/libjpegturbo/turbojpeg/TJScalingFactor.class \
+ org/libjpegturbo/turbojpeg/TJTransform.class \
+ org/libjpegturbo/turbojpeg/TJTransformer.class \
+ TJExample.class \
+ TJUnitTest.class
+
+all: all-am turbojpeg.jar
+
+turbojpeg.jar: $(JAVA_CLASSES) ${srcdir}/MANIFEST.MF
+ $(JAR) cfm turbojpeg.jar ${srcdir}/MANIFEST.MF $(JAVA_CLASSES)
+
+clean-local:
+ rm -f turbojpeg.jar
+
+install-exec-local: turbojpeg.jar
+ mkdir -p $(DESTDIR)/$(prefix)/classes
+ $(INSTALL) -m 644 turbojpeg.jar $(DESTDIR)/$(prefix)/classes/
+
+uninstall-local:
+ rm -f $(DESTDIR)/$(prefix)/classes/turbojpeg.jar
+ if [ -d $(DESTDIR)/$(prefix)/classes ]; then rmdir $(DESTDIR)/$(prefix)/classes; fi
+
+headers: all
+ javah -d ${srcdir} org.libjpegturbo.turbojpeg.TJ; \
+ javah -d ${srcdir} org.libjpegturbo.turbojpeg.TJCompressor; \
+ javah -d ${srcdir} org.libjpegturbo.turbojpeg.TJDecompressor; \
+ javah -d ${srcdir} org.libjpegturbo.turbojpeg.TJTransformer
+
+docs: all
+ mkdir -p ${srcdir}/doc; \
+ javadoc -d ${srcdir}/doc -sourcepath ${srcdir} org.libjpegturbo.turbojpeg
+
+endif
+
+EXTRA_DIST = MANIFEST.MF ${JAVASOURCES} ${JNIHEADERS} doc CMakeLists.txt \
+ org/libjpegturbo/turbojpeg/TJLoader.java.in
diff --git a/java/README b/java/README
new file mode 100644
index 0000000..f586682
--- /dev/null
+++ b/java/README
@@ -0,0 +1,55 @@
+TurboJPEG/OSS Java Wrapper
+==========================
+
+TurboJPEG/OSS can optionally be built with a Java Native Interface wrapper,
+which allows the TurboJPEG/OSS dynamic library to be loaded and used directly
+from Java applications. The Java front end for this is defined in several
+classes located under org/libjpegturbo/turbojpeg. The source code for these
+Java classes is licensed under a BSD-style license, so the files can be
+incorporated directly into both open source and proprietary projects without
+restriction. A Java archive (JAR) file containing these classes is also
+shipped with the "official" distribution packages of libjpeg-turbo.
+
+TJExample.java, which should also be located in the same directory as this
+README file, demonstrates how to use the TurboJPEG/OSS Java front end to
+compress and decompress JPEG images in memory.
+
+
+Performance Pitfalls
+--------------------
+
+The TurboJPEG Java front end defines several convenience methods which can
+allocate image buffers or instantiate classes to hold the result of compress,
+decompress, or transform operations. However, if you use these methods, then
+be mindful of the amount of new data you are creating on the heap. It may be
+necessary to manually invoke the garbage collector to prevent heap exhaustion
+or to prevent performance degradation. Background garbage collection can kill
+performance, particularly in a multi-threaded environment (Java pauses all
+threads when the GC runs.)
+
+The Java front end always gives you the option of pre-allocating your own
+source and destination buffers, which allows you to re-use these buffers for
+compressing/decompressing multiple images. If the image sequence you are
+compressing or decompressing consists of images of the same size, then
+pre-allocating the buffers is recommended.
+
+
+Note for OS X users
+-------------------
+
+/usr/lib, the directory under which libturbojpeg.dylib is installed on Mac
+systems, is not part of the normal Java library path. Thus, when running a
+Java application that uses TurboJPEG/OSS on Mac systems, you will need to pass
+an argument of -Djava.library.path=/usr/lib to java.
+
+
+Note for Solaris users
+----------------------
+
+/opt/libjpeg-turbo/lib, the directory under which libturbojpeg.so is installed
+on Solaris systems, is not part of the normal Java library path. Thus, when
+running a Java application that uses TurboJPEG/OSS on Solaris systems, you will
+need to pass an argument of -Djava.library.path=/opt/libjpeg-turbo/lib to java.
+If using a 64-bit data model, then instead pass an argument of
+-Djava.library.path=/opt/libjpeg-turbo/lib/amd64 to use the 64-bit version of
+libturbojpeg.so.
diff --git a/java/TJExample.java b/java/TJExample.java
new file mode 100644
index 0000000..36c1a8f
--- /dev/null
+++ b/java/TJExample.java
@@ -0,0 +1,320 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+/*
+ * This program demonstrates how to compress and decompress JPEG files using
+ * the TurboJPEG JNI wrapper
+ */
+
+import java.io.*;
+import java.awt.*;
+import java.awt.image.*;
+import java.nio.*;
+import javax.imageio.*;
+import javax.swing.*;
+import org.libjpegturbo.turbojpeg.*;
+
+public class TJExample implements TJCustomFilter {
+
+ public static final String classname = new TJExample().getClass().getName();
+
+ private static void usage() throws Exception {
+ System.out.println("\nUSAGE: java " + classname + " <Input file> <Output file> [options]\n");
+ System.out.println("Input and output files can be any image format that the Java Image I/O");
+ System.out.println("extensions understand. If either filename ends in a .jpg extension, then");
+ System.out.println("TurboJPEG will be used to compress or decompress the file.\n");
+ System.out.println("Options:\n");
+ System.out.println("-scale M/N = if the input image is a JPEG file, scale the width/height of the");
+ System.out.print(" output image by a factor of M/N (M/N = ");
+ for(int i = 0; i < sf.length; i++) {
+ System.out.print(sf[i].getNum() + "/" + sf[i].getDenom());
+ if(sf.length == 2 && i != sf.length - 1) System.out.print(" or ");
+ else if(sf.length > 2) {
+ if(i != sf.length - 1) System.out.print(", ");
+ if(i == sf.length - 2) System.out.print("or ");
+ }
+ }
+ System.out.println(")\n");
+ System.out.println("-samp <444|422|420|gray> = If the output image is a JPEG file, this specifies");
+ System.out.println(" the level of chrominance subsampling to use when");
+ System.out.println(" recompressing it. Default is to use the same level");
+ System.out.println(" of subsampling as the input, if the input is a JPEG");
+ System.out.println(" file, or 4:4:4 otherwise.\n");
+ System.out.println("-q <1-100> = If the output image is a JPEG file, this specifies the JPEG");
+ System.out.println(" quality to use when recompressing it (default = 95).\n");
+ System.out.println("-hflip, -vflip, -transpose, -transverse, -rot90, -rot180, -rot270 =");
+ System.out.println(" If the input image is a JPEG file, perform the corresponding lossless");
+ System.out.println(" transform prior to decompression (these options are mutually exclusive)\n");
+ System.out.println("-grayscale = If the input image is a JPEG file, perform lossless grayscale");
+ System.out.println(" conversion prior to decompression (can be combined with the other");
+ System.out.println(" transforms above)\n");
+ System.out.println("-crop X,Y,WxH = If the input image is a JPEG file, perform lossless cropping");
+ System.out.println(" prior to decompression. X,Y specifies the upper left corner of the");
+ System.out.println(" cropping region, and WxH specifies its width and height. X,Y must be");
+ System.out.println(" evenly divible by the MCU block size (8x8 if the source image was");
+ System.out.println(" compressed using no subsampling or grayscale, or 16x8 for 4:2:2 or 16x16");
+ System.out.println(" for 4:2:0.)\n");
+ System.out.println("-display = Display output image (Output file need not be specified in this");
+ System.out.println(" case.)\n");
+ System.exit(1);
+ }
+
+ private final static String sampName[] = {
+ "4:4:4", "4:2:2", "4:2:0", "Grayscale", "4:4:0"
+ };
+
+ public static void main(String argv[]) {
+
+ BufferedImage img = null; byte[] bmpBuf = null;
+ TJTransform xform = new TJTransform();
+
+ try {
+
+ sf = TJ.getScalingFactors();
+
+ if(argv.length < 2) {
+ usage();
+ }
+
+ TJScalingFactor scaleFactor = new TJScalingFactor(1, 1);
+ String inFormat = "jpg", outFormat = "jpg";
+ int outSubsamp = -1, outQual = 95;
+ boolean display = false;
+
+ if(argv.length > 1) {
+ for(int i = 1; i < argv.length; i++) {
+ if(argv[i].length() < 2) continue;
+ if(argv[i].length() > 2
+ && argv[i].substring(0, 3).equalsIgnoreCase("-sc")) {
+ int match = 0;
+ if(i < argv.length - 1) {
+ String[] scaleArg = argv[++i].split("/");
+ if(scaleArg.length == 2) {
+ TJScalingFactor tempsf =
+ new TJScalingFactor(Integer.parseInt(scaleArg[0]),
+ Integer.parseInt(scaleArg[1]));
+ for(int j = 0; j < sf.length; j++) {
+ if(tempsf.equals(sf[j])) {
+ scaleFactor = sf[j];
+ match = 1; break;
+ }
+ }
+ }
+ }
+ if(match != 1) usage();
+ }
+ if(argv[i].equalsIgnoreCase("-h") || argv[i].equalsIgnoreCase("-?"))
+ usage();
+ if(argv[i].length() > 2
+ && argv[i].substring(0, 3).equalsIgnoreCase("-sa")) {
+ if(i < argv.length - 1) {
+ i++;
+ if(argv[i].substring(0, 1).equalsIgnoreCase("g"))
+ outSubsamp = TJ.SAMP_GRAY;
+ else if(argv[i].equals("444")) outSubsamp = TJ.SAMP_444;
+ else if(argv[i].equals("422")) outSubsamp = TJ.SAMP_422;
+ else if(argv[i].equals("420")) outSubsamp = TJ.SAMP_420;
+ else usage();
+ }
+ else usage();
+ }
+ if(argv[i].substring(0, 2).equalsIgnoreCase("-q")) {
+ if(i < argv.length - 1) {
+ int qual = Integer.parseInt(argv[++i]);
+ if(qual >= 1 && qual <= 100) outQual = qual;
+ else usage();
+ }
+ else usage();
+ }
+ if(argv[i].substring(0, 2).equalsIgnoreCase("-g"))
+ xform.options |= TJTransform.OPT_GRAY;
+ if(argv[i].equalsIgnoreCase("-hflip"))
+ xform.op = TJTransform.OP_HFLIP;
+ if(argv[i].equalsIgnoreCase("-vflip"))
+ xform.op = TJTransform.OP_VFLIP;
+ if(argv[i].equalsIgnoreCase("-transpose"))
+ xform.op = TJTransform.OP_TRANSPOSE;
+ if(argv[i].equalsIgnoreCase("-transverse"))
+ xform.op = TJTransform.OP_TRANSVERSE;
+ if(argv[i].equalsIgnoreCase("-rot90"))
+ xform.op = TJTransform.OP_ROT90;
+ if(argv[i].equalsIgnoreCase("-rot180"))
+ xform.op = TJTransform.OP_ROT180;
+ if(argv[i].equalsIgnoreCase("-rot270"))
+ xform.op = TJTransform.OP_ROT270;
+ if(argv[i].equalsIgnoreCase("-custom"))
+ xform.cf = new TJExample();
+ else if(argv[i].length() > 2
+ && argv[i].substring(0, 2).equalsIgnoreCase("-c")) {
+ if(i >= argv.length - 1) usage();
+ String[] cropArg = argv[++i].split(",");
+ if(cropArg.length != 3) usage();
+ String[] dimArg = cropArg[2].split("[xX]");
+ if(dimArg.length != 2) usage();
+ int tempx = Integer.parseInt(cropArg[0]);
+ int tempy = Integer.parseInt(cropArg[1]);
+ int tempw = Integer.parseInt(dimArg[0]);
+ int temph = Integer.parseInt(dimArg[1]);
+ if(tempx < 0 || tempy < 0 || tempw < 0 || temph < 0) usage();
+ xform.x = tempx; xform.y = tempy;
+ xform.width = tempw; xform.height = temph;
+ xform.options |= TJTransform.OPT_CROP;
+ }
+ if(argv[i].substring(0, 2).equalsIgnoreCase("-d"))
+ display = true;
+ }
+ }
+ String[] inFileTokens = argv[0].split("\\.");
+ if(inFileTokens.length > 1)
+ inFormat = inFileTokens[inFileTokens.length - 1];
+ String[] outFileTokens;
+ if(display) outFormat = "bmp";
+ else {
+ outFileTokens = argv[1].split("\\.");
+ if(outFileTokens.length > 1)
+ outFormat = outFileTokens[outFileTokens.length - 1];
+ }
+
+ File file = new File(argv[0]);
+ int width, height;
+
+ if(inFormat.equalsIgnoreCase("jpg")) {
+ FileInputStream fis = new FileInputStream(file);
+ int inputSize = fis.available();
+ if(inputSize < 1) {
+ System.out.println("Input file contains no data");
+ System.exit(1);
+ }
+ byte[] inputBuf = new byte[inputSize];
+ fis.read(inputBuf);
+ fis.close();
+
+ TJDecompressor tjd;
+ if(xform.op != TJTransform.OP_NONE || xform.options != 0
+ || xform.cf != null) {
+ TJTransformer tjt = new TJTransformer(inputBuf);
+ TJTransform t[] = new TJTransform[1];
+ t[0] = xform;
+ t[0].options |= TJTransform.OPT_TRIM;
+ TJDecompressor[] tjdx = tjt.transform(t, 0);
+ tjd = tjdx[0];
+ }
+ else tjd = new TJDecompressor(inputBuf);
+
+ width = tjd.getWidth();
+ height = tjd.getHeight();
+ int inSubsamp = tjd.getSubsamp();
+ System.out.println("Source Image: " + width + " x " + height
+ + " pixels, " + sampName[inSubsamp] + " subsampling");
+ if(outSubsamp < 0) outSubsamp = inSubsamp;
+
+ if(outFormat.equalsIgnoreCase("jpg")
+ && (xform.op != TJTransform.OP_NONE || xform.options != 0)
+ && scaleFactor.isOne()) {
+ file = new File(argv[1]);
+ FileOutputStream fos = new FileOutputStream(file);
+ fos.write(tjd.getJPEGBuf(), 0, tjd.getJPEGSize());
+ fos.close();
+ System.exit(0);
+ }
+
+ width = scaleFactor.getScaled(width);
+ height = scaleFactor.getScaled(height);
+
+ if(!outFormat.equalsIgnoreCase("jpg"))
+ img = tjd.decompress(width, height, BufferedImage.TYPE_INT_RGB, 0);
+ else bmpBuf = tjd.decompress(width, 0, height, TJ.PF_BGRX, 0);
+ tjd.close();
+ }
+ else {
+ img = ImageIO.read(file);
+ width = img.getWidth();
+ height = img.getHeight();
+ if(outSubsamp < 0) {
+ if(img.getType() == BufferedImage.TYPE_BYTE_GRAY)
+ outSubsamp = TJ.SAMP_GRAY;
+ else outSubsamp = TJ.SAMP_444;
+ }
+ }
+ System.gc();
+ if(!display)
+ System.out.print("Dest. Image (" + outFormat + "): " + width + " x "
+ + height + " pixels");
+
+ if(display) {
+ ImageIcon icon = new ImageIcon(img);
+ JLabel label = new JLabel(icon, JLabel.CENTER);
+ JOptionPane.showMessageDialog(null, label, "Output Image",
+ JOptionPane.PLAIN_MESSAGE);
+ }
+ else if(outFormat.equalsIgnoreCase("jpg")) {
+ System.out.println(", " + sampName[outSubsamp]
+ + " subsampling, quality = " + outQual);
+ TJCompressor tjc = new TJCompressor();
+ int jpegSize;
+ byte[] jpegBuf;
+
+ tjc.setSubsamp(outSubsamp);
+ tjc.setJPEGQuality(outQual);
+ if(img != null)
+ jpegBuf = tjc.compress(img, 0);
+ else {
+ tjc.setSourceImage(bmpBuf, width, 0, height, TJ.PF_BGRX);
+ jpegBuf = tjc.compress(0);
+ }
+ jpegSize = tjc.getCompressedSize();
+ tjc.close();
+
+ file = new File(argv[1]);
+ FileOutputStream fos = new FileOutputStream(file);
+ fos.write(jpegBuf, 0, jpegSize);
+ fos.close();
+ }
+ else {
+ System.out.print("\n");
+ file = new File(argv[1]);
+ ImageIO.write(img, outFormat, file);
+ }
+
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ }
+
+ public void customFilter(ShortBuffer coeffBuffer, Rectangle bufferRegion,
+ Rectangle planeRegion, int componentIndex, int transformIndex,
+ TJTransform transform) throws Exception {
+ for(int i=0; i<bufferRegion.width*bufferRegion.height; i++) {
+ coeffBuffer.put(i, (short)(-coeffBuffer.get(i)));
+ }
+ }
+
+ static TJScalingFactor sf [] = null;
+};
diff --git a/java/TJUnitTest.java b/java/TJUnitTest.java
new file mode 100644
index 0000000..b732930
--- /dev/null
+++ b/java/TJUnitTest.java
@@ -0,0 +1,887 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+/*
+ * This program tests the various code paths in the TurboJPEG JNI Wrapper
+ */
+
+import java.io.*;
+import java.util.*;
+import java.awt.image.*;
+import javax.imageio.*;
+import java.nio.*;
+import org.libjpegturbo.turbojpeg.*;
+
+public class TJUnitTest {
+
+ private static final String classname =
+ new TJUnitTest().getClass().getName();
+
+ private static void usage() {
+ System.out.println("\nUSAGE: java " + classname + " [options]\n");
+ System.out.println("Options:\n");
+ System.out.println("-yuv = test YUV encoding/decoding support\n");
+ System.out.println("-bi = test BufferedImage support\n");
+ System.exit(1);
+ }
+
+ private final static String subNameLong[] = {
+ "4:4:4", "4:2:2", "4:2:0", "GRAY", "4:4:0"
+ };
+ private final static String subName[] = {
+ "444", "422", "420", "GRAY", "440"
+ };
+
+ private final static String pixFormatStr[] = {
+ "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "Grayscale"
+ };
+
+ private final static int alphaOffset[] = {
+ -1, -1, 3, 3, 0, 0, -1
+ };
+
+ private final static int _3byteFormats[] = {
+ TJ.PF_RGB, TJ.PF_BGR
+ };
+ private final static int _3byteFormatsBI[] = {
+ BufferedImage.TYPE_3BYTE_BGR
+ };
+ private final static int _4byteFormats[] = {
+ TJ.PF_RGBX, TJ.PF_BGRX, TJ.PF_XBGR, TJ.PF_XRGB
+ };
+ private final static int _4byteFormatsBI[] = {
+ BufferedImage.TYPE_INT_BGR, BufferedImage.TYPE_INT_RGB,
+ BufferedImage.TYPE_4BYTE_ABGR, BufferedImage.TYPE_4BYTE_ABGR_PRE,
+ BufferedImage.TYPE_INT_ARGB, BufferedImage.TYPE_INT_ARGB_PRE
+ };
+ private final static int onlyGray[] = {
+ TJ.PF_GRAY
+ };
+ private final static int onlyGrayBI[] = {
+ BufferedImage.TYPE_BYTE_GRAY
+ };
+ private final static int onlyRGB[] = {
+ TJ.PF_RGB
+ };
+
+ private final static int YUVENCODE = 1;
+ private final static int YUVDECODE = 2;
+ private static int yuv = 0;
+ private static boolean bi = false;
+
+ private static int exitStatus = 0;
+
+ private static int biTypePF(int biType) {
+ ByteOrder byteOrder = ByteOrder.nativeOrder();
+ switch(biType) {
+ case BufferedImage.TYPE_3BYTE_BGR:
+ return TJ.PF_BGR;
+ case BufferedImage.TYPE_4BYTE_ABGR:
+ case BufferedImage.TYPE_4BYTE_ABGR_PRE:
+ return TJ.PF_XBGR;
+ case BufferedImage.TYPE_BYTE_GRAY:
+ return TJ.PF_GRAY;
+ case BufferedImage.TYPE_INT_BGR:
+ if(byteOrder == ByteOrder.BIG_ENDIAN)
+ return TJ.PF_XBGR;
+ else
+ return TJ.PF_RGBX;
+ case BufferedImage.TYPE_INT_RGB:
+ case BufferedImage.TYPE_INT_ARGB:
+ case BufferedImage.TYPE_INT_ARGB_PRE:
+ if(byteOrder == ByteOrder.BIG_ENDIAN)
+ return TJ.PF_XRGB;
+ else
+ return TJ.PF_BGRX;
+ }
+ return 0;
+ }
+
+ private static String biTypeStr(int biType) {
+ switch(biType) {
+ case BufferedImage.TYPE_3BYTE_BGR:
+ return "3BYTE_BGR";
+ case BufferedImage.TYPE_4BYTE_ABGR:
+ return "4BYTE_ABGR";
+ case BufferedImage.TYPE_4BYTE_ABGR_PRE:
+ return "4BYTE_ABGR_PRE";
+ case BufferedImage.TYPE_BYTE_GRAY:
+ return "BYTE_GRAY";
+ case BufferedImage.TYPE_INT_BGR:
+ return "INT_BGR";
+ case BufferedImage.TYPE_INT_RGB:
+ return "INT_RGB";
+ case BufferedImage.TYPE_INT_ARGB:
+ return "INT_ARGB";
+ case BufferedImage.TYPE_INT_ARGB_PRE:
+ return "INT_ARGB_PRE";
+ }
+ return "Unknown";
+ }
+
+
+ private static double getTime() {
+ return (double)System.nanoTime() / 1.0e9;
+ }
+
+ private static void initBuf(byte[] buf, int w, int pitch, int h, int pf,
+ int flags) throws Exception {
+ int roffset = TJ.getRedOffset(pf);
+ int goffset = TJ.getGreenOffset(pf);
+ int boffset = TJ.getBlueOffset(pf);
+ int aoffset = alphaOffset[pf];
+ int ps = TJ.getPixelSize(pf);
+ int index, row, col, halfway = 16;
+
+ Arrays.fill(buf, (byte)0);
+ if(pf == TJ.PF_GRAY) {
+ for(row = 0; row < h; row++) {
+ for(col = 0; col < w; col++) {
+ if((flags & TJ.FLAG_BOTTOMUP) != 0)
+ index = pitch * (h - row - 1) + col;
+ else index = pitch * row + col;
+ if(((row / 8) + (col / 8)) % 2 == 0)
+ buf[index] = (row < halfway) ? (byte)255 : 0;
+ else buf[index] = (row < halfway) ? 76 : (byte)226;
+ }
+ }
+ return;
+ }
+ for(row = 0; row < h; row++) {
+ for(col = 0; col < w; col++) {
+ if((flags & TJ.FLAG_BOTTOMUP) != 0)
+ index = pitch * (h - row - 1) + col * ps;
+ else index = pitch * row + col * ps;
+ if(((row / 8) + (col / 8)) % 2 == 0) {
+ if(row < halfway) {
+ buf[index + roffset] = (byte)255;
+ buf[index + goffset] = (byte)255;
+ buf[index + boffset] = (byte)255;
+ }
+ }
+ else {
+ buf[index + roffset] = (byte)255;
+ if(row >= halfway) buf[index + goffset] = (byte)255;
+ }
+ if (aoffset >= 0) buf[index + aoffset] = (byte)255;
+ }
+ }
+ }
+
+ private static void initIntBuf(int[] buf, int w, int pitch, int h, int pf,
+ int flags) throws Exception {
+ int rshift = TJ.getRedOffset(pf) * 8;
+ int gshift = TJ.getGreenOffset(pf) * 8;
+ int bshift = TJ.getBlueOffset(pf) * 8;
+ int ashift = alphaOffset[pf] * 8;
+ int index, row, col, halfway = 16;
+
+ Arrays.fill(buf, 0);
+ for(row = 0; row < h; row++) {
+ for(col = 0; col < w; col++) {
+ if((flags & TJ.FLAG_BOTTOMUP) != 0)
+ index = pitch * (h - row - 1) + col;
+ else index = pitch * row + col;
+ if(((row / 8) + (col / 8)) % 2 == 0) {
+ if(row < halfway) {
+ buf[index] |= (255 << rshift);
+ buf[index] |= (255 << gshift);
+ buf[index] |= (255 << bshift);
+ }
+ }
+ else {
+ buf[index] |= (255 << rshift);
+ if(row >= halfway) buf[index] |= (255 << gshift);
+ }
+ if (ashift >= 0) buf[index] |= (255 << ashift);
+ }
+ }
+ }
+
+ private static void initImg(BufferedImage img, int pf, int flags)
+ throws Exception {
+ WritableRaster wr = img.getRaster();
+ int imgType = img.getType();
+ if(imgType == BufferedImage.TYPE_INT_RGB
+ || imgType == BufferedImage.TYPE_INT_BGR
+ || imgType == BufferedImage.TYPE_INT_ARGB
+ || imgType == BufferedImage.TYPE_INT_ARGB_PRE) {
+ SinglePixelPackedSampleModel sm =
+ (SinglePixelPackedSampleModel)img.getSampleModel();
+ int pitch = sm.getScanlineStride();
+ DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
+ int[] buf = db.getData();
+ initIntBuf(buf, img.getWidth(), pitch, img.getHeight(), pf, flags);
+ }
+ else {
+ ComponentSampleModel sm = (ComponentSampleModel)img.getSampleModel();
+ int pitch = sm.getScanlineStride();
+ DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
+ byte[] buf = db.getData();
+ initBuf(buf, img.getWidth(), pitch, img.getHeight(), pf, flags);
+ }
+ }
+
+ private static void checkVal(int row, int col, int v, String vname, int cv)
+ throws Exception {
+ v = (v < 0) ? v + 256 : v;
+ if(v < cv - 1 || v > cv + 1) {
+ throw new Exception("\nComp. " + vname + " at " + row + "," + col
+ + " should be " + cv + ", not " + v + "\n");
+ }
+ }
+
+ private static void checkVal0(int row, int col, int v, String vname)
+ throws Exception {
+ v = (v < 0) ? v + 256 : v;
+ if(v > 1) {
+ throw new Exception("\nComp. " + vname + " at " + row + "," + col
+ + " should be 0, not " + v + "\n");
+ }
+ }
+
+ private static void checkVal255(int row, int col, int v, String vname)
+ throws Exception {
+ v = (v < 0) ? v + 256 : v;
+ if(v < 254) {
+ throw new Exception("\nComp. " + vname + " at " + row + "," + col
+ + " should be 255, not " + v + "\n");
+ }
+ }
+
+ private static int checkBuf(byte[] buf, int w, int pitch, int h, int pf,
+ int subsamp, TJScalingFactor sf, int flags) throws Exception {
+ int roffset = TJ.getRedOffset(pf);
+ int goffset = TJ.getGreenOffset(pf);
+ int boffset = TJ.getBlueOffset(pf);
+ int aoffset = alphaOffset[pf];
+ int ps = TJ.getPixelSize(pf);
+ int index, row, col, retval = 1;
+ int halfway = 16 * sf.getNum() / sf.getDenom();
+ int blockSize = 8 * sf.getNum() / sf.getDenom();
+
+ try {
+ for(row = 0; row < halfway; row++) {
+ for(col = 0; col < w; col++) {
+ if((flags & TJ.FLAG_BOTTOMUP) != 0)
+ index = pitch * (h - row - 1) + col * ps;
+ else index = pitch * row + col * ps;
+ byte r = buf[index + roffset];
+ byte g = buf[index + goffset];
+ byte b = buf[index + boffset];
+ byte a = aoffset >= 0 ? buf[index + aoffset] : (byte)255;
+ if(((row / blockSize) + (col / blockSize)) % 2 == 0) {
+ if(row < halfway) {
+ checkVal255(row, col, r, "R");
+ checkVal255(row, col, g, "G");
+ checkVal255(row, col, b, "B");
+ }
+ else {
+ checkVal0(row, col, r, "R");
+ checkVal0(row, col, g, "G");
+ checkVal0(row, col, b, "B");
+ }
+ }
+ else {
+ if(subsamp == TJ.SAMP_GRAY) {
+ if(row < halfway) {
+ checkVal(row, col, r, "R", 76);
+ checkVal(row, col, g, "G", 76);
+ checkVal(row, col, b, "B", 76);
+ }
+ else {
+ checkVal(row, col, r, "R", 226);
+ checkVal(row, col, g, "G", 226);
+ checkVal(row, col, b, "B", 226);
+ }
+ }
+ else {
+ checkVal255(row, col, r, "R");
+ if(row < halfway) {
+ checkVal0(row, col, g, "G");
+ }
+ else {
+ checkVal255(row, col, g, "G");
+ }
+ checkVal0(row, col, b, "B");
+ }
+ }
+ checkVal255(row, col, a, "A");
+ }
+ }
+ }
+ catch(Exception e) {
+ System.out.println(e);
+ retval = 0;
+ }
+
+ if(retval == 0) {
+ System.out.print("\n");
+ for(row = 0; row < h; row++) {
+ for(col = 0; col < w; col++) {
+ int r = buf[pitch * row + col * ps + roffset];
+ int g = buf[pitch * row + col * ps + goffset];
+ int b = buf[pitch * row + col * ps + boffset];
+ if(r < 0) r += 256; if(g < 0) g += 256; if(b < 0) b += 256;
+ System.out.format("%3d/%3d/%3d ", r, g, b);
+ }
+ System.out.print("\n");
+ }
+ }
+ return retval;
+ }
+
+ private static int checkIntBuf(int[] buf, int w, int pitch, int h, int pf,
+ int subsamp, TJScalingFactor sf, int flags) throws Exception {
+ int rshift = TJ.getRedOffset(pf) * 8;
+ int gshift = TJ.getGreenOffset(pf) * 8;
+ int bshift = TJ.getBlueOffset(pf) * 8;
+ int ashift = alphaOffset[pf] * 8;
+ int index, row, col, retval = 1;
+ int halfway = 16 * sf.getNum() / sf.getDenom();
+ int blockSize = 8 * sf.getNum() / sf.getDenom();
+
+ try {
+ for(row = 0; row < halfway; row++) {
+ for(col = 0; col < w; col++) {
+ if((flags & TJ.FLAG_BOTTOMUP) != 0)
+ index = pitch * (h - row - 1) + col;
+ else index = pitch * row + col;
+ int r = (buf[index] >> rshift) & 0xFF;
+ int g = (buf[index] >> gshift) & 0xFF;
+ int b = (buf[index] >> bshift) & 0xFF;
+ int a = ashift >= 0 ? (buf[index] >> ashift) & 0xFF : 255;
+ if(((row / blockSize) + (col / blockSize)) % 2 == 0) {
+ if(row < halfway) {
+ checkVal255(row, col, r, "R");
+ checkVal255(row, col, g, "G");
+ checkVal255(row, col, b, "B");
+ }
+ else {
+ checkVal0(row, col, r, "R");
+ checkVal0(row, col, g, "G");
+ checkVal0(row, col, b, "B");
+ }
+ }
+ else {
+ if(subsamp == TJ.SAMP_GRAY) {
+ if(row < halfway) {
+ checkVal(row, col, r, "R", 76);
+ checkVal(row, col, g, "G", 76);
+ checkVal(row, col, b, "B", 76);
+ }
+ else {
+ checkVal(row, col, r, "R", 226);
+ checkVal(row, col, g, "G", 226);
+ checkVal(row, col, b, "B", 226);
+ }
+ }
+ else {
+ checkVal255(row, col, r, "R");
+ if(row < halfway) {
+ checkVal0(row, col, g, "G");
+ }
+ else {
+ checkVal255(row, col, g, "G");
+ }
+ checkVal0(row, col, b, "B");
+ }
+ }
+ checkVal255(row, col, a, "A");
+ }
+ }
+ }
+ catch(Exception e) {
+ System.out.println(e);
+ retval = 0;
+ }
+
+ if(retval == 0) {
+ System.out.print("\n");
+ for(row = 0; row < h; row++) {
+ for(col = 0; col < w; col++) {
+ int r = (buf[pitch * row + col] >> rshift) & 0xFF;
+ int g = (buf[pitch * row + col] >> gshift) & 0xFF;
+ int b = (buf[pitch * row + col] >> bshift) & 0xFF;
+ if(r < 0) r += 256; if(g < 0) g += 256; if(b < 0) b += 256;
+ System.out.format("%3d/%3d/%3d ", r, g, b);
+ }
+ System.out.print("\n");
+ }
+ }
+ return retval;
+ }
+
+ private static int checkImg(BufferedImage img, int pf,
+ int subsamp, TJScalingFactor sf, int flags) throws Exception {
+ WritableRaster wr = img.getRaster();
+ int imgType = img.getType();
+ if(imgType == BufferedImage.TYPE_INT_RGB
+ || imgType == BufferedImage.TYPE_INT_BGR
+ || imgType == BufferedImage.TYPE_INT_ARGB
+ || imgType == BufferedImage.TYPE_INT_ARGB_PRE) {
+ SinglePixelPackedSampleModel sm =
+ (SinglePixelPackedSampleModel)img.getSampleModel();
+ int pitch = sm.getScanlineStride();
+ DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
+ int[] buf = db.getData();
+ return checkIntBuf(buf, img.getWidth(), pitch, img.getHeight(), pf,
+ subsamp, sf, flags);
+ }
+ else {
+ ComponentSampleModel sm = (ComponentSampleModel)img.getSampleModel();
+ int pitch = sm.getScanlineStride();
+ DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
+ byte[] buf = db.getData();
+ return checkBuf(buf, img.getWidth(), pitch, img.getHeight(), pf, subsamp,
+ sf, flags);
+ }
+ }
+
+ private static int PAD(int v, int p) {
+ return ((v + (p) - 1) & (~((p) - 1)));
+ }
+
+ private static int checkBufYUV(byte[] buf, int size, int w, int h,
+ int subsamp) throws Exception {
+ int row, col;
+ int hsf = TJ.getMCUWidth(subsamp)/8, vsf = TJ.getMCUHeight(subsamp)/8;
+ int pw = PAD(w, hsf), ph = PAD(h, vsf);
+ int cw = pw / hsf, ch = ph / vsf;
+ int ypitch = PAD(pw, 4), uvpitch = PAD(cw, 4);
+ int retval = 1;
+ int correctsize = ypitch * ph
+ + (subsamp == TJ.SAMP_GRAY ? 0 : uvpitch * ch * 2);
+ int halfway = 16;
+
+ try {
+ if(size != correctsize)
+ throw new Exception("\nIncorrect size " + size + ". Should be "
+ + correctsize);
+
+ for(row = 0; row < ph; row++) {
+ for(col = 0; col < pw; col++) {
+ byte y = buf[ypitch * row + col];
+ if(((row / 8) + (col / 8)) % 2 == 0) {
+ if(row < halfway) checkVal255(row, col, y, "Y");
+ else checkVal0(row, col, y, "Y");
+ }
+ else {
+ if(row < halfway) checkVal(row, col, y, "Y", 76);
+ else checkVal(row, col, y, "Y", 226);
+ }
+ }
+ }
+ if(subsamp != TJ.SAMP_GRAY) {
+ halfway = 16 / vsf;
+ for(row = 0; row < ch; row++) {
+ for(col = 0; col < cw; col++) {
+ byte u = buf[ypitch * ph + (uvpitch * row + col)],
+ v = buf[ypitch * ph + uvpitch * ch + (uvpitch * row + col)];
+ if(((row * vsf / 8) + (col * hsf / 8)) % 2 == 0) {
+ checkVal(row, col, u, "U", 128);
+ checkVal(row, col, v, "V", 128);
+ }
+ else {
+ if(row < halfway) {
+ checkVal(row, col, u, "U", 85);
+ checkVal255(row, col, v, "V");
+ }
+ else {
+ checkVal0(row, col, u, "U");
+ checkVal(row, col, v, "V", 149);
+ }
+ }
+ }
+ }
+ }
+ }
+ catch(Exception e) {
+ System.out.println(e);
+ retval = 0;
+ }
+
+ if(retval == 0) {
+ for(row = 0; row < ph; row++) {
+ for(col = 0; col < pw; col++) {
+ int y = buf[ypitch * row + col];
+ if(y < 0) y += 256;
+ System.out.format("%3d ", y);
+ }
+ System.out.print("\n");
+ }
+ System.out.print("\n");
+ for(row = 0; row < ch; row++) {
+ for(col = 0; col < cw; col++) {
+ int u = buf[ypitch * ph + (uvpitch * row + col)];
+ if(u < 0) u += 256;
+ System.out.format("%3d ", u);
+ }
+ System.out.print("\n");
+ }
+ System.out.print("\n");
+ for(row = 0; row < ch; row++) {
+ for(col = 0; col < cw; col++) {
+ int v = buf[ypitch * ph + uvpitch * ch + (uvpitch * row + col)];
+ if(v < 0) v += 256;
+ System.out.format("%3d ", v);
+ }
+ System.out.print("\n");
+ }
+ System.out.print("\n");
+ }
+
+ return retval;
+ }
+
+ private static void writeJPEG(byte[] jpegBuf, int jpegBufSize,
+ String filename) throws Exception {
+ File file = new File(filename);
+ FileOutputStream fos = new FileOutputStream(file);
+ fos.write(jpegBuf, 0, jpegBufSize);
+ fos.close();
+ }
+
+ private static int compTest(TJCompressor tjc, byte[] dstBuf, int w,
+ int h, int pf, String baseName, int subsamp, int jpegQual,
+ int flags) throws Exception {
+ String tempstr;
+ byte[] srcBuf = null;
+ BufferedImage img = null;
+ String pfStr;
+ double t;
+ int size = 0, ps, imgType = pf;
+
+ if (bi) {
+ pf = biTypePF(imgType);
+ pfStr = biTypeStr(imgType);
+ }
+ else pfStr = pixFormatStr[pf];
+ ps = TJ.getPixelSize(pf);
+
+ System.out.print(pfStr + " ");
+ if(bi) System.out.print("(" + pixFormatStr[pf] + ") ");
+ if((flags & TJ.FLAG_BOTTOMUP) != 0) System.out.print("Bottom-Up");
+ else System.out.print("Top-Down ");
+ System.out.print(" -> " + subNameLong[subsamp] + " ");
+ if(yuv == YUVENCODE) System.out.print("YUV ... ");
+ else System.out.print("Q" + jpegQual + " ... ");
+
+ if(bi) {
+ img = new BufferedImage(w, h, imgType);
+ initImg(img, pf, flags);
+ tempstr = baseName + "_enc_" + pfStr + "_"
+ + (((flags & TJ.FLAG_BOTTOMUP) != 0) ? "BU" : "TD") + "_"
+ + subName[subsamp] + "_Q" + jpegQual + ".png";
+ File file = new File(tempstr);
+ ImageIO.write(img, "png", file);
+ }
+ else {
+ srcBuf = new byte[w * h * ps + 1];
+ initBuf(srcBuf, w, w * ps, h, pf, flags);
+ }
+ Arrays.fill(dstBuf, (byte)0);
+
+ t = getTime();
+ tjc.setSubsamp(subsamp);
+ tjc.setJPEGQuality(jpegQual);
+ if(bi) {
+ if(yuv == YUVENCODE) tjc.encodeYUV(img, dstBuf, flags);
+ else tjc.compress(img, dstBuf, flags);
+ }
+ else {
+ tjc.setSourceImage(srcBuf, w, 0, h, pf);
+ if(yuv == YUVENCODE) tjc.encodeYUV(dstBuf, flags);
+ else tjc.compress(dstBuf, flags);
+ }
+ size = tjc.getCompressedSize();
+ t = getTime() - t;
+
+ if(yuv == YUVENCODE)
+ tempstr = baseName + "_enc_" + pfStr + "_"
+ + (((flags & TJ.FLAG_BOTTOMUP) != 0) ? "BU" : "TD") + "_"
+ + subName[subsamp] + ".yuv";
+ else
+ tempstr = baseName + "_enc_" + pfStr + "_"
+ + (((flags & TJ.FLAG_BOTTOMUP) != 0) ? "BU" : "TD") + "_"
+ + subName[subsamp] + "_Q" + jpegQual + ".jpg";
+ writeJPEG(dstBuf, size, tempstr);
+
+ if(yuv == YUVENCODE) {
+ if(checkBufYUV(dstBuf, size, w, h, subsamp) == 1)
+ System.out.print("Passed.");
+ else {
+ System.out.print("FAILED!"); exitStatus = -1;
+ }
+ }
+ else System.out.print("Done.");
+ System.out.format(" %.6f ms\n", t * 1000.);
+ System.out.println(" Result in " + tempstr);
+
+ return size;
+ }
+
+ private static void decompTest(TJDecompressor tjd, byte[] jpegBuf,
+ int jpegSize, int w, int h, int pf, String baseName, int subsamp,
+ int flags, TJScalingFactor sf) throws Exception {
+ String pfStr, tempstr;
+ double t;
+ int scaledWidth = sf.getScaled(w);
+ int scaledHeight = sf.getScaled(h);
+ int temp1, temp2, imgType = pf;
+ BufferedImage img = null;
+ byte[] dstBuf = null;
+
+ if(yuv == YUVENCODE) return;
+
+ if (bi) {
+ pf = biTypePF(imgType);
+ pfStr = biTypeStr(imgType);
+ }
+ else pfStr = pixFormatStr[pf];
+
+ System.out.print("JPEG -> ");
+ if(yuv == YUVDECODE)
+ System.out.print("YUV " + subName[subsamp] + " ... ");
+ else {
+ System.out.print(pfStr + " ");
+ if(bi) System.out.print("(" + pixFormatStr[pf] + ") ");
+ if((flags & TJ.FLAG_BOTTOMUP) != 0) System.out.print("Bottom-Up ");
+ else System.out.print("Top-Down ");
+ if(!sf.isOne())
+ System.out.print(sf.getNum() + "/" + sf.getDenom() + " ... ");
+ else System.out.print("... ");
+ }
+
+ t = getTime();
+ tjd.setJPEGImage(jpegBuf, jpegSize);
+ if(tjd.getWidth() != w || tjd.getHeight() != h
+ || tjd.getSubsamp() != subsamp)
+ throw new Exception("Incorrect JPEG header");
+
+ temp1 = scaledWidth;
+ temp2 = scaledHeight;
+ temp1 = tjd.getScaledWidth(temp1, temp2);
+ temp2 = tjd.getScaledHeight(temp1, temp2);
+ if(temp1 != scaledWidth || temp2 != scaledHeight)
+ throw new Exception("Scaled size mismatch");
+
+ if(yuv == YUVDECODE) dstBuf = tjd.decompressToYUV(flags);
+ else {
+ if(bi)
+ img = tjd.decompress(scaledWidth, scaledHeight, imgType, flags);
+ else dstBuf = tjd.decompress(scaledWidth, 0, scaledHeight, pf, flags);
+ }
+ t = getTime() - t;
+
+ if(bi) {
+ tempstr = baseName + "_dec_" + pfStr + "_"
+ + (((flags & TJ.FLAG_BOTTOMUP) != 0) ? "BU" : "TD") + "_"
+ + subName[subsamp] + "_" + (double)sf.getNum() / (double)sf.getDenom()
+ + "x" + ".png";
+ File file = new File(tempstr);
+ ImageIO.write(img, "png", file);
+ }
+
+ if(yuv == YUVDECODE) {
+ if(checkBufYUV(dstBuf, dstBuf.length, w, h, subsamp) == 1)
+ System.out.print("Passed.");
+ else {
+ System.out.print("FAILED!"); exitStatus = -1;
+ }
+ }
+ else {
+ if((bi && checkImg(img, pf, subsamp, sf, flags) == 1)
+ || (!bi && checkBuf(dstBuf, scaledWidth, scaledWidth
+ * TJ.getPixelSize(pf), scaledHeight, pf, subsamp, sf, flags) == 1))
+ System.out.print("Passed.");
+ else {
+ System.out.print("FAILED!"); exitStatus = -1;
+ }
+ }
+ System.out.format(" %.6f ms\n", t * 1000.);
+ }
+
+ private static void decompTest(TJDecompressor tjd, byte[] jpegBuf,
+ int jpegSize, int w, int h, int pf, String baseName, int subsamp,
+ int flags) throws Exception {
+ int i;
+ if((subsamp == TJ.SAMP_444 || subsamp == TJ.SAMP_GRAY) && yuv == 0) {
+ TJScalingFactor sf[] = TJ.getScalingFactors();
+ for(i = 0; i < sf.length; i++)
+ decompTest(tjd, jpegBuf, jpegSize, w, h, pf, baseName, subsamp,
+ flags, sf[i]);
+ }
+ else
+ decompTest(tjd, jpegBuf, jpegSize, w, h, pf, baseName, subsamp,
+ flags, new TJScalingFactor(1, 1));
+ System.out.print("\n");
+ }
+
+ private static void doTest(int w, int h, int[] formats, int subsamp,
+ String baseName) throws Exception {
+ TJCompressor tjc = null;
+ TJDecompressor tjd = null;
+ int size;
+ byte[] dstBuf;
+
+ if(yuv == YUVENCODE) dstBuf = new byte[TJ.bufSizeYUV(w, h, subsamp)];
+ else dstBuf = new byte[TJ.bufSize(w, h, subsamp)];
+
+ try {
+ tjc = new TJCompressor();
+ tjd = new TJDecompressor();
+
+ for(int pf : formats) {
+ for(int i = 0; i < 2; i++) {
+ int flags = 0;
+ if(i == 1) {
+ if(yuv == YUVDECODE) {
+ tjc.close(); tjd.close(); return;
+ }
+ else flags |= TJ.FLAG_BOTTOMUP;
+ }
+ size = compTest(tjc, dstBuf, w, h, pf, baseName, subsamp, 100,
+ flags);
+ decompTest(tjd, dstBuf, size, w, h, pf, baseName, subsamp, flags);
+ }
+ }
+ }
+ catch(Exception e) {
+ if(tjc != null) tjc.close();
+ if(tjd != null) tjd.close();
+ throw e;
+ }
+ if(tjc != null) tjc.close();
+ if(tjd != null) tjd.close();
+ }
+
+ private static void bufSizeTest() throws Exception {
+ int w, h, i, subsamp;
+ byte[] srcBuf, jpegBuf;
+ TJCompressor tjc = null;
+ Random r = new Random();
+
+ try {
+ tjc = new TJCompressor();
+ System.out.println("Buffer size regression test");
+ for(subsamp = 0; subsamp < TJ.NUMSAMP; subsamp++) {
+ for(w = 1; w < 48; w++) {
+ int maxh = (w == 1) ? 2048 : 48;
+ for(h = 1; h < maxh; h++) {
+ if(h % 100 == 0)
+ System.out.format("%04d x %04d\b\b\b\b\b\b\b\b\b\b\b", w, h);
+ srcBuf = new byte[w * h * 4];
+ jpegBuf = new byte[TJ.bufSize(w, h, subsamp)];
+ for(i = 0; i < w * h * 4; i++) {
+ srcBuf[i] = (byte)(r.nextInt(2) * 255);
+ }
+ tjc.setSourceImage(srcBuf, w, 0, h, TJ.PF_BGRX);
+ tjc.setSubsamp(subsamp);
+ tjc.setJPEGQuality(100);
+ tjc.compress(jpegBuf, 0);
+
+ srcBuf = new byte[h * w * 4];
+ jpegBuf = new byte[TJ.bufSize(h, w, subsamp)];
+ for(i = 0; i < h * w * 4; i++) {
+ srcBuf[i] = (byte)(r.nextInt(2) * 255);
+ }
+ tjc.setSourceImage(srcBuf, h, 0, w, TJ.PF_BGRX);
+ tjc.compress(jpegBuf, 0);
+ }
+ }
+ }
+ System.out.println("Done. ");
+ }
+ catch(Exception e) {
+ if(tjc != null) tjc.close();
+ throw e;
+ }
+ if(tjc != null) tjc.close();
+ }
+
+ public static void main(String argv[]) {
+ try {
+ String testName = "javatest";
+ boolean doyuv = false;
+ for(int i = 0; i < argv.length; i++) {
+ if(argv[i].equalsIgnoreCase("-yuv")) doyuv = true;
+ if(argv[i].substring(0, 1).equalsIgnoreCase("-h")
+ || argv[i].equalsIgnoreCase("-?"))
+ usage();
+ if(argv[i].equalsIgnoreCase("-bi")) {
+ bi = true;
+ testName = "javabitest";
+ }
+ }
+ if(doyuv) yuv = YUVENCODE;
+ doTest(35, 39, bi ? _3byteFormatsBI : _3byteFormats, TJ.SAMP_444, testName);
+ doTest(39, 41, bi ? _4byteFormatsBI : _4byteFormats, TJ.SAMP_444, testName);
+ if(doyuv) {
+ doTest(41, 35, bi ? _3byteFormatsBI : _3byteFormats, TJ.SAMP_422,
+ testName);
+ doTest(35, 39, bi ? _4byteFormatsBI : _4byteFormats, TJ.SAMP_422,
+ testName);
+ doTest(39, 41, bi ? _3byteFormatsBI : _3byteFormats, TJ.SAMP_420,
+ testName);
+ doTest(41, 35, bi ? _4byteFormatsBI : _4byteFormats, TJ.SAMP_420,
+ testName);
+ doTest(35, 39, bi ? _3byteFormatsBI : _3byteFormats, TJ.SAMP_440,
+ testName);
+ doTest(39, 41, bi ? _4byteFormatsBI : _4byteFormats, TJ.SAMP_440,
+ testName);
+ }
+ doTest(35, 39, bi ? onlyGrayBI : onlyGray, TJ.SAMP_GRAY, testName);
+ doTest(39, 41, bi ? _3byteFormatsBI : _3byteFormats, TJ.SAMP_GRAY,
+ testName);
+ doTest(41, 35, bi ? _4byteFormatsBI : _4byteFormats, TJ.SAMP_GRAY,
+ testName);
+ if(!doyuv && !bi) bufSizeTest();
+ if(doyuv && !bi) {
+ yuv = YUVDECODE;
+ doTest(48, 48, onlyRGB, TJ.SAMP_444, "javatest_yuv0");
+ doTest(35, 39, onlyRGB, TJ.SAMP_444, "javatest_yuv1");
+ doTest(48, 48, onlyRGB, TJ.SAMP_422, "javatest_yuv0");
+ doTest(39, 41, onlyRGB, TJ.SAMP_422, "javatest_yuv1");
+ doTest(48, 48, onlyRGB, TJ.SAMP_420, "javatest_yuv0");
+ doTest(41, 35, onlyRGB, TJ.SAMP_420, "javatest_yuv1");
+ doTest(48, 48, onlyRGB, TJ.SAMP_440, "javatest_yuv0");
+ doTest(35, 39, onlyRGB, TJ.SAMP_440, "javatest_yuv1");
+ doTest(48, 48, onlyRGB, TJ.SAMP_GRAY, "javatest_yuv0");
+ doTest(35, 39, onlyRGB, TJ.SAMP_GRAY, "javatest_yuv1");
+ doTest(48, 48, onlyGray, TJ.SAMP_GRAY, "javatest_yuv0");
+ doTest(39, 41, onlyGray, TJ.SAMP_GRAY, "javatest_yuv1");
+ }
+ }
+ catch(Exception e) {
+ e.printStackTrace();
+ exitStatus = -1;
+ }
+ System.exit(exitStatus);
+ }
+}
diff --git a/java/doc/allclasses-frame.html b/java/doc/allclasses-frame.html
new file mode 100644
index 0000000..071e3a2
--- /dev/null
+++ b/java/doc/allclasses-frame.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+All Classes
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+
+
+</HEAD>
+
+<BODY BGCOLOR="white">
+<FONT size="+1" CLASS="FrameHeadingFont">
+<B>All Classes</B></FONT>
+<BR>
+
+<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
+<TR>
+<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJ</A>
+<BR>
+<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJCompressor</A>
+<BR>
+<A HREF="org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg" target="classFrame"><I>TJCustomFilter</I></A>
+<BR>
+<A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJDecompressor</A>
+<BR>
+<A HREF="org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJScalingFactor</A>
+<BR>
+<A HREF="org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJTransform</A>
+<BR>
+<A HREF="org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJTransformer</A>
+<BR>
+</FONT></TD>
+</TR>
+</TABLE>
+
+</BODY>
+</HTML>
diff --git a/java/doc/allclasses-noframe.html b/java/doc/allclasses-noframe.html
new file mode 100644
index 0000000..148fac6
--- /dev/null
+++ b/java/doc/allclasses-noframe.html
@@ -0,0 +1,43 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+All Classes
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+
+
+</HEAD>
+
+<BODY BGCOLOR="white">
+<FONT size="+1" CLASS="FrameHeadingFont">
+<B>All Classes</B></FONT>
+<BR>
+
+<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
+<TR>
+<TD NOWRAP><FONT CLASS="FrameItemFont"><A HREF="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<BR>
+<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<BR>
+<A HREF="org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><I>TJCustomFilter</I></A>
+<BR>
+<A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<BR>
+<A HREF="org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>
+<BR>
+<A HREF="org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<BR>
+<A HREF="org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A>
+<BR>
+</FONT></TD>
+</TR>
+</TABLE>
+
+</BODY>
+</HTML>
diff --git a/java/doc/constant-values.html b/java/doc/constant-values.html
new file mode 100644
index 0000000..8a6d8d9
--- /dev/null
+++ b/java/doc/constant-values.html
@@ -0,0 +1,380 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+Constant Field Values
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="Constant Field Values";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="index.html?constant-values.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="constant-values.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<CENTER>
+<H1>
+Constant Field Values</H1>
+</CENTER>
+<HR SIZE="4" NOSHADE>
+<B>Contents</B><UL>
+<LI><A HREF="#org.libjpegturbo">org.libjpegturbo.*</A>
+</UL>
+
+<A NAME="org.libjpegturbo"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left"><FONT SIZE="+2">
+org.libjpegturbo.*</FONT></TH>
+</TR>
+</TABLE>
+
+<P>
+
+<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left" COLSPAN="3">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.FLAG_BOTTOMUP"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP">FLAG_BOTTOMUP</A></CODE></TD>
+<TD ALIGN="right"><CODE>2</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.FLAG_FASTUPSAMPLE"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTUPSAMPLE">FLAG_FASTUPSAMPLE</A></CODE></TD>
+<TD ALIGN="right"><CODE>256</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.FLAG_FORCEMMX"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCEMMX">FLAG_FORCEMMX</A></CODE></TD>
+<TD ALIGN="right"><CODE>8</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.FLAG_FORCESSE"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCESSE">FLAG_FORCESSE</A></CODE></TD>
+<TD ALIGN="right"><CODE>16</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.FLAG_FORCESSE2"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCESSE2">FLAG_FORCESSE2</A></CODE></TD>
+<TD ALIGN="right"><CODE>32</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.FLAG_FORCESSE3"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCESSE3">FLAG_FORCESSE3</A></CODE></TD>
+<TD ALIGN="right"><CODE>128</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.NUMPF"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#NUMPF">NUMPF</A></CODE></TD>
+<TD ALIGN="right"><CODE>7</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.NUMSAMP"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#NUMSAMP">NUMSAMP</A></CODE></TD>
+<TD ALIGN="right"><CODE>5</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.PF_BGR"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</A></CODE></TD>
+<TD ALIGN="right"><CODE>1</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.PF_BGRX"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</A></CODE></TD>
+<TD ALIGN="right"><CODE>3</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.PF_GRAY"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY">PF_GRAY</A></CODE></TD>
+<TD ALIGN="right"><CODE>6</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.PF_RGB"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_RGB">PF_RGB</A></CODE></TD>
+<TD ALIGN="right"><CODE>0</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.PF_RGBX"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</A></CODE></TD>
+<TD ALIGN="right"><CODE>2</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.PF_XBGR"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR">PF_XBGR</A></CODE></TD>
+<TD ALIGN="right"><CODE>4</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.PF_XRGB"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB">PF_XRGB</A></CODE></TD>
+<TD ALIGN="right"><CODE>5</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.SAMP_420"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#SAMP_420">SAMP_420</A></CODE></TD>
+<TD ALIGN="right"><CODE>2</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.SAMP_422"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#SAMP_422">SAMP_422</A></CODE></TD>
+<TD ALIGN="right"><CODE>1</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.SAMP_440"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#SAMP_440">SAMP_440</A></CODE></TD>
+<TD ALIGN="right"><CODE>4</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.SAMP_444"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#SAMP_444">SAMP_444</A></CODE></TD>
+<TD ALIGN="right"><CODE>0</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJ.SAMP_GRAY"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJ.html#SAMP_GRAY">SAMP_GRAY</A></CODE></TD>
+<TD ALIGN="right"><CODE>3</CODE></TD>
+</TR>
+</FONT></TD>
+</TR>
+</TABLE>
+
+<P>
+
+<P>
+
+<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left" COLSPAN="3">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.NUMOP"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#NUMOP">NUMOP</A></CODE></TD>
+<TD ALIGN="right"><CODE>8</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OP_HFLIP"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OP_HFLIP">OP_HFLIP</A></CODE></TD>
+<TD ALIGN="right"><CODE>1</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OP_NONE"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE">OP_NONE</A></CODE></TD>
+<TD ALIGN="right"><CODE>0</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OP_ROT180"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OP_ROT180">OP_ROT180</A></CODE></TD>
+<TD ALIGN="right"><CODE>6</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OP_ROT270"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OP_ROT270">OP_ROT270</A></CODE></TD>
+<TD ALIGN="right"><CODE>7</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OP_ROT90"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OP_ROT90">OP_ROT90</A></CODE></TD>
+<TD ALIGN="right"><CODE>5</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OP_TRANSPOSE"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OP_TRANSPOSE">OP_TRANSPOSE</A></CODE></TD>
+<TD ALIGN="right"><CODE>3</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OP_TRANSVERSE"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OP_TRANSVERSE">OP_TRANSVERSE</A></CODE></TD>
+<TD ALIGN="right"><CODE>4</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OP_VFLIP"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OP_VFLIP">OP_VFLIP</A></CODE></TD>
+<TD ALIGN="right"><CODE>2</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OPT_CROP"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_CROP">OPT_CROP</A></CODE></TD>
+<TD ALIGN="right"><CODE>4</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OPT_GRAY"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_GRAY">OPT_GRAY</A></CODE></TD>
+<TD ALIGN="right"><CODE>8</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OPT_NOOUTPUT"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_NOOUTPUT">OPT_NOOUTPUT</A></CODE></TD>
+<TD ALIGN="right"><CODE>16</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OPT_PERFECT"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT">OPT_PERFECT</A></CODE></TD>
+<TD ALIGN="right"><CODE>1</CODE></TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform.OPT_TRIM"><!-- --></A><TD ALIGN="right"><FONT SIZE="-1">
+<CODE>public static final int</CODE></FONT></TD>
+<TD ALIGN="left"><CODE><A HREF="org/libjpegturbo/turbojpeg/TJTransform.html#OPT_TRIM">OPT_TRIM</A></CODE></TD>
+<TD ALIGN="right"><CODE>2</CODE></TD>
+</TR>
+</FONT></TD>
+</TR>
+</TABLE>
+
+<P>
+
+<P>
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="index.html?constant-values.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="constant-values.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/deprecated-list.html b/java/doc/deprecated-list.html
new file mode 100644
index 0000000..0e1178d
--- /dev/null
+++ b/java/doc/deprecated-list.html
@@ -0,0 +1,142 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+Deprecated List
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="Deprecated List";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Deprecated</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="index.html?deprecated-list.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="deprecated-list.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<CENTER>
+<H2>
+<B>Deprecated API</B></H2>
+</CENTER>
+<HR SIZE="4" NOSHADE>
+<B>Contents</B><UL>
+</UL>
+
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Deprecated</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="index.html?deprecated-list.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="deprecated-list.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/help-doc.html b/java/doc/help-doc.html
new file mode 100644
index 0000000..4c4b064
--- /dev/null
+++ b/java/doc/help-doc.html
@@ -0,0 +1,209 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+API Help
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="API Help";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="index.html?help-doc.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="help-doc.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<CENTER>
+<H1>
+How This API Document Is Organized</H1>
+</CENTER>
+This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.<H3>
+Package</H3>
+<BLOCKQUOTE>
+
+<P>
+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:<UL>
+<LI>Interfaces (italic)<LI>Classes<LI>Enums<LI>Exceptions<LI>Errors<LI>Annotation Types</UL>
+</BLOCKQUOTE>
+<H3>
+Class/Interface</H3>
+<BLOCKQUOTE>
+
+<P>
+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:<UL>
+<LI>Class inheritance diagram<LI>Direct Subclasses<LI>All Known Subinterfaces<LI>All Known Implementing Classes<LI>Class/interface declaration<LI>Class/interface description
+<P>
+<LI>Nested Class Summary<LI>Field Summary<LI>Constructor Summary<LI>Method Summary
+<P>
+<LI>Field Detail<LI>Constructor Detail<LI>Method Detail</UL>
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.</BLOCKQUOTE>
+</BLOCKQUOTE>
+<H3>
+Annotation Type</H3>
+<BLOCKQUOTE>
+
+<P>
+Each annotation type has its own separate page with the following sections:<UL>
+<LI>Annotation Type declaration<LI>Annotation Type description<LI>Required Element Summary<LI>Optional Element Summary<LI>Element Detail</UL>
+</BLOCKQUOTE>
+</BLOCKQUOTE>
+<H3>
+Enum</H3>
+<BLOCKQUOTE>
+
+<P>
+Each enum has its own separate page with the following sections:<UL>
+<LI>Enum declaration<LI>Enum description<LI>Enum Constant Summary<LI>Enum Constant Detail</UL>
+</BLOCKQUOTE>
+<H3>
+Tree (Class Hierarchy)</H3>
+<BLOCKQUOTE>
+There is a <A HREF="overview-tree.html">Class Hierarchy</A> page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with <code>java.lang.Object</code>. The interfaces do not inherit from <code>java.lang.Object</code>.<UL>
+<LI>When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.<LI>When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.</UL>
+</BLOCKQUOTE>
+<H3>
+Deprecated API</H3>
+<BLOCKQUOTE>
+The <A HREF="deprecated-list.html">Deprecated API</A> page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.</BLOCKQUOTE>
+<H3>
+Index</H3>
+<BLOCKQUOTE>
+The <A HREF="index-all.html">Index</A> contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.</BLOCKQUOTE>
+<H3>
+Prev/Next</H3>
+These links take you to the next or previous class, interface, package, or related page.<H3>
+Frames/No Frames</H3>
+These links show and hide the HTML frames. All pages are available with or without frames.
+<P>
+<H3>
+Serialized Form</H3>
+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
+<P>
+<H3>
+Constant Field Values</H3>
+The <a href="constant-values.html">Constant Field Values</a> page lists the static final fields and their values.
+<P>
+<FONT SIZE="-1">
+<EM>
+This help file applies to API documentation generated using the standard doclet.</EM>
+</FONT>
+<BR>
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Help</B></FONT> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="index.html?help-doc.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="help-doc.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/index-all.html b/java/doc/index-all.html
new file mode 100644
index 0000000..0b45436
--- /dev/null
+++ b/java/doc/index-all.html
@@ -0,0 +1,579 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+Index
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="./stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="Index";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="./org/libjpegturbo/turbojpeg/package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="./deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="./help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="./index.html?index-all.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="index-all.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="./allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="./allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<A HREF="#_B_">B</A> <A HREF="#_C_">C</A> <A HREF="#_D_">D</A> <A HREF="#_E_">E</A> <A HREF="#_F_">F</A> <A HREF="#_G_">G</A> <A HREF="#_H_">H</A> <A HREF="#_I_">I</A> <A HREF="#_J_">J</A> <A HREF="#_N_">N</A> <A HREF="#_O_">O</A> <A HREF="#_P_">P</A> <A HREF="#_S_">S</A> <A HREF="#_T_">T</A> <HR>
+<A NAME="_B_"><!-- --></A><H2>
+<B>B</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int, int)"><B>bufSize(int, int, int)</B></A> -
+Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Returns the maximum size of the buffer (in bytes) required to hold a JPEG
+ image with the given width and height, and level of chrominance
+ subsampling.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)"><B>bufSizeYUV(int, int, int)</B></A> -
+Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Returns the size of the buffer (in bytes) required to hold a YUV planar
+ image with the given width, height, and level of chrominance subsampling.
+</DL>
+<HR>
+<A NAME="_C_"><!-- --></A><H2>
+<B>C</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#cf"><B>cf</B></A> -
+Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Custom filter instance
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#close()"><B>close()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Free the native structures associated with this compressor instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#close()"><B>close()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Free the native structures associated with this decompressor instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[], int)"><B>compress(byte[], int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Compress the uncompressed source image associated with this compressor
+ instance and output a JPEG image to the given destination buffer.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)"><B>compress(int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Compress the uncompressed source image associated with this compressor
+ instance and return a buffer containing a JPEG image.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, byte[], int)"><B>compress(BufferedImage, byte[], int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Compress the uncompressed source image stored in <code>srcImage</code>
+ and output a JPEG image to the given destination buffer.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, int)"><B>compress(BufferedImage, int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Compress the uncompressed source image stored in <code>srcImage</code>
+ and return a buffer containing a JPEG image.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCustomFilter.html#customFilter(java.nio.ShortBuffer, java.awt.Rectangle, java.awt.Rectangle, int, int, org.libjpegturbo.turbojpeg.TJTransform)"><B>customFilter(ShortBuffer, Rectangle, Rectangle, int, int, TJTransform)</B></A> -
+Method in interface org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</A>
+<DD>A callback function that can be used to modify the DCT coefficients after
+ they are losslessly transformed but before they are transcoded to a new
+ JPEG file.
+</DL>
+<HR>
+<A NAME="_D_"><!-- --></A><H2>
+<B>D</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><B>decompress(byte[], int, int, int, int, int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Decompress the JPEG source image associated with this decompressor
+ instance and output a decompressed image to the given destination buffer.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int, int)"><B>decompress(int, int, int, int, int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Decompress the JPEG source image associated with this decompressor
+ instance and return a buffer containing the decompressed image.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)"><B>decompress(BufferedImage, int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Decompress the JPEG source image associated with this decompressor
+ instance and output a decompressed image to the given
+ <code>BufferedImage</code> instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int)"><B>decompress(int, int, int, int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Decompress the JPEG source image associated with this decompressor
+ instance and return a <code>BufferedImage</code> instance containing the
+ decompressed image.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)"><B>decompressToYUV(byte[], int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Decompress the JPEG source image associated with this decompressor
+ instance and output a YUV planar image to the given destination buffer.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)"><B>decompressToYUV(int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Decompress the JPEG source image associated with this decompressor
+ instance and return a buffer containing a YUV planar image.
+</DL>
+<HR>
+<A NAME="_E_"><!-- --></A><H2>
+<B>E</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><B>encodeYUV(byte[], int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Encode the uncompressed source image associated with this compressor
+ instance and output a YUV planar image to the given destination buffer.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)"><B>encodeYUV(int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Encode the uncompressed source image associated with this compressor
+ instance and return a buffer containing a YUV planar image.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, byte[], int)"><B>encodeYUV(BufferedImage, byte[], int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Encode the uncompressed source image stored in <code>srcImage</code>
+ and output a YUV planar image to the given destination buffer.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, int)"><B>encodeYUV(BufferedImage, int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Encode the uncompressed source image stored in <code>srcImage</code>
+ and return a buffer containing a YUV planar image.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#equals(org.libjpegturbo.turbojpeg.TJScalingFactor)"><B>equals(TJScalingFactor)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>
+<DD>Returns true or false, depending on whether this instance and
+ <code>other</code> have the same numerator and denominator.
+</DL>
+<HR>
+<A NAME="_F_"><!-- --></A><H2>
+<B>F</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#finalize()"><B>finalize()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()"><B>finalize()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP"><B>FLAG_BOTTOMUP</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>The uncompressed source/destination image is stored in bottom-up (Windows,
+ OpenGL) order, not top-down (X11) order.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTUPSAMPLE"><B>FLAG_FASTUPSAMPLE</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Use fast, inaccurate chrominance upsampling routines in the JPEG
+ decompressor (libjpeg and libjpeg-turbo versions only.)
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCEMMX"><B>FLAG_FORCEMMX</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Turn off CPU auto-detection and force TurboJPEG to use MMX code
+ (IPP and 32-bit libjpeg-turbo versions only.)
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCESSE"><B>FLAG_FORCESSE</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Turn off CPU auto-detection and force TurboJPEG to use SSE code
+ (32-bit IPP and 32-bit libjpeg-turbo versions only.)
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCESSE2"><B>FLAG_FORCESSE2</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Turn off CPU auto-detection and force TurboJPEG to use SSE2 code
+ (32-bit IPP and 32-bit libjpeg-turbo versions only.)
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCESSE3"><B>FLAG_FORCESSE3</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Turn off CPU auto-detection and force TurboJPEG to use SSE3 code
+(64-bit IPP version only.)
+</DL>
+<HR>
+<A NAME="_G_"><!-- --></A><H2>
+<B>G</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)"><B>getBlueOffset(int)</B></A> -
+Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>For the given pixel format, returns the number of bytes that the blue
+ component is offset from the start of the pixel.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()"><B>getCompressedSize()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Returns the size of the image (in bytes) generated by the most recent
+ compress/encode operation.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#getDenom()"><B>getDenom()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>
+<DD>Returns denominator
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getGreenOffset(int)"><B>getGreenOffset(int)</B></A> -
+Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>For the given pixel format, returns the number of bytes that the green
+ component is offset from the start of the pixel.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()"><B>getHeight()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Returns the height of the JPEG image associated with this decompressor
+ instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()"><B>getJPEGBuf()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Returns the JPEG image buffer associated with this decompressor instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()"><B>getJPEGSize()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Returns the size of the JPEG image (in bytes) associated with this
+ decompressor instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)"><B>getMCUHeight(int)</B></A> -
+Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Returns the MCU block height for the given level of chrominance
+ subsampling.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)"><B>getMCUWidth(int)</B></A> -
+Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Returns the MCU block width for the given level of chrominance
+ subsampling.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#getNum()"><B>getNum()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>
+<DD>Returns numerator
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)"><B>getPixelSize(int)</B></A> -
+Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Returns the pixel size (in bytes) of the given pixel format.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getRedOffset(int)"><B>getRedOffset(int)</B></A> -
+Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>For the given pixel format, returns the number of bytes that the red
+ component is offset from the start of the pixel.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><B>getScaled(int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>
+<DD>Returns the scaled value of <code>dimension</code>.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)"><B>getScaledHeight(int, int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Returns the height of the largest scaled down image that the TurboJPEG
+ decompressor can generate without exceeding the desired image width and
+ height.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)"><B>getScaledWidth(int, int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Returns the width of the largest scaled down image that the TurboJPEG
+ decompressor can generate without exceeding the desired image width and
+ height.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><B>getScalingFactors()</B></A> -
+Static method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Returns a list of fractional scaling factors that the JPEG decompressor in
+ this implementation of TurboJPEG supports.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()"><B>getSubsamp()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Returns the level of chrominance subsampling used in the JPEG image
+ associated with this decompressor instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#getTransformedSizes()"><B>getTransformedSizes()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A>
+<DD>Returns an array containing the sizes of the transformed JPEG images from
+ the most recent call to <A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>transform()</CODE></A>.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()"><B>getWidth()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Returns the width of the JPEG image associated with this decompressor
+ instance.
+</DL>
+<HR>
+<A NAME="_H_"><!-- --></A><H2>
+<B>H</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#handle"><B>handle</B></A> -
+Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>
+</DL>
+<HR>
+<A NAME="_I_"><!-- --></A><H2>
+<B>I</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#isOne()"><B>isOne()</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>
+<DD>Returns true or false, depending on whether this instance is equal to
+ 1/1.
+</DL>
+<HR>
+<A NAME="_J_"><!-- --></A><H2>
+<B>J</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBuf"><B>jpegBuf</B></A> -
+Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize"><B>jpegBufSize</B></A> -
+Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegHeight"><B>jpegHeight</B></A> -
+Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegSubsamp"><B>jpegSubsamp</B></A> -
+Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegWidth"><B>jpegWidth</B></A> -
+Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>
+</DL>
+<HR>
+<A NAME="_N_"><!-- --></A><H2>
+<B>N</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#NUMOP"><B>NUMOP</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>The number of lossless transform operations
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#NUMPF"><B>NUMPF</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>The number of pixel formats
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#NUMSAMP"><B>NUMSAMP</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>The number of chrominance subsampling options
+</DL>
+<HR>
+<A NAME="_O_"><!-- --></A><H2>
+<B>O</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#op"><B>op</B></A> -
+Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Transform operation (one of <code>OP_*</code>)
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OP_HFLIP"><B>OP_HFLIP</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Flip (mirror) image horizontally.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE"><B>OP_NONE</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Do not transform the position of the image pixels.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OP_ROT180"><B>OP_ROT180</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Rotate image 180 degrees.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OP_ROT270"><B>OP_ROT270</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Rotate image counter-clockwise by 90 degrees.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OP_ROT90"><B>OP_ROT90</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Rotate image clockwise by 90 degrees.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OP_TRANSPOSE"><B>OP_TRANSPOSE</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Transpose image (flip/mirror along upper left to lower right axis).
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OP_TRANSVERSE"><B>OP_TRANSVERSE</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Transverse transpose image (flip/mirror along upper right to lower left
+ axis).
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OP_VFLIP"><B>OP_VFLIP</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Flip (mirror) image vertically.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_CROP"><B>OPT_CROP</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>This option will enable lossless cropping.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_GRAY"><B>OPT_GRAY</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>This option will discard the color data in the input image and produce
+ a grayscale output image.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_NOOUTPUT"><B>OPT_NOOUTPUT</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>This option will prevent <A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>TJTransformer.transform()</CODE></A> from outputting a JPEG image for this
+ particular transform.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><B>OPT_PERFECT</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>This option will cause <A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>TJTransformer.transform()</CODE></A> to throw an exception if the transform is not
+ perfect.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#OPT_TRIM"><B>OPT_TRIM</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>This option will discard any partial MCU blocks that cannot be
+ transformed.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#options"><B>options</B></A> -
+Variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Transform options (bitwise OR of one or more of <code>OPT_*</code>)
+<DT><A HREF="./org/libjpegturbo/turbojpeg/package-summary.html"><B>org.libjpegturbo.turbojpeg</B></A> - package org.libjpegturbo.turbojpeg<DD> </DL>
+<HR>
+<A NAME="_P_"><!-- --></A><H2>
+<B>P</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_BGR"><B>PF_BGR</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>BGR pixel format.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX"><B>PF_BGRX</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>BGRX pixel format.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY"><B>PF_GRAY</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Grayscale pixel format.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_RGB"><B>PF_RGB</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>RGB pixel format.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX"><B>PF_RGBX</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>RGBX pixel format.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR"><B>PF_XBGR</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>XBGR pixel format.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB"><B>PF_XRGB</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>XRGB pixel format.
+</DL>
+<HR>
+<A NAME="_S_"><!-- --></A><H2>
+<B>S</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#SAMP_420"><B>SAMP_420</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>4:2:0 chrominance subsampling.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#SAMP_422"><B>SAMP_422</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>4:2:2 chrominance subsampling.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#SAMP_440"><B>SAMP_440</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>4:4:0 chrominance subsampling.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#SAMP_444"><B>SAMP_444</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>4:4:4 chrominance subsampling (no chrominance subsampling).
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#SAMP_GRAY"><B>SAMP_GRAY</B></A> -
+Static variable in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>Grayscale.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)"><B>setJPEGImage(byte[], int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Associate the JPEG image of length <code>imageSize</code> bytes stored in
+ <code>jpegImage</code> with this decompressor instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setJPEGQuality(int)"><B>setJPEGQuality(int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Set the JPEG image quality level for subsequent compress operations.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><B>setSourceImage(byte[], int, int, int, int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Associate an uncompressed source image with this compressor instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)"><B>setSubsamp(int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Set the level of chrominance subsampling for subsequent compress/encode
+ operations.
+</DL>
+<HR>
+<A NAME="_T_"><!-- --></A><H2>
+<B>T</B></H2>
+<DL>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><B>TJ</B></A> - Class in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>TurboJPEG utility class (cannot be instantiated)<DT><A HREF="./org/libjpegturbo/turbojpeg/TJ.html#TJ()"><B>TJ()</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A>
+<DD>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJCompressor</B></A> - Class in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>TurboJPEG compressor<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor()"><B>TJCompressor()</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Create a TurboJPEG compressor instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int)"><B>TJCompressor(byte[], int, int, int, int)</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A>
+<DD>Create a TurboJPEG compressor instance and associate the uncompressed
+ source image stored in <code>srcImage</code> with the newly-created
+ instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><B>TJCustomFilter</B></A> - Interface in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>Custom filter callback interface<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJDecompressor</B></A> - Class in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>TurboJPEG decompressor<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor()"><B>TJDecompressor()</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Create a TurboJPEG decompresssor instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[])"><B>TJDecompressor(byte[])</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Create a TurboJPEG decompressor instance and associate the JPEG image
+ stored in <code>jpegImage</code> with the newly-created instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[], int)"><B>TJDecompressor(byte[], int)</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>
+<DD>Create a TurboJPEG decompressor instance and associate the JPEG image
+ of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
+ with the newly-created instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJScalingFactor</B></A> - Class in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>Fractional scaling factor<DT><A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html#TJScalingFactor(int, int)"><B>TJScalingFactor(int, int)</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>
+<DD>
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><B>TJTransform</B></A> - Class in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>Lossless transform parameters<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform()"><B>TJTransform()</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Create a new lossless transform instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int, int, int, int, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)"><B>TJTransform(int, int, int, int, int, int, TJCustomFilter)</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Create a new lossless transform instance with the given parameters.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(java.awt.Rectangle, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)"><B>TJTransform(Rectangle, int, int, TJCustomFilter)</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>
+<DD>Create a new lossless transform instance with the given parameters.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg"><B>TJTransformer</B></A> - Class in <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html">org.libjpegturbo.turbojpeg</A><DD>TurboJPEG lossless transformer<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer()"><B>TJTransformer()</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A>
+<DD>Create a TurboJPEG lossless transformer instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[])"><B>TJTransformer(byte[])</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A>
+<DD>Create a TurboJPEG lossless transformer instance and associate the JPEG
+ image stored in <code>jpegImage</code> with the newly-created instance.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[], int)"><B>TJTransformer(byte[], int)</B></A> -
+Constructor for class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A>
+<DD>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.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><B>transform(byte[][], TJTransform[], int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A>
+<DD>Losslessly transform the JPEG image associated with this transformer
+ instance into one or more JPEG images stored in the given destination
+ buffers.
+<DT><A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html#transform(org.libjpegturbo.turbojpeg.TJTransform[], int)"><B>transform(TJTransform[], int)</B></A> -
+Method in class org.libjpegturbo.turbojpeg.<A HREF="./org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A>
+<DD>Losslessly transform the JPEG image associated with this transformer
+ instance and return an array of <A HREF="./org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJDecompressor</CODE></A> instances, each of
+ which has a transformed JPEG image associated with it.
+</DL>
+<HR>
+<A HREF="#_B_">B</A> <A HREF="#_C_">C</A> <A HREF="#_D_">D</A> <A HREF="#_E_">E</A> <A HREF="#_F_">F</A> <A HREF="#_G_">G</A> <A HREF="#_H_">H</A> <A HREF="#_I_">I</A> <A HREF="#_J_">J</A> <A HREF="#_N_">N</A> <A HREF="#_O_">O</A> <A HREF="#_P_">P</A> <A HREF="#_S_">S</A> <A HREF="#_T_">T</A>
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="./org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="./org/libjpegturbo/turbojpeg/package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="./deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="./help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="./index.html?index-all.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="index-all.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="./allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="./allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/index.html b/java/doc/index.html
new file mode 100644
index 0000000..a96eb27
--- /dev/null
+++ b/java/doc/index.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc on Mon Sep 19 23:46:08 CDT 2011-->
+<TITLE>
+Generated Documentation (Untitled)
+</TITLE>
+<SCRIPT type="text/javascript">
+ targetPage = "" + window.location.search;
+ if (targetPage != "" && targetPage != "undefined")
+ targetPage = targetPage.substring(1);
+ if (targetPage.indexOf(":") != -1)
+ targetPage = "undefined";
+ function loadFrames() {
+ if (targetPage != "" && targetPage != "undefined")
+ top.classFrame.location = top.targetPage;
+ }
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+</HEAD>
+<FRAMESET cols="20%,80%" title="" onLoad="top.loadFrames()">
+<FRAME src="allclasses-frame.html" name="packageFrame" title="All classes and interfaces (except non-static nested types)">
+<FRAME src="org/libjpegturbo/turbojpeg/package-summary.html" name="classFrame" title="Package, class and interface descriptions" scrolling="yes">
+<NOFRAMES>
+<H2>
+Frame Alert</H2>
+
+<P>
+This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
+<BR>
+Link to<A HREF="org/libjpegturbo/turbojpeg/package-summary.html">Non-frame version.</A>
+</NOFRAMES>
+</FRAMESET>
+</HTML>
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJ.html b/java/doc/org/libjpegturbo/turbojpeg/TJ.html
new file mode 100644
index 0000000..1119f02
--- /dev/null
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJ.html
@@ -0,0 +1,950 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+TJ
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="TJ";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV CLASS
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJ.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJ.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<!-- ======== START OF CLASS DATA ======== -->
+<H2>
+<FONT SIZE="-1">
+org.libjpegturbo.turbojpeg</FONT>
+<BR>
+Class TJ</H2>
+<PRE>
+java.lang.Object
+ <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>org.libjpegturbo.turbojpeg.TJ</B>
+</PRE>
+<HR>
+<DL>
+<DT><PRE>public final class <B>TJ</B><DT>extends java.lang.Object</DL>
+</PRE>
+
+<P>
+TurboJPEG utility class (cannot be instantiated)
+<P>
+
+<P>
+<HR>
+
+<P>
+<!-- =========== FIELD SUMMARY =========== -->
+
+<A NAME="field_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Field Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_BOTTOMUP">FLAG_BOTTOMUP</A></B></CODE>
+
+<BR>
+ The uncompressed source/destination image is stored in bottom-up (Windows,
+ OpenGL) order, not top-down (X11) order.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_FASTUPSAMPLE">FLAG_FASTUPSAMPLE</A></B></CODE>
+
+<BR>
+ Use fast, inaccurate chrominance upsampling routines in the JPEG
+ decompressor (libjpeg and libjpeg-turbo versions only.)</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCEMMX">FLAG_FORCEMMX</A></B></CODE>
+
+<BR>
+ Turn off CPU auto-detection and force TurboJPEG to use MMX code
+ (IPP and 32-bit libjpeg-turbo versions only.)</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCESSE">FLAG_FORCESSE</A></B></CODE>
+
+<BR>
+ Turn off CPU auto-detection and force TurboJPEG to use SSE code
+ (32-bit IPP and 32-bit libjpeg-turbo versions only.)</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCESSE2">FLAG_FORCESSE2</A></B></CODE>
+
+<BR>
+ Turn off CPU auto-detection and force TurboJPEG to use SSE2 code
+ (32-bit IPP and 32-bit libjpeg-turbo versions only.)</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#FLAG_FORCESSE3">FLAG_FORCESSE3</A></B></CODE>
+
+<BR>
+ Turn off CPU auto-detection and force TurboJPEG to use SSE3 code
+(64-bit IPP version only.)</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMPF">NUMPF</A></B></CODE>
+
+<BR>
+ The number of pixel formats</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#NUMSAMP">NUMSAMP</A></B></CODE>
+
+<BR>
+ The number of chrominance subsampling options</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGR">PF_BGR</A></B></CODE>
+
+<BR>
+ BGR pixel format.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_BGRX">PF_BGRX</A></B></CODE>
+
+<BR>
+ BGRX pixel format.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_GRAY">PF_GRAY</A></B></CODE>
+
+<BR>
+ Grayscale pixel format.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGB">PF_RGB</A></B></CODE>
+
+<BR>
+ RGB pixel format.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_RGBX">PF_RGBX</A></B></CODE>
+
+<BR>
+ RGBX pixel format.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_XBGR">PF_XBGR</A></B></CODE>
+
+<BR>
+ XBGR pixel format.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#PF_XRGB">PF_XRGB</A></B></CODE>
+
+<BR>
+ XRGB pixel format.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_420">SAMP_420</A></B></CODE>
+
+<BR>
+ 4:2:0 chrominance subsampling.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_422">SAMP_422</A></B></CODE>
+
+<BR>
+ 4:2:2 chrominance subsampling.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_440">SAMP_440</A></B></CODE>
+
+<BR>
+ 4:4:0 chrominance subsampling.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_444">SAMP_444</A></B></CODE>
+
+<BR>
+ 4:4:4 chrominance subsampling (no chrominance subsampling).</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_GRAY">SAMP_GRAY</A></B></CODE>
+
+<BR>
+ Grayscale.</TD>
+</TR>
+</TABLE>
+
+<!-- ======== CONSTRUCTOR SUMMARY ======== -->
+
+<A NAME="constructor_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Constructor Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#TJ()">TJ</A></B>()</CODE>
+
+<BR>
+ </TD>
+</TR>
+</TABLE>
+
+<!-- ========== METHOD SUMMARY =========== -->
+
+<A NAME="method_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Method Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int, int)">bufSize</A></B>(int width,
+ int height,
+ int jpegSubsamp)</CODE>
+
+<BR>
+ Returns the maximum size of the buffer (in bytes) required to hold a JPEG
+ image with the given width and height, and level of chrominance
+ subsampling.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)">bufSizeYUV</A></B>(int width,
+ int height,
+ int subsamp)</CODE>
+
+<BR>
+ Returns the size of the buffer (in bytes) required to hold a YUV planar
+ image with the given width, height, and level of chrominance subsampling.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getBlueOffset(int)">getBlueOffset</A></B>(int pixelFormat)</CODE>
+
+<BR>
+ For the given pixel format, returns the number of bytes that the blue
+ component is offset from the start of the pixel.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getGreenOffset(int)">getGreenOffset</A></B>(int pixelFormat)</CODE>
+
+<BR>
+ For the given pixel format, returns the number of bytes that the green
+ component is offset from the start of the pixel.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)">getMCUHeight</A></B>(int subsamp)</CODE>
+
+<BR>
+ Returns the MCU block height for the given level of chrominance
+ subsampling.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)">getMCUWidth</A></B>(int subsamp)</CODE>
+
+<BR>
+ Returns the MCU block width for the given level of chrominance
+ subsampling.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getPixelSize(int)">getPixelSize</A></B>(int pixelFormat)</CODE>
+
+<BR>
+ Returns the pixel size (in bytes) of the given pixel format.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getRedOffset(int)">getRedOffset</A></B>(int pixelFormat)</CODE>
+
+<BR>
+ For the given pixel format, returns the number of bytes that the red
+ component is offset from the start of the pixel.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static <A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>[]</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()">getScalingFactors</A></B>()</CODE>
+
+<BR>
+ Returns a list of fractional scaling factors that the JPEG decompressor in
+ this implementation of TurboJPEG supports.</TD>
+</TR>
+</TABLE>
+ <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
+</TR>
+</TABLE>
+
+<P>
+
+<!-- ============ FIELD DETAIL =========== -->
+
+<A NAME="field_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Field Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="NUMSAMP"><!-- --></A><H3>
+NUMSAMP</H3>
+<PRE>
+public static final int <B>NUMSAMP</B></PRE>
+<DL>
+<DD>The number of chrominance subsampling options
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.NUMSAMP">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="SAMP_444"><!-- --></A><H3>
+SAMP_444</H3>
+<PRE>
+public static final int <B>SAMP_444</B></PRE>
+<DL>
+<DD>4:4:4 chrominance subsampling (no chrominance subsampling). The JPEG
+ or YUV image will contain one chrominance component for every pixel in the
+ source image.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.SAMP_444">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="SAMP_422"><!-- --></A><H3>
+SAMP_422</H3>
+<PRE>
+public static final int <B>SAMP_422</B></PRE>
+<DL>
+<DD>4:2:2 chrominance subsampling. The JPEG or YUV image will contain one
+ chrominance component for every 2x1 block of pixels in the source image.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.SAMP_422">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="SAMP_420"><!-- --></A><H3>
+SAMP_420</H3>
+<PRE>
+public static final int <B>SAMP_420</B></PRE>
+<DL>
+<DD>4:2:0 chrominance subsampling. The JPEG or YUV image will contain one
+ chrominance component for every 2x2 block of pixels in the source image.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.SAMP_420">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="SAMP_GRAY"><!-- --></A><H3>
+SAMP_GRAY</H3>
+<PRE>
+public static final int <B>SAMP_GRAY</B></PRE>
+<DL>
+<DD>Grayscale. The JPEG or YUV image will contain no chrominance components.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.SAMP_GRAY">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="SAMP_440"><!-- --></A><H3>
+SAMP_440</H3>
+<PRE>
+public static final int <B>SAMP_440</B></PRE>
+<DL>
+<DD>4:4:0 chrominance subsampling. The JPEG or YUV image will contain one
+ chrominance component for every 1x2 block of pixels in the source image.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.SAMP_440">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="NUMPF"><!-- --></A><H3>
+NUMPF</H3>
+<PRE>
+public static final int <B>NUMPF</B></PRE>
+<DL>
+<DD>The number of pixel formats
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.NUMPF">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="PF_RGB"><!-- --></A><H3>
+PF_RGB</H3>
+<PRE>
+public static final int <B>PF_RGB</B></PRE>
+<DL>
+<DD>RGB pixel format. The red, green, and blue components in the image are
+ stored in 3-byte pixels in the order R, G, B from lowest to highest byte
+ address within each pixel.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_RGB">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="PF_BGR"><!-- --></A><H3>
+PF_BGR</H3>
+<PRE>
+public static final int <B>PF_BGR</B></PRE>
+<DL>
+<DD>BGR pixel format. The red, green, and blue components in the image are
+ stored in 3-byte pixels in the order B, G, R from lowest to highest byte
+ address within each pixel.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_BGR">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="PF_RGBX"><!-- --></A><H3>
+PF_RGBX</H3>
+<PRE>
+public static final int <B>PF_RGBX</B></PRE>
+<DL>
+<DD>RGBX pixel format. The red, green, and blue components in the image are
+ stored in 4-byte pixels in the order R, G, B from lowest to highest byte
+ address within each pixel.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_RGBX">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="PF_BGRX"><!-- --></A><H3>
+PF_BGRX</H3>
+<PRE>
+public static final int <B>PF_BGRX</B></PRE>
+<DL>
+<DD>BGRX pixel format. The red, green, and blue components in the image are
+ stored in 4-byte pixels in the order B, G, R from lowest to highest byte
+ address within each pixel.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_BGRX">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="PF_XBGR"><!-- --></A><H3>
+PF_XBGR</H3>
+<PRE>
+public static final int <B>PF_XBGR</B></PRE>
+<DL>
+<DD>XBGR pixel format. The red, green, and blue components in the image are
+ stored in 4-byte pixels in the order R, G, B from highest to lowest byte
+ address within each pixel.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_XBGR">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="PF_XRGB"><!-- --></A><H3>
+PF_XRGB</H3>
+<PRE>
+public static final int <B>PF_XRGB</B></PRE>
+<DL>
+<DD>XRGB pixel format. The red, green, and blue components in the image are
+ stored in 4-byte pixels in the order B, G, R from highest to lowest byte
+ address within each pixel.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_XRGB">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="PF_GRAY"><!-- --></A><H3>
+PF_GRAY</H3>
+<PRE>
+public static final int <B>PF_GRAY</B></PRE>
+<DL>
+<DD>Grayscale pixel format. Each 1-byte pixel represents a luminance
+ (brightness) level from 0 to 255.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.PF_GRAY">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="FLAG_BOTTOMUP"><!-- --></A><H3>
+FLAG_BOTTOMUP</H3>
+<PRE>
+public static final int <B>FLAG_BOTTOMUP</B></PRE>
+<DL>
+<DD>The uncompressed source/destination image is stored in bottom-up (Windows,
+ OpenGL) order, not top-down (X11) order.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_BOTTOMUP">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="FLAG_FORCEMMX"><!-- --></A><H3>
+FLAG_FORCEMMX</H3>
+<PRE>
+public static final int <B>FLAG_FORCEMMX</B></PRE>
+<DL>
+<DD>Turn off CPU auto-detection and force TurboJPEG to use MMX code
+ (IPP and 32-bit libjpeg-turbo versions only.)
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FORCEMMX">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="FLAG_FORCESSE"><!-- --></A><H3>
+FLAG_FORCESSE</H3>
+<PRE>
+public static final int <B>FLAG_FORCESSE</B></PRE>
+<DL>
+<DD>Turn off CPU auto-detection and force TurboJPEG to use SSE code
+ (32-bit IPP and 32-bit libjpeg-turbo versions only.)
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FORCESSE">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="FLAG_FORCESSE2"><!-- --></A><H3>
+FLAG_FORCESSE2</H3>
+<PRE>
+public static final int <B>FLAG_FORCESSE2</B></PRE>
+<DL>
+<DD>Turn off CPU auto-detection and force TurboJPEG to use SSE2 code
+ (32-bit IPP and 32-bit libjpeg-turbo versions only.)
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FORCESSE2">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="FLAG_FORCESSE3"><!-- --></A><H3>
+FLAG_FORCESSE3</H3>
+<PRE>
+public static final int <B>FLAG_FORCESSE3</B></PRE>
+<DL>
+<DD>Turn off CPU auto-detection and force TurboJPEG to use SSE3 code
+(64-bit IPP version only.)
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FORCESSE3">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="FLAG_FASTUPSAMPLE"><!-- --></A><H3>
+FLAG_FASTUPSAMPLE</H3>
+<PRE>
+public static final int <B>FLAG_FASTUPSAMPLE</B></PRE>
+<DL>
+<DD>Use fast, inaccurate chrominance upsampling routines in the JPEG
+ decompressor (libjpeg and libjpeg-turbo versions only.)
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJ.FLAG_FASTUPSAMPLE">Constant Field Values</A></DL>
+</DL>
+
+<!-- ========= CONSTRUCTOR DETAIL ======== -->
+
+<A NAME="constructor_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Constructor Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="TJ()"><!-- --></A><H3>
+TJ</H3>
+<PRE>
+public <B>TJ</B>()</PRE>
+<DL>
+</DL>
+
+<!-- ============ METHOD DETAIL ========== -->
+
+<A NAME="method_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Method Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="getMCUWidth(int)"><!-- --></A><H3>
+getMCUWidth</H3>
+<PRE>
+public static int <B>getMCUWidth</B>(int subsamp)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns the MCU block width for the given level of chrominance
+ subsampling.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>subsamp</CODE> - the level of chrominance subsampling (one of
+ <code>SAMP_*</code>)
+<DT><B>Returns:</B><DD>the MCU block width for the given level of chrominance subsampling
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getMCUHeight(int)"><!-- --></A><H3>
+getMCUHeight</H3>
+<PRE>
+public static int <B>getMCUHeight</B>(int subsamp)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns the MCU block height for the given level of chrominance
+ subsampling.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>subsamp</CODE> - the level of chrominance subsampling (one of
+ <code>SAMP_*</code>)
+<DT><B>Returns:</B><DD>the MCU block height for the given level of chrominance
+ subsampling
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getPixelSize(int)"><!-- --></A><H3>
+getPixelSize</H3>
+<PRE>
+public static int <B>getPixelSize</B>(int pixelFormat)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns the pixel size (in bytes) of the given pixel format.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>pixelFormat</CODE> - the pixel format (one of <code>PF_*</code>)
+<DT><B>Returns:</B><DD>the pixel size (in bytes) of the given pixel format
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getRedOffset(int)"><!-- --></A><H3>
+getRedOffset</H3>
+<PRE>
+public static int <B>getRedOffset</B>(int pixelFormat)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>For the given pixel format, returns the number of bytes that the red
+ component is offset from the start of the pixel. For instance, if a pixel
+ of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
+ then the red component will be
+ <code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>pixelFormat</CODE> - the pixel format (one of <code>PF_*</code>)
+<DT><B>Returns:</B><DD>the red offset for the given pixel format
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getGreenOffset(int)"><!-- --></A><H3>
+getGreenOffset</H3>
+<PRE>
+public static int <B>getGreenOffset</B>(int pixelFormat)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>For the given pixel format, returns the number of bytes that the green
+ component is offset from the start of the pixel. For instance, if a pixel
+ of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
+ then the green component will be
+ <code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>pixelFormat</CODE> - the pixel format (one of <code>PF_*</code>)
+<DT><B>Returns:</B><DD>the green offset for the given pixel format
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getBlueOffset(int)"><!-- --></A><H3>
+getBlueOffset</H3>
+<PRE>
+public static int <B>getBlueOffset</B>(int pixelFormat)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>For the given pixel format, returns the number of bytes that the blue
+ component is offset from the start of the pixel. For instance, if a pixel
+ of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
+ then the blue component will be
+ <code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>pixelFormat</CODE> - the pixel format (one of <code>PF_*</code>)
+<DT><B>Returns:</B><DD>the blue offset for the given pixel format
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="bufSize(int, int, int)"><!-- --></A><H3>
+bufSize</H3>
+<PRE>
+public static int <B>bufSize</B>(int width,
+ int height,
+ int jpegSubsamp)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns the maximum size of the buffer (in bytes) required to hold a JPEG
+ image with the given width and height, and level of chrominance
+ subsampling.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>width</CODE> - the width (in pixels) of the JPEG image<DD><CODE>height</CODE> - the height (in pixels) of the JPEG image<DD><CODE>jpegSubsamp</CODE> - the level of chrominance subsampling to be used when
+ generating the JPEG image (one of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.SAMP_*</CODE></A>)
+<DT><B>Returns:</B><DD>the maximum size of the buffer (in bytes) required to hold a JPEG
+ image with the given width and height, and level of chrominance
+ subsampling
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="bufSizeYUV(int, int, int)"><!-- --></A><H3>
+bufSizeYUV</H3>
+<PRE>
+public static int <B>bufSizeYUV</B>(int width,
+ int height,
+ int subsamp)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns the size of the buffer (in bytes) required to hold a YUV planar
+ image with the given width, height, and level of chrominance subsampling.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>width</CODE> - the width (in pixels) of the YUV image<DD><CODE>height</CODE> - the height (in pixels) of the YUV image<DD><CODE>subsamp</CODE> - the level of chrominance subsampling used in the YUV
+ image (one of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.SAMP_*</CODE></A>)
+<DT><B>Returns:</B><DD>the size of the buffer (in bytes) required to hold a YUV planar
+ image with the given width, height, and level of chrominance subsampling
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getScalingFactors()"><!-- --></A><H3>
+getScalingFactors</H3>
+<PRE>
+public static <A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A>[] <B>getScalingFactors</B>()
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns a list of fractional scaling factors that the JPEG decompressor in
+ this implementation of TurboJPEG supports.
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>a list of fractional scaling factors that the JPEG decompressor in
+ this implementation of TurboJPEG supports
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<!-- ========= END OF CLASS DATA ========= -->
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV CLASS
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJ.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJ.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html b/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html
new file mode 100644
index 0000000..9c3479a
--- /dev/null
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJCompressor.html
@@ -0,0 +1,696 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+TJCompressor
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="TJCompressor";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJCompressor.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJCompressor.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<!-- ======== START OF CLASS DATA ======== -->
+<H2>
+<FONT SIZE="-1">
+org.libjpegturbo.turbojpeg</FONT>
+<BR>
+Class TJCompressor</H2>
+<PRE>
+java.lang.Object
+ <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>org.libjpegturbo.turbojpeg.TJCompressor</B>
+</PRE>
+<HR>
+<DL>
+<DT><PRE>public class <B>TJCompressor</B><DT>extends java.lang.Object</DL>
+</PRE>
+
+<P>
+TurboJPEG compressor
+<P>
+
+<P>
+<HR>
+
+<P>
+
+<!-- ======== CONSTRUCTOR SUMMARY ======== -->
+
+<A NAME="constructor_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Constructor Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor()">TJCompressor</A></B>()</CODE>
+
+<BR>
+ Create a TurboJPEG compressor instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#TJCompressor(byte[], int, int, int, int)">TJCompressor</A></B>(byte[] srcImage,
+ int width,
+ int pitch,
+ int height,
+ int pixelFormat)</CODE>
+
+<BR>
+ Create a TurboJPEG compressor instance and associate the uncompressed
+ source image stored in <code>srcImage</code> with the newly-created
+ instance.</TD>
+</TR>
+</TABLE>
+
+<!-- ========== METHOD SUMMARY =========== -->
+
+<A NAME="method_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Method Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#close()">close</A></B>()</CODE>
+
+<BR>
+ Free the native structures associated with this compressor instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, byte[], int)">compress</A></B>(java.awt.image.BufferedImage srcImage,
+ byte[] dstBuf,
+ int flags)</CODE>
+
+<BR>
+ Compress the uncompressed source image stored in <code>srcImage</code>
+ and output a JPEG image to the given destination buffer.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> byte[]</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(java.awt.image.BufferedImage, int)">compress</A></B>(java.awt.image.BufferedImage srcImage,
+ int flags)</CODE>
+
+<BR>
+ Compress the uncompressed source image stored in <code>srcImage</code>
+ and return a buffer containing a JPEG image.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(byte[], int)">compress</A></B>(byte[] dstBuf,
+ int flags)</CODE>
+
+<BR>
+ Compress the uncompressed source image associated with this compressor
+ instance and output a JPEG image to the given destination buffer.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> byte[]</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#compress(int)">compress</A></B>(int flags)</CODE>
+
+<BR>
+ Compress the uncompressed source image associated with this compressor
+ instance and return a buffer containing a JPEG image.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, byte[], int)">encodeYUV</A></B>(java.awt.image.BufferedImage srcImage,
+ byte[] dstBuf,
+ int flags)</CODE>
+
+<BR>
+ Encode the uncompressed source image stored in <code>srcImage</code>
+ and output a YUV planar image to the given destination buffer.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> byte[]</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(java.awt.image.BufferedImage, int)">encodeYUV</A></B>(java.awt.image.BufferedImage srcImage,
+ int flags)</CODE>
+
+<BR>
+ Encode the uncompressed source image stored in <code>srcImage</code>
+ and return a buffer containing a YUV planar image.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)">encodeYUV</A></B>(byte[] dstBuf,
+ int flags)</CODE>
+
+<BR>
+ Encode the uncompressed source image associated with this compressor
+ instance and output a YUV planar image to the given destination buffer.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> byte[]</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(int)">encodeYUV</A></B>(int flags)</CODE>
+
+<BR>
+ Encode the uncompressed source image associated with this compressor
+ instance and return a buffer containing a YUV planar image.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>protected void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#finalize()">finalize</A></B>()</CODE>
+
+<BR>
+ </TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()">getCompressedSize</A></B>()</CODE>
+
+<BR>
+ Returns the size of the image (in bytes) generated by the most recent
+ compress/encode operation.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setJPEGQuality(int)">setJPEGQuality</A></B>(int quality)</CODE>
+
+<BR>
+ Set the JPEG image quality level for subsequent compress operations.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)">setSourceImage</A></B>(byte[] srcImage,
+ int width,
+ int pitch,
+ int height,
+ int pixelFormat)</CODE>
+
+<BR>
+ Associate an uncompressed source image with this compressor instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSubsamp(int)">setSubsamp</A></B>(int newSubsamp)</CODE>
+
+<BR>
+ Set the level of chrominance subsampling for subsequent compress/encode
+ operations.</TD>
+</TR>
+</TABLE>
+ <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
+</TR>
+</TABLE>
+
+<P>
+
+<!-- ========= CONSTRUCTOR DETAIL ======== -->
+
+<A NAME="constructor_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Constructor Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="TJCompressor()"><!-- --></A><H3>
+TJCompressor</H3>
+<PRE>
+public <B>TJCompressor</B>()
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Create a TurboJPEG compressor instance.
+<P>
+<DL>
+
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DL>
+<HR>
+
+<A NAME="TJCompressor(byte[], int, int, int, int)"><!-- --></A><H3>
+TJCompressor</H3>
+<PRE>
+public <B>TJCompressor</B>(byte[] srcImage,
+ int width,
+ int pitch,
+ int height,
+ int pixelFormat)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Create a TurboJPEG compressor instance and associate the uncompressed
+ source image stored in <code>srcImage</code> with the newly-created
+ instance.
+<P>
+<DL>
+<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><CODE>setSourceImage(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>width</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><CODE>setSourceImage(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>pitch</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><CODE>setSourceImage(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>height</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><CODE>setSourceImage(byte[], int, int, int, int)</CODE></A> for description<DD><CODE>pixelFormat</CODE> - see <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#setSourceImage(byte[], int, int, int, int)"><CODE>setSourceImage(byte[], int, int, int, int)</CODE></A> for description
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DL>
+
+<!-- ============ METHOD DETAIL ========== -->
+
+<A NAME="method_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Method Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="setSourceImage(byte[], int, int, int, int)"><!-- --></A><H3>
+setSourceImage</H3>
+<PRE>
+public void <B>setSourceImage</B>(byte[] srcImage,
+ int width,
+ int pitch,
+ int height,
+ int pixelFormat)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Associate an uncompressed source image with this compressor instance.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - image buffer containing RGB or grayscale pixels to be
+ compressed<DD><CODE>width</CODE> - width (in pixels) of the source image<DD><CODE>pitch</CODE> - bytes per line of the source image. Normally, this should be
+ <code>width * TJ.pixelSize(pixelFormat)</code> if the source image is
+ unpadded, but you can use this parameter to, for instance, specify that
+ the scanlines in the source image are padded to 4-byte boundaries, 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 *
+ TJ.pixelSize(pixelFormat)</code>.<DD><CODE>height</CODE> - height (in pixels) of the source image<DD><CODE>pixelFormat</CODE> - pixel format of the source image (one of
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="setSubsamp(int)"><!-- --></A><H3>
+setSubsamp</H3>
+<PRE>
+public void <B>setSubsamp</B>(int newSubsamp)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Set the level of chrominance subsampling for subsequent compress/encode
+ operations.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>newSubsamp</CODE> - the new level of chrominance subsampling (one of
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.SAMP_*</CODE></A>)
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="setJPEGQuality(int)"><!-- --></A><H3>
+setJPEGQuality</H3>
+<PRE>
+public void <B>setJPEGQuality</B>(int quality)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Set the JPEG image quality level for subsequent compress operations.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>quality</CODE> - the new JPEG image quality level (1 to 100, 1 = worst,
+ 100 = best)
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="compress(byte[], int)"><!-- --></A><H3>
+compress</H3>
+<PRE>
+public void <B>compress</B>(byte[] dstBuf,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Compress the uncompressed source image associated with this compressor
+ instance and output a JPEG image to the given destination buffer.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer which will receive the JPEG image. Use
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int, int)"><CODE>TJ.bufSize(int, int, int)</CODE></A> to determine the maximum size for this buffer based on
+ the image width and height.<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="compress(int)"><!-- --></A><H3>
+compress</H3>
+<PRE>
+public byte[] <B>compress</B>(int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Compress the uncompressed source image associated with this compressor
+ instance and return a buffer containing a JPEG image.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Returns:</B><DD>a buffer containing a JPEG image. The length of this buffer will
+ not be equal to the size of the JPEG image. Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()"><CODE>getCompressedSize()</CODE></A> to obtain the size of the JPEG image.
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="compress(java.awt.image.BufferedImage, byte[], int)"><!-- --></A><H3>
+compress</H3>
+<PRE>
+public void <B>compress</B>(java.awt.image.BufferedImage srcImage,
+ byte[] dstBuf,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Compress the uncompressed source image stored in <code>srcImage</code>
+ and output a JPEG image to the given destination buffer.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
+ grayscale pixels to be compressed<DD><CODE>dstBuf</CODE> - buffer which will receive the JPEG image. Use
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int, int)"><CODE>TJ.bufSize(int, int, int)</CODE></A> to determine the maximum size for this buffer based on
+ the image width and height.<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="compress(java.awt.image.BufferedImage, int)"><!-- --></A><H3>
+compress</H3>
+<PRE>
+public byte[] <B>compress</B>(java.awt.image.BufferedImage srcImage,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Compress the uncompressed source image stored in <code>srcImage</code>
+ and return a buffer containing a JPEG image.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
+ grayscale pixels to be compressed<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Returns:</B><DD>a buffer containing a JPEG image. The length of this buffer will
+ not be equal to the size of the JPEG image. Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#getCompressedSize()"><CODE>getCompressedSize()</CODE></A> to obtain the size of the JPEG image.
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="encodeYUV(byte[], int)"><!-- --></A><H3>
+encodeYUV</H3>
+<PRE>
+public void <B>encodeYUV</B>(byte[] dstBuf,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Encode the uncompressed source image associated with this compressor
+ instance and output a YUV planar image to the given destination buffer.
+ This method uses the accelerated color conversion routines in
+ TurboJPEG's underlying codec to produce a planar YUV image that is
+ suitable for direct video display. Specifically, if the chrominance
+ components are subsampled along the horizontal dimension, then the width
+ of the luminance plane is padded to 2 in the output image (same goes for
+ the height of the luminance plane, if the chrominance components are
+ subsampled along the vertical dimension.) Also, each line of each plane
+ in the output image is padded to 4 bytes. Although this will work with
+ any subsampling option, it is really only useful in combination with
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#SAMP_420"><CODE>TJ.SAMP_420</CODE></A>, which produces an image compatible with the I420 (AKA
+ "YUV420P") format.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer which will receive the YUV planar image. Use
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)"><CODE>TJ.bufSizeYUV(int, int, int)</CODE></A> to determine the appropriate size for this buffer
+ based on the image width, height, and level of chrominance subsampling.<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="encodeYUV(int)"><!-- --></A><H3>
+encodeYUV</H3>
+<PRE>
+public byte[] <B>encodeYUV</B>(int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Encode the uncompressed source image associated with this compressor
+ instance and return a buffer containing a YUV planar image. See
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><CODE>encodeYUV(byte[], int)</CODE></A> for more detail.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Returns:</B><DD>a buffer containing a YUV planar image
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="encodeYUV(java.awt.image.BufferedImage, byte[], int)"><!-- --></A><H3>
+encodeYUV</H3>
+<PRE>
+public void <B>encodeYUV</B>(java.awt.image.BufferedImage srcImage,
+ byte[] dstBuf,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Encode the uncompressed source image stored in <code>srcImage</code>
+ and output a YUV planar image to the given destination buffer. See
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><CODE>encodeYUV(byte[], int)</CODE></A> for more detail.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
+ grayscale pixels to be encoded<DD><CODE>dstBuf</CODE> - buffer which will receive the YUV planar image. Use
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)"><CODE>TJ.bufSizeYUV(int, int, int)</CODE></A> to determine the appropriate size for this buffer
+ based on the image width, height, and level of chrominance subsampling.<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="encodeYUV(java.awt.image.BufferedImage, int)"><!-- --></A><H3>
+encodeYUV</H3>
+<PRE>
+public byte[] <B>encodeYUV</B>(java.awt.image.BufferedImage srcImage,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Encode the uncompressed source image stored in <code>srcImage</code>
+ and return a buffer containing a YUV planar image. See
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><CODE>encodeYUV(byte[], int)</CODE></A> for more detail.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>srcImage</CODE> - a <code>BufferedImage</code> instance containing RGB or
+ grayscale pixels to be encoded<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Returns:</B><DD>a buffer containing a YUV planar image
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getCompressedSize()"><!-- --></A><H3>
+getCompressedSize</H3>
+<PRE>
+public int <B>getCompressedSize</B>()</PRE>
+<DL>
+<DD>Returns the size of the image (in bytes) generated by the most recent
+ compress/encode operation.
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>the size of the image (in bytes) generated by the most recent
+ compress/encode operation</DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="close()"><!-- --></A><H3>
+close</H3>
+<PRE>
+public void <B>close</B>()
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Free the native structures associated with this compressor instance.
+<P>
+<DD><DL>
+
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="finalize()"><!-- --></A><H3>
+finalize</H3>
+<PRE>
+protected void <B>finalize</B>()
+ throws java.lang.Throwable</PRE>
+<DL>
+<DD><DL>
+<DT><B>Overrides:</B><DD><CODE>finalize</CODE> in class <CODE>java.lang.Object</CODE></DL>
+</DD>
+<DD><DL>
+
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Throwable</CODE></DL>
+</DD>
+</DL>
+<!-- ========= END OF CLASS DATA ========= -->
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJCompressor.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJCompressor.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html b/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html
new file mode 100644
index 0000000..d88fcc6
--- /dev/null
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJCustomFilter.html
@@ -0,0 +1,240 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+TJCustomFilter
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="TJCustomFilter";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJCustomFilter.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJCustomFilter.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<!-- ======== START OF CLASS DATA ======== -->
+<H2>
+<FONT SIZE="-1">
+org.libjpegturbo.turbojpeg</FONT>
+<BR>
+Interface TJCustomFilter</H2>
+<HR>
+<DL>
+<DT><PRE>public interface <B>TJCustomFilter</B></DL>
+</PRE>
+
+<P>
+Custom filter callback interface
+<P>
+
+<P>
+<HR>
+
+<P>
+
+<!-- ========== METHOD SUMMARY =========== -->
+
+<A NAME="method_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Method Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html#customFilter(java.nio.ShortBuffer, java.awt.Rectangle, java.awt.Rectangle, int, int, org.libjpegturbo.turbojpeg.TJTransform)">customFilter</A></B>(java.nio.ShortBuffer coeffBuffer,
+ java.awt.Rectangle bufferRegion,
+ java.awt.Rectangle planeRegion,
+ int componentID,
+ int transformID,
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A> transform)</CODE>
+
+<BR>
+ A callback function that can be used to modify the DCT coefficients after
+ they are losslessly transformed but before they are transcoded to a new
+ JPEG file.</TD>
+</TR>
+</TABLE>
+
+<P>
+
+<!-- ============ METHOD DETAIL ========== -->
+
+<A NAME="method_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Method Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="customFilter(java.nio.ShortBuffer, java.awt.Rectangle, java.awt.Rectangle, int, int, org.libjpegturbo.turbojpeg.TJTransform)"><!-- --></A><H3>
+customFilter</H3>
+<PRE>
+void <B>customFilter</B>(java.nio.ShortBuffer coeffBuffer,
+ java.awt.Rectangle bufferRegion,
+ java.awt.Rectangle planeRegion,
+ int componentID,
+ int transformID,
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A> transform)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>A callback function that can be used to modify the DCT coefficients after
+ they are losslessly transformed but before they are transcoded to a new
+ JPEG file. This allows for custom filters or other transformations to be
+ applied in the frequency domain.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>coeffBuffer</CODE> - a buffer containing transformed DCT coefficients.
+ (NOTE: this buffer is not guaranteed to be valid once the callback
+ returns, so applications wishing to hand off the DCT coefficients to
+ another function or library should make a copy of them within the body of
+ the callback.)<DD><CODE>bufferRegion</CODE> - rectangle containing the width and height of
+ <code>coeffBuffer</code> as well as its offset relative to the component
+ plane. TurboJPEG implementations may choose to split each component plane
+ into multiple DCT coefficient buffers and call the callback function once
+ for each buffer.<DD><CODE>planeRegion</CODE> - rectangle containing the width and height of the
+ component plane to which <code>coeffBuffer</code> belongs<DD><CODE>componentID</CODE> - ID number of the component plane to which
+ <code>coeffBuffer</code>belongs (Y, Cb, and Cr have, respectively, ID's of
+ 0, 1, and 2 in typical JPEG images.)<DD><CODE>transformID</CODE> - ID number of the transformed image to which
+ <code>coeffBuffer</code> belongs. This is the same as the index of the
+ transform in the transforms array that was passed to <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>TJTransformer.transform()</CODE></A>.<DD><CODE>transform</CODE> - a <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJTransform</CODE></A> instance that specifies the
+ parameters and/or cropping region for this transform
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<!-- ========= END OF CLASS DATA ========= -->
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJCustomFilter.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJCustomFilter.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html
new file mode 100644
index 0000000..d8ede5e
--- /dev/null
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJDecompressor.html
@@ -0,0 +1,948 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+TJDecompressor
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="TJDecompressor";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJDecompressor.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJDecompressor.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<!-- ======== START OF CLASS DATA ======== -->
+<H2>
+<FONT SIZE="-1">
+org.libjpegturbo.turbojpeg</FONT>
+<BR>
+Class TJDecompressor</H2>
+<PRE>
+java.lang.Object
+ <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>org.libjpegturbo.turbojpeg.TJDecompressor</B>
+</PRE>
+<DL>
+<DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A></DD>
+</DL>
+<HR>
+<DL>
+<DT><PRE>public class <B>TJDecompressor</B><DT>extends java.lang.Object</DL>
+</PRE>
+
+<P>
+TurboJPEG decompressor
+<P>
+
+<P>
+<HR>
+
+<P>
+<!-- =========== FIELD SUMMARY =========== -->
+
+<A NAME="field_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Field Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>protected long</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#handle">handle</A></B></CODE>
+
+<BR>
+ </TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>protected byte[]</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBuf">jpegBuf</A></B></CODE>
+
+<BR>
+ </TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>protected int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize">jpegBufSize</A></B></CODE>
+
+<BR>
+ </TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>protected int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegHeight">jpegHeight</A></B></CODE>
+
+<BR>
+ </TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>protected int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegSubsamp">jpegSubsamp</A></B></CODE>
+
+<BR>
+ </TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>protected int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegWidth">jpegWidth</A></B></CODE>
+
+<BR>
+ </TD>
+</TR>
+</TABLE>
+
+<!-- ======== CONSTRUCTOR SUMMARY ======== -->
+
+<A NAME="constructor_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Constructor Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor()">TJDecompressor</A></B>()</CODE>
+
+<BR>
+ Create a TurboJPEG decompresssor instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[])">TJDecompressor</A></B>(byte[] jpegImage)</CODE>
+
+<BR>
+ Create a TurboJPEG decompressor instance and associate the JPEG image
+ stored in <code>jpegImage</code> with the newly-created instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#TJDecompressor(byte[], int)">TJDecompressor</A></B>(byte[] jpegImage,
+ int imageSize)</CODE>
+
+<BR>
+ Create a TurboJPEG decompressor instance and associate the JPEG image
+ of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
+ with the newly-created instance.</TD>
+</TR>
+</TABLE>
+
+<!-- ========== METHOD SUMMARY =========== -->
+
+<A NAME="method_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Method Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#close()">close</A></B>()</CODE>
+
+<BR>
+ Free the native structures associated with this decompressor instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)">decompress</A></B>(java.awt.image.BufferedImage dstImage,
+ int flags)</CODE>
+
+<BR>
+ Decompress the JPEG source image associated with this decompressor
+ instance and output a decompressed image to the given
+ <code>BufferedImage</code> instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">decompress</A></B>(byte[] dstBuf,
+ int desiredWidth,
+ int pitch,
+ int desiredHeight,
+ int pixelFormat,
+ int flags)</CODE>
+
+<BR>
+ Decompress the JPEG source image associated with this decompressor
+ instance and output a decompressed image to the given destination buffer.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> java.awt.image.BufferedImage</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int)">decompress</A></B>(int desiredWidth,
+ int desiredHeight,
+ int bufferedImageType,
+ int flags)</CODE>
+
+<BR>
+ Decompress the JPEG source image associated with this decompressor
+ instance and return a <code>BufferedImage</code> instance containing the
+ decompressed image.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> byte[]</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int, int)">decompress</A></B>(int desiredWidth,
+ int pitch,
+ int desiredHeight,
+ int pixelFormat,
+ int flags)</CODE>
+
+<BR>
+ Decompress the JPEG source image associated with this decompressor
+ instance and return a buffer containing the decompressed image.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">decompressToYUV</A></B>(byte[] dstBuf,
+ int flags)</CODE>
+
+<BR>
+ Decompress the JPEG source image associated with this decompressor
+ instance and output a YUV planar image to the given destination buffer.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> byte[]</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</A></B>(int flags)</CODE>
+
+<BR>
+ Decompress the JPEG source image associated with this decompressor
+ instance and return a buffer containing a YUV planar image.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>protected void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()">finalize</A></B>()</CODE>
+
+<BR>
+ </TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</A></B>()</CODE>
+
+<BR>
+ Returns the height of the JPEG image associated with this decompressor
+ instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> byte[]</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</A></B>()</CODE>
+
+<BR>
+ Returns the JPEG image buffer associated with this decompressor instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</A></B>()</CODE>
+
+<BR>
+ Returns the size of the JPEG image (in bytes) associated with this
+ decompressor instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)">getScaledHeight</A></B>(int desiredWidth,
+ int desiredHeight)</CODE>
+
+<BR>
+ Returns the height of the largest scaled down image that the TurboJPEG
+ decompressor can generate without exceeding the desired image width and
+ height.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)">getScaledWidth</A></B>(int desiredWidth,
+ int desiredHeight)</CODE>
+
+<BR>
+ Returns the width of the largest scaled down image that the TurboJPEG
+ decompressor can generate without exceeding the desired image width and
+ height.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</A></B>()</CODE>
+
+<BR>
+ Returns the level of chrominance subsampling used in the JPEG image
+ associated with this decompressor instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</A></B>()</CODE>
+
+<BR>
+ Returns the width of the JPEG image associated with this decompressor
+ instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage</A></B>(byte[] jpegImage,
+ int imageSize)</CODE>
+
+<BR>
+ Associate the JPEG image of length <code>imageSize</code> bytes stored in
+ <code>jpegImage</code> with this decompressor instance.</TD>
+</TR>
+</TABLE>
+ <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
+</TR>
+</TABLE>
+
+<P>
+
+<!-- ============ FIELD DETAIL =========== -->
+
+<A NAME="field_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Field Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="handle"><!-- --></A><H3>
+handle</H3>
+<PRE>
+protected long <B>handle</B></PRE>
+<DL>
+<DL>
+</DL>
+</DL>
+<HR>
+
+<A NAME="jpegBuf"><!-- --></A><H3>
+jpegBuf</H3>
+<PRE>
+protected byte[] <B>jpegBuf</B></PRE>
+<DL>
+<DL>
+</DL>
+</DL>
+<HR>
+
+<A NAME="jpegBufSize"><!-- --></A><H3>
+jpegBufSize</H3>
+<PRE>
+protected int <B>jpegBufSize</B></PRE>
+<DL>
+<DL>
+</DL>
+</DL>
+<HR>
+
+<A NAME="jpegWidth"><!-- --></A><H3>
+jpegWidth</H3>
+<PRE>
+protected int <B>jpegWidth</B></PRE>
+<DL>
+<DL>
+</DL>
+</DL>
+<HR>
+
+<A NAME="jpegHeight"><!-- --></A><H3>
+jpegHeight</H3>
+<PRE>
+protected int <B>jpegHeight</B></PRE>
+<DL>
+<DL>
+</DL>
+</DL>
+<HR>
+
+<A NAME="jpegSubsamp"><!-- --></A><H3>
+jpegSubsamp</H3>
+<PRE>
+protected int <B>jpegSubsamp</B></PRE>
+<DL>
+<DL>
+</DL>
+</DL>
+
+<!-- ========= CONSTRUCTOR DETAIL ======== -->
+
+<A NAME="constructor_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Constructor Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="TJDecompressor()"><!-- --></A><H3>
+TJDecompressor</H3>
+<PRE>
+public <B>TJDecompressor</B>()
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Create a TurboJPEG decompresssor instance.
+<P>
+<DL>
+
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DL>
+<HR>
+
+<A NAME="TJDecompressor(byte[])"><!-- --></A><H3>
+TJDecompressor</H3>
+<PRE>
+public <B>TJDecompressor</B>(byte[] jpegImage)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Create a TurboJPEG decompressor instance and associate the JPEG image
+ stored in <code>jpegImage</code> with the newly-created instance.
+<P>
+<DL>
+<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer (size of the JPEG image is assumed to
+ be the length of the array)
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DL>
+<HR>
+
+<A NAME="TJDecompressor(byte[], int)"><!-- --></A><H3>
+TJDecompressor</H3>
+<PRE>
+public <B>TJDecompressor</B>(byte[] jpegImage,
+ int imageSize)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Create a TurboJPEG decompressor instance and associate the JPEG image
+ of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
+ with the newly-created instance.
+<P>
+<DL>
+<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of the JPEG image (in bytes)
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DL>
+
+<!-- ============ METHOD DETAIL ========== -->
+
+<A NAME="method_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Method Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="setJPEGImage(byte[], int)"><!-- --></A><H3>
+setJPEGImage</H3>
+<PRE>
+public void <B>setJPEGImage</B>(byte[] jpegImage,
+ int imageSize)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>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.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of the JPEG image (in bytes)
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getWidth()"><!-- --></A><H3>
+getWidth</H3>
+<PRE>
+public int <B>getWidth</B>()
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns the width of the JPEG image associated with this decompressor
+ instance.
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>the width of the JPEG image associated with this decompressor
+ instance
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getHeight()"><!-- --></A><H3>
+getHeight</H3>
+<PRE>
+public int <B>getHeight</B>()
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns the height of the JPEG image associated with this decompressor
+ instance.
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>the height of the JPEG image associated with this decompressor
+ instance
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getSubsamp()"><!-- --></A><H3>
+getSubsamp</H3>
+<PRE>
+public int <B>getSubsamp</B>()
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns the level of chrominance subsampling used in the JPEG image
+ associated with this decompressor instance.
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>the level of chrominance subsampling used in the JPEG image
+ associated with this decompressor instance
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getJPEGBuf()"><!-- --></A><H3>
+getJPEGBuf</H3>
+<PRE>
+public byte[] <B>getJPEGBuf</B>()
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns the JPEG image buffer associated with this decompressor instance.
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>the JPEG image buffer associated with this decompressor instance
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getJPEGSize()"><!-- --></A><H3>
+getJPEGSize</H3>
+<PRE>
+public int <B>getJPEGSize</B>()
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns the size of the JPEG image (in bytes) associated with this
+ decompressor instance.
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>the size of the JPEG image (in bytes) associated with this
+ decompressor instance
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getScaledWidth(int, int)"><!-- --></A><H3>
+getScaledWidth</H3>
+<PRE>
+public int <B>getScaledWidth</B>(int desiredWidth,
+ int desiredHeight)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns the width of the largest scaled down image that the TurboJPEG
+ decompressor can generate without exceeding the desired image width and
+ height.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - desired width (in pixels) of the decompressed image.
+ Setting this to 0 is the same as setting it to the width of the JPEG image
+ (in other words, the width will not be considered when determining the
+ scaled image size.)<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image.
+ Setting this to 0 is the same as setting it to the height of the JPEG
+ image (in other words, the height will not be considered when determining
+ the scaled image size.)
+<DT><B>Returns:</B><DD>the width of the largest scaled down image that the TurboJPEG
+ decompressor can generate without exceeding the desired image width and
+ height
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getScaledHeight(int, int)"><!-- --></A><H3>
+getScaledHeight</H3>
+<PRE>
+public int <B>getScaledHeight</B>(int desiredWidth,
+ int desiredHeight)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns the height of the largest scaled down image that the TurboJPEG
+ decompressor can generate without exceeding the desired image width and
+ height.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - desired width (in pixels) of the decompressed image.
+ Setting this to 0 is the same as setting it to the width of the JPEG image
+ (in other words, the width will not be considered when determining the
+ scaled image size.)<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image.
+ Setting this to 0 is the same as setting it to the height of the JPEG
+ image (in other words, the height will not be considered when determining
+ the scaled image size.)
+<DT><B>Returns:</B><DD>the height of the largest scaled down image that the TurboJPEG
+ decompressor can generate without exceeding the desired image width and
+ height
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="decompress(byte[], int, int, int, int, int)"><!-- --></A><H3>
+decompress</H3>
+<PRE>
+public void <B>decompress</B>(byte[] dstBuf,
+ int desiredWidth,
+ int pitch,
+ int desiredHeight,
+ int pixelFormat,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Decompress the JPEG source image associated with this decompressor
+ instance and output a decompressed image to the given destination buffer.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer which 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 <code>
+ scalingFactor.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><CODE>getScaled</CODE></A>(jpegHeight)
+ </code> with one of the scaling factors returned from <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getScalingFactors()"><CODE>TJ.getScalingFactors()</CODE></A> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)"><CODE>getScaledHeight(int, int)</CODE></A>.<DD><CODE>desiredWidth</CODE> - desired width (in pixels) of the decompressed image.
+ If the desired image dimensions are smaller than the dimensions 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 dimensions. Setting this to 0 is the same as setting it to
+ the width of the JPEG image (in other words, the width will not be
+ considered when determining the scaled image size.)<DD><CODE>pitch</CODE> - bytes per line of the destination image. Normally, this
+ should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
+ the decompressed image is unpadded, but you can use this to, for instance,
+ pad each line of the decompressed image to a 4-byte boundary. NOTE:
+ <code>scaledWidth</code> can be determined by calling <code>
+ scalingFactor.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)"><CODE>getScaled</CODE></A>(jpegWidth)
+ </code> or by calling <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)"><CODE>getScaledWidth(int, int)</CODE></A>. Setting this parameter to
+ 0 is the equivalent of setting it to <code>scaledWidth *
+ TJ.pixelSize(pixelFormat)</code>.<DD><CODE>desiredHeight</CODE> - desired height (in pixels) of the decompressed image.
+ If the desired image dimensions are smaller than the dimensions 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 dimensions. Setting this to 0 is the same as setting it to
+ the height of the JPEG image (in other words, the height will not be
+ considered when determining the scaled image size.)<DD><CODE>pixelFormat</CODE> - pixel format of the decompressed image (one of
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="decompress(int, int, int, int, int)"><!-- --></A><H3>
+decompress</H3>
+<PRE>
+public byte[] <B>decompress</B>(int desiredWidth,
+ int pitch,
+ int desiredHeight,
+ int pixelFormat,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Decompress the JPEG source image associated with this decompressor
+ instance and return a buffer containing the decompressed image.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - see
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>pitch</CODE> - see
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>desiredHeight</CODE> - see
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>pixelFormat</CODE> - pixel format of the decompressed image (one of
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.PF_*</CODE></A>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Returns:</B><DD>a buffer containing the decompressed image
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="decompressToYUV(byte[], int)"><!-- --></A><H3>
+decompressToYUV</H3>
+<PRE>
+public void <B>decompressToYUV</B>(byte[] dstBuf,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Decompress the JPEG source image associated with this decompressor
+ instance and output a YUV planar image to the given destination buffer.
+ This method performs JPEG decompression but leaves out the color
+ conversion step, so a planar YUV image is generated instead of an RGB
+ image. The padding of the planes in this image is the same as the images
+ generated by <A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html#encodeYUV(byte[], int)"><CODE>TJCompressor.encodeYUV(byte[], int)</CODE></A>. Note that, if
+ the width or height of the image is not an even multiple of the MCU block
+ size (see <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)"><CODE>TJ.getMCUWidth(int)</CODE></A> and <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)"><CODE>TJ.getMCUHeight(int)</CODE></A>), then an
+ intermediate buffer copy will be performed within TurboJPEG.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>dstBuf</CODE> - buffer which will receive the YUV planar image. Use
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSizeYUV(int, int, int)"><CODE>TJ.bufSizeYUV(int, int, int)</CODE></A> to determine the appropriate size for this buffer
+ based on the image width, height, and level of chrominance subsampling.<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="decompressToYUV(int)"><!-- --></A><H3>
+decompressToYUV</H3>
+<PRE>
+public byte[] <B>decompressToYUV</B>(int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Decompress the JPEG source image associated with this decompressor
+ instance and return a buffer containing a YUV planar image. See <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)"><CODE>decompressToYUV(byte[], int)</CODE></A> for more detail.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Returns:</B><DD>a buffer containing a YUV planar image
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="decompress(java.awt.image.BufferedImage, int)"><!-- --></A><H3>
+decompress</H3>
+<PRE>
+public void <B>decompress</B>(java.awt.image.BufferedImage dstImage,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Decompress the JPEG source image associated with this decompressor
+ instance and output a decompressed image to the given
+ <code>BufferedImage</code> instance.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>dstImage</CODE> - a <code>BufferedImage</code> instance which will receive
+ the decompressed image<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="decompress(int, int, int, int)"><!-- --></A><H3>
+decompress</H3>
+<PRE>
+public java.awt.image.BufferedImage <B>decompress</B>(int desiredWidth,
+ int desiredHeight,
+ int bufferedImageType,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Decompress the JPEG source image associated with this decompressor
+ instance and return a <code>BufferedImage</code> instance containing the
+ decompressed image.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>desiredWidth</CODE> - see
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>desiredHeight</CODE> - see
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)"><CODE>decompress(byte[], int, int, int, int, int)</CODE></A> for description<DD><CODE>bufferedImageType</CODE> - the image type of the newly-created
+ <code>BufferedImage</code> instance (for instance,
+ <code>BufferedImage.TYPE_INT_RGB</code>)<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Returns:</B><DD>a <code>BufferedImage</code> instance containing the
+ decompressed image
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="close()"><!-- --></A><H3>
+close</H3>
+<PRE>
+public void <B>close</B>()
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Free the native structures associated with this decompressor instance.
+<P>
+<DD><DL>
+
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="finalize()"><!-- --></A><H3>
+finalize</H3>
+<PRE>
+protected void <B>finalize</B>()
+ throws java.lang.Throwable</PRE>
+<DL>
+<DD><DL>
+<DT><B>Overrides:</B><DD><CODE>finalize</CODE> in class <CODE>java.lang.Object</CODE></DL>
+</DD>
+<DD><DL>
+
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Throwable</CODE></DL>
+</DD>
+</DL>
+<!-- ========= END OF CLASS DATA ========= -->
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJDecompressor.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJDecompressor.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html b/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html
new file mode 100644
index 0000000..5d9682a
--- /dev/null
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJScalingFactor.html
@@ -0,0 +1,358 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+TJScalingFactor
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="TJScalingFactor";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJScalingFactor.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJScalingFactor.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<!-- ======== START OF CLASS DATA ======== -->
+<H2>
+<FONT SIZE="-1">
+org.libjpegturbo.turbojpeg</FONT>
+<BR>
+Class TJScalingFactor</H2>
+<PRE>
+java.lang.Object
+ <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>org.libjpegturbo.turbojpeg.TJScalingFactor</B>
+</PRE>
+<HR>
+<DL>
+<DT><PRE>public class <B>TJScalingFactor</B><DT>extends java.lang.Object</DL>
+</PRE>
+
+<P>
+Fractional scaling factor
+<P>
+
+<P>
+<HR>
+
+<P>
+
+<!-- ======== CONSTRUCTOR SUMMARY ======== -->
+
+<A NAME="constructor_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Constructor Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#TJScalingFactor(int, int)">TJScalingFactor</A></B>(int num,
+ int denom)</CODE>
+
+<BR>
+ </TD>
+</TR>
+</TABLE>
+
+<!-- ========== METHOD SUMMARY =========== -->
+
+<A NAME="method_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Method Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> boolean</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#equals(org.libjpegturbo.turbojpeg.TJScalingFactor)">equals</A></B>(<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A> other)</CODE>
+
+<BR>
+ Returns true or false, depending on whether this instance and
+ <code>other</code> have the same numerator and denominator.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getDenom()">getDenom</A></B>()</CODE>
+
+<BR>
+ Returns denominator</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getNum()">getNum</A></B>()</CODE>
+
+<BR>
+ Returns numerator</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#getScaled(int)">getScaled</A></B>(int dimension)</CODE>
+
+<BR>
+ Returns the scaled value of <code>dimension</code>.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> boolean</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html#isOne()">isOne</A></B>()</CODE>
+
+<BR>
+ Returns true or false, depending on whether this instance is equal to
+ 1/1.</TD>
+</TR>
+</TABLE>
+ <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
+</TR>
+</TABLE>
+
+<P>
+
+<!-- ========= CONSTRUCTOR DETAIL ======== -->
+
+<A NAME="constructor_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Constructor Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="TJScalingFactor(int, int)"><!-- --></A><H3>
+TJScalingFactor</H3>
+<PRE>
+public <B>TJScalingFactor</B>(int num,
+ int denom)
+ throws java.lang.Exception</PRE>
+<DL>
+<DL>
+
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DL>
+
+<!-- ============ METHOD DETAIL ========== -->
+
+<A NAME="method_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Method Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="getNum()"><!-- --></A><H3>
+getNum</H3>
+<PRE>
+public int <B>getNum</B>()</PRE>
+<DL>
+<DD>Returns numerator
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>numerator</DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getDenom()"><!-- --></A><H3>
+getDenom</H3>
+<PRE>
+public int <B>getDenom</B>()</PRE>
+<DL>
+<DD>Returns denominator
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>denominator</DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getScaled(int)"><!-- --></A><H3>
+getScaled</H3>
+<PRE>
+public int <B>getScaled</B>(int dimension)</PRE>
+<DL>
+<DD>Returns the scaled value of <code>dimension</code>. This function
+ performs the integer equivalent of
+ <code>ceil(dimension * scalingFactor)</code>.
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>the scaled value of <code>dimension</code></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="equals(org.libjpegturbo.turbojpeg.TJScalingFactor)"><!-- --></A><H3>
+equals</H3>
+<PRE>
+public boolean <B>equals</B>(<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A> other)</PRE>
+<DL>
+<DD>Returns true or false, depending on whether this instance and
+ <code>other</code> have the same numerator and denominator.
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>true or false, depending on whether this instance and
+ <code>other</code> have the same numerator and denominator</DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="isOne()"><!-- --></A><H3>
+isOne</H3>
+<PRE>
+public boolean <B>isOne</B>()</PRE>
+<DL>
+<DD>Returns true or false, depending on whether this instance is equal to
+ 1/1.
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>true or false, depending on whether this instance is equal to
+ 1/1</DL>
+</DD>
+</DL>
+<!-- ========= END OF CLASS DATA ========= -->
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJScalingFactor.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJScalingFactor.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html b/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html
new file mode 100644
index 0000000..e10ace5
--- /dev/null
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJTransform.html
@@ -0,0 +1,767 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+TJTransform
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="TJTransform";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJTransform.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJTransform.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: <A HREF="#nested_classes_inherited_from_class_java.awt.geom.Rectangle2D">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#methods_inherited_from_class_java.awt.Rectangle">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | METHOD</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<!-- ======== START OF CLASS DATA ======== -->
+<H2>
+<FONT SIZE="-1">
+org.libjpegturbo.turbojpeg</FONT>
+<BR>
+Class TJTransform</H2>
+<PRE>
+java.lang.Object
+ <IMG SRC="../../../resources/inherit.gif" ALT="extended by ">java.awt.geom.RectangularShape
+ <IMG SRC="../../../resources/inherit.gif" ALT="extended by ">java.awt.geom.Rectangle2D
+ <IMG SRC="../../../resources/inherit.gif" ALT="extended by ">java.awt.Rectangle
+ <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>org.libjpegturbo.turbojpeg.TJTransform</B>
+</PRE>
+<DL>
+<DT><B>All Implemented Interfaces:</B> <DD>java.awt.Shape, java.io.Serializable, java.lang.Cloneable</DD>
+</DL>
+<HR>
+<DL>
+<DT><PRE>public class <B>TJTransform</B><DT>extends java.awt.Rectangle</DL>
+</PRE>
+
+<P>
+Lossless transform parameters
+<P>
+
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../serialized-form.html#org.libjpegturbo.turbojpeg.TJTransform">Serialized Form</A></DL>
+<HR>
+
+<P>
+<!-- ======== NESTED CLASS SUMMARY ======== -->
+
+<A NAME="nested_class_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Nested Class Summary</B></FONT></TH>
+</TR>
+</TABLE>
+ <A NAME="nested_classes_inherited_from_class_java.awt.geom.Rectangle2D"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Nested classes/interfaces inherited from class java.awt.geom.Rectangle2D</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>java.awt.geom.Rectangle2D.Double, java.awt.geom.Rectangle2D.Float</CODE></TD>
+</TR>
+</TABLE>
+
+<!-- =========== FIELD SUMMARY =========== -->
+
+<A NAME="field_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Field Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> <A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</A></CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#cf">cf</A></B></CODE>
+
+<BR>
+ Custom filter instance</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#NUMOP">NUMOP</A></B></CODE>
+
+<BR>
+ The number of lossless transform operations</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#op">op</A></B></CODE>
+
+<BR>
+ Transform operation (one of <code>OP_*</code>)</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_HFLIP">OP_HFLIP</A></B></CODE>
+
+<BR>
+ Flip (mirror) image horizontally.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_NONE">OP_NONE</A></B></CODE>
+
+<BR>
+ Do not transform the position of the image pixels.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_ROT180">OP_ROT180</A></B></CODE>
+
+<BR>
+ Rotate image 180 degrees.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_ROT270">OP_ROT270</A></B></CODE>
+
+<BR>
+ Rotate image counter-clockwise by 90 degrees.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_ROT90">OP_ROT90</A></B></CODE>
+
+<BR>
+ Rotate image clockwise by 90 degrees.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_TRANSPOSE">OP_TRANSPOSE</A></B></CODE>
+
+<BR>
+ Transpose image (flip/mirror along upper left to lower right axis).</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_TRANSVERSE">OP_TRANSVERSE</A></B></CODE>
+
+<BR>
+ Transverse transpose image (flip/mirror along upper right to lower left
+ axis).</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OP_VFLIP">OP_VFLIP</A></B></CODE>
+
+<BR>
+ Flip (mirror) image vertically.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_CROP">OPT_CROP</A></B></CODE>
+
+<BR>
+ This option will enable lossless cropping.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_GRAY">OPT_GRAY</A></B></CODE>
+
+<BR>
+ This option will discard the color data in the input image and produce
+ a grayscale output image.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_NOOUTPUT">OPT_NOOUTPUT</A></B></CODE>
+
+<BR>
+ This option will prevent <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>TJTransformer.transform()</CODE></A> from outputting a JPEG image for this
+ particular transform.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT">OPT_PERFECT</A></B></CODE>
+
+<BR>
+ This option will cause <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>TJTransformer.transform()</CODE></A> to throw an exception if the transform is not
+ perfect.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE>static int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_TRIM">OPT_TRIM</A></B></CODE>
+
+<BR>
+ This option will discard any partial MCU blocks that cannot be
+ transformed.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#options">options</A></B></CODE>
+
+<BR>
+ Transform options (bitwise OR of one or more of <code>OPT_*</code>)</TD>
+</TR>
+</TABLE>
+ <A NAME="fields_inherited_from_class_java.awt.Rectangle"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Fields inherited from class java.awt.Rectangle</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>height, width, x, y</CODE></TD>
+</TR>
+</TABLE>
+ <A NAME="fields_inherited_from_class_java.awt.geom.Rectangle2D"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Fields inherited from class java.awt.geom.Rectangle2D</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>OUT_BOTTOM, OUT_LEFT, OUT_RIGHT, OUT_TOP</CODE></TD>
+</TR>
+</TABLE>
+
+<!-- ======== CONSTRUCTOR SUMMARY ======== -->
+
+<A NAME="constructor_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Constructor Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform()">TJTransform</A></B>()</CODE>
+
+<BR>
+ Create a new lossless transform instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int, int, int, int, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)">TJTransform</A></B>(int x,
+ int y,
+ int w,
+ int h,
+ int op,
+ int options,
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</A> cf)</CODE>
+
+<BR>
+ Create a new lossless transform instance with the given parameters.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(java.awt.Rectangle, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)">TJTransform</A></B>(java.awt.Rectangle r,
+ int op,
+ int options,
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</A> cf)</CODE>
+
+<BR>
+ Create a new lossless transform instance with the given parameters.</TD>
+</TR>
+</TABLE>
+
+<!-- ========== METHOD SUMMARY =========== -->
+
+<A NAME="method_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Method Summary</B></FONT></TH>
+</TR>
+</TABLE>
+ <A NAME="methods_inherited_from_class_java.awt.Rectangle"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Methods inherited from class java.awt.Rectangle</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>add, add, add, contains, contains, contains, contains, createIntersection, createUnion, equals, getBounds, getBounds2D, getHeight, getLocation, getSize, getWidth, getX, getY, grow, inside, intersection, intersects, isEmpty, move, outcode, reshape, resize, setBounds, setBounds, setLocation, setLocation, setRect, setSize, setSize, toString, translate, union</CODE></TD>
+</TR>
+</TABLE>
+ <A NAME="methods_inherited_from_class_java.awt.geom.Rectangle2D"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Methods inherited from class java.awt.geom.Rectangle2D</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>add, add, add, contains, contains, getPathIterator, getPathIterator, hashCode, intersect, intersects, intersectsLine, intersectsLine, outcode, setFrame, setRect, union</CODE></TD>
+</TR>
+</TABLE>
+ <A NAME="methods_inherited_from_class_java.awt.geom.RectangularShape"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Methods inherited from class java.awt.geom.RectangularShape</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>clone, contains, contains, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal</CODE></TD>
+</TR>
+</TABLE>
+ <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>finalize, getClass, notify, notifyAll, wait, wait, wait</CODE></TD>
+</TR>
+</TABLE>
+ <A NAME="methods_inherited_from_class_java.awt.Shape"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Methods inherited from interface java.awt.Shape</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>contains, contains, contains, contains, getPathIterator, getPathIterator, intersects, intersects</CODE></TD>
+</TR>
+</TABLE>
+
+<P>
+
+<!-- ============ FIELD DETAIL =========== -->
+
+<A NAME="field_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Field Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="NUMOP"><!-- --></A><H3>
+NUMOP</H3>
+<PRE>
+public static final int <B>NUMOP</B></PRE>
+<DL>
+<DD>The number of lossless transform operations
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.NUMOP">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OP_NONE"><!-- --></A><H3>
+OP_NONE</H3>
+<PRE>
+public static final int <B>OP_NONE</B></PRE>
+<DL>
+<DD>Do not transform the position of the image pixels.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OP_NONE">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OP_HFLIP"><!-- --></A><H3>
+OP_HFLIP</H3>
+<PRE>
+public static final int <B>OP_HFLIP</B></PRE>
+<DL>
+<DD>Flip (mirror) image horizontally. This transform is imperfect if there
+ are any partial MCU blocks on the right edge.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><CODE>OPT_PERFECT</CODE></A>,
+<A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OP_HFLIP">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OP_VFLIP"><!-- --></A><H3>
+OP_VFLIP</H3>
+<PRE>
+public static final int <B>OP_VFLIP</B></PRE>
+<DL>
+<DD>Flip (mirror) image vertically. This transform is imperfect if there are
+ any partial MCU blocks on the bottom edge.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><CODE>OPT_PERFECT</CODE></A>,
+<A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OP_VFLIP">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OP_TRANSPOSE"><!-- --></A><H3>
+OP_TRANSPOSE</H3>
+<PRE>
+public static final int <B>OP_TRANSPOSE</B></PRE>
+<DL>
+<DD>Transpose image (flip/mirror along upper left to lower right axis). This
+ transform is always perfect.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><CODE>OPT_PERFECT</CODE></A>,
+<A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OP_TRANSPOSE">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OP_TRANSVERSE"><!-- --></A><H3>
+OP_TRANSVERSE</H3>
+<PRE>
+public static final int <B>OP_TRANSVERSE</B></PRE>
+<DL>
+<DD>Transverse transpose image (flip/mirror along upper right to lower left
+ axis). This transform is imperfect if there are any partial MCU blocks in
+ the image.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><CODE>OPT_PERFECT</CODE></A>,
+<A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OP_TRANSVERSE">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OP_ROT90"><!-- --></A><H3>
+OP_ROT90</H3>
+<PRE>
+public static final int <B>OP_ROT90</B></PRE>
+<DL>
+<DD>Rotate image clockwise by 90 degrees. This transform is imperfect if
+ there are any partial MCU blocks on the bottom edge.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><CODE>OPT_PERFECT</CODE></A>,
+<A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OP_ROT90">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OP_ROT180"><!-- --></A><H3>
+OP_ROT180</H3>
+<PRE>
+public static final int <B>OP_ROT180</B></PRE>
+<DL>
+<DD>Rotate image 180 degrees. This transform is imperfect if there are any
+ partial MCU blocks in the image.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><CODE>OPT_PERFECT</CODE></A>,
+<A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OP_ROT180">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OP_ROT270"><!-- --></A><H3>
+OP_ROT270</H3>
+<PRE>
+public static final int <B>OP_ROT270</B></PRE>
+<DL>
+<DD>Rotate image counter-clockwise by 90 degrees. This transform is imperfect
+ if there are any partial MCU blocks on the right edge.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#OPT_PERFECT"><CODE>OPT_PERFECT</CODE></A>,
+<A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OP_ROT270">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OPT_PERFECT"><!-- --></A><H3>
+OPT_PERFECT</H3>
+<PRE>
+public static final int <B>OPT_PERFECT</B></PRE>
+<DL>
+<DD>This option will cause <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>TJTransformer.transform()</CODE></A> to throw an exception if the transform is not
+ perfect. Lossless transforms operate on MCU blocks, whose size depends on
+ the level of chrominance subsampling used. If the image's width or height
+ is not evenly divisible by the MCU block size (see <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)"><CODE>TJ.getMCUWidth(int)</CODE></A>
+ and <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)"><CODE>TJ.getMCUHeight(int)</CODE></A>), then there will be partial MCU blocks on the
+ right and/or bottom edges. It is not possible to move these partial MCU
+ blocks to the top or left of the image, so any transform that would
+ require that is "imperfect." If this option is not specified, then any
+ partial MCU blocks that cannot be transformed will be left in place, which
+ will create odd-looking strips on the right or bottom edge of the image.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_PERFECT">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OPT_TRIM"><!-- --></A><H3>
+OPT_TRIM</H3>
+<PRE>
+public static final int <B>OPT_TRIM</B></PRE>
+<DL>
+<DD>This option will discard any partial MCU blocks that cannot be
+ transformed.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_TRIM">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OPT_CROP"><!-- --></A><H3>
+OPT_CROP</H3>
+<PRE>
+public static final int <B>OPT_CROP</B></PRE>
+<DL>
+<DD>This option will enable lossless cropping.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_CROP">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OPT_GRAY"><!-- --></A><H3>
+OPT_GRAY</H3>
+<PRE>
+public static final int <B>OPT_GRAY</B></PRE>
+<DL>
+<DD>This option will discard the color data in the input image and produce
+ a grayscale output image.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_GRAY">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="OPT_NOOUTPUT"><!-- --></A><H3>
+OPT_NOOUTPUT</H3>
+<PRE>
+public static final int <B>OPT_NOOUTPUT</B></PRE>
+<DL>
+<DD>This option will prevent <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>TJTransformer.transform()</CODE></A> from outputting a JPEG image for this
+ particular transform. This can be used in conjunction with a custom
+ filter to capture the transformed DCT coefficients without transcoding
+ them.
+<P>
+<DL>
+<DT><B>See Also:</B><DD><A HREF="../../../constant-values.html#org.libjpegturbo.turbojpeg.TJTransform.OPT_NOOUTPUT">Constant Field Values</A></DL>
+</DL>
+<HR>
+
+<A NAME="op"><!-- --></A><H3>
+op</H3>
+<PRE>
+public int <B>op</B></PRE>
+<DL>
+<DD>Transform operation (one of <code>OP_*</code>)
+<P>
+<DL>
+</DL>
+</DL>
+<HR>
+
+<A NAME="options"><!-- --></A><H3>
+options</H3>
+<PRE>
+public int <B>options</B></PRE>
+<DL>
+<DD>Transform options (bitwise OR of one or more of <code>OPT_*</code>)
+<P>
+<DL>
+</DL>
+</DL>
+<HR>
+
+<A NAME="cf"><!-- --></A><H3>
+cf</H3>
+<PRE>
+public <A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</A> <B>cf</B></PRE>
+<DL>
+<DD>Custom filter instance
+<P>
+<DL>
+</DL>
+</DL>
+
+<!-- ========= CONSTRUCTOR DETAIL ======== -->
+
+<A NAME="constructor_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Constructor Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="TJTransform()"><!-- --></A><H3>
+TJTransform</H3>
+<PRE>
+public <B>TJTransform</B>()</PRE>
+<DL>
+<DD>Create a new lossless transform instance.
+<P>
+</DL>
+<HR>
+
+<A NAME="TJTransform(int, int, int, int, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)"><!-- --></A><H3>
+TJTransform</H3>
+<PRE>
+public <B>TJTransform</B>(int x,
+ int y,
+ int w,
+ int h,
+ int op,
+ int options,
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</A> cf)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Create a new lossless transform instance with the given parameters.
+<P>
+<DL>
+<DT><B>Parameters:</B><DD><CODE>x</CODE> - the left boundary of the cropping region. This must be evenly
+ divisible by the MCU block width (see <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUWidth(int)"><CODE>TJ.getMCUWidth(int)</CODE></A>)<DD><CODE>y</CODE> - the upper boundary of the cropping region. This must be evenly
+ divisible by the MCU block height (see <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#getMCUHeight(int)"><CODE>TJ.getMCUHeight(int)</CODE></A>)<DD><CODE>w</CODE> - the width of the cropping region. Setting this to 0 is the
+ equivalent of setting it to the width of the source JPEG image - x.<DD><CODE>h</CODE> - the height of the cropping region. Setting this to 0 is the
+ equivalent of setting it to the height of the source JPEG image - y.<DD><CODE>op</CODE> - one of the transform operations (<code>OP_*</code>)<DD><CODE>options</CODE> - the bitwise OR of one or more of the transform options
+ (<code>OPT_*</code>)<DD><CODE>cf</CODE> - an instance of an object that implements the <A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><CODE>TJCustomFilter</CODE></A> interface, or null if no custom filter is needed
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DL>
+<HR>
+
+<A NAME="TJTransform(java.awt.Rectangle, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)"><!-- --></A><H3>
+TJTransform</H3>
+<PRE>
+public <B>TJTransform</B>(java.awt.Rectangle r,
+ int op,
+ int options,
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</A> cf)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Create a new lossless transform instance with the given parameters.
+<P>
+<DL>
+<DT><B>Parameters:</B><DD><CODE>r</CODE> - a <code>Rectangle</code> instance which specifies the cropping
+ region. See <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html#TJTransform(int, int, int, int, int, int, org.libjpegturbo.turbojpeg.TJCustomFilter)"><CODE>TJTransform(int, int, int, int, int, int, TJCustomFilter)</CODE></A> for more
+ detail.<DD><CODE>op</CODE> - one of the transform operations (<code>OP_*</code>)<DD><CODE>options</CODE> - the bitwise OR of one or more of the transform options
+ (<code>OPT_*</code>)<DD><CODE>cf</CODE> - an instance of an object that implements the <A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><CODE>TJCustomFilter</CODE></A> interface, or null if no custom filter is needed
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DL>
+<!-- ========= END OF CLASS DATA ========= -->
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg"><B>NEXT CLASS</B></A></FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJTransform.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJTransform.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: <A HREF="#nested_classes_inherited_from_class_java.awt.geom.Rectangle2D">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#methods_inherited_from_class_java.awt.Rectangle">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | METHOD</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html b/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html
new file mode 100644
index 0000000..c61c8f2
--- /dev/null
+++ b/java/doc/org/libjpegturbo/turbojpeg/TJTransformer.html
@@ -0,0 +1,427 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+TJTransformer
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="TJTransformer";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>
+ NEXT CLASS</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJTransformer.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJTransformer.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | <A HREF="#fields_inherited_from_class_org.libjpegturbo.turbojpeg.TJDecompressor">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<!-- ======== START OF CLASS DATA ======== -->
+<H2>
+<FONT SIZE="-1">
+org.libjpegturbo.turbojpeg</FONT>
+<BR>
+Class TJTransformer</H2>
+<PRE>
+java.lang.Object
+ <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">org.libjpegturbo.turbojpeg.TJDecompressor</A>
+ <IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>org.libjpegturbo.turbojpeg.TJTransformer</B>
+</PRE>
+<HR>
+<DL>
+<DT><PRE>public class <B>TJTransformer</B><DT>extends <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A></DL>
+</PRE>
+
+<P>
+TurboJPEG lossless transformer
+<P>
+
+<P>
+<HR>
+
+<P>
+<!-- =========== FIELD SUMMARY =========== -->
+
+<A NAME="field_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Field Summary</B></FONT></TH>
+</TR>
+</TABLE>
+ <A NAME="fields_inherited_from_class_org.libjpegturbo.turbojpeg.TJDecompressor"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Fields inherited from class org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A></B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#handle">handle</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBuf">jpegBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegBufSize">jpegBufSize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegHeight">jpegHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegSubsamp">jpegSubsamp</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#jpegWidth">jpegWidth</A></CODE></TD>
+</TR>
+</TABLE>
+
+<!-- ======== CONSTRUCTOR SUMMARY ======== -->
+
+<A NAME="constructor_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Constructor Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer()">TJTransformer</A></B>()</CODE>
+
+<BR>
+ Create a TurboJPEG lossless transformer instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[])">TJTransformer</A></B>(byte[] jpegImage)</CODE>
+
+<BR>
+ Create a TurboJPEG lossless transformer instance and associate the JPEG
+ image stored in <code>jpegImage</code> with the newly-created instance.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#TJTransformer(byte[], int)">TJTransformer</A></B>(byte[] jpegImage,
+ int imageSize)</CODE>
+
+<BR>
+ 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.</TD>
+</TR>
+</TABLE>
+
+<!-- ========== METHOD SUMMARY =========== -->
+
+<A NAME="method_summary"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Method Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> int[]</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#getTransformedSizes()">getTransformedSizes</A></B>()</CODE>
+
+<BR>
+ Returns an array containing the sizes of the transformed JPEG images from
+ the most recent call to <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>transform()</CODE></A>.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> void</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)">transform</A></B>(byte[][] dstBufs,
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>[] transforms,
+ int flags)</CODE>
+
+<BR>
+ Losslessly transform the JPEG image associated with this transformer
+ instance into one or more JPEG images stored in the given destination
+ buffers.</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
+<CODE> <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>[]</CODE></FONT></TD>
+<TD><CODE><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(org.libjpegturbo.turbojpeg.TJTransform[], int)">transform</A></B>(<A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>[] transforms,
+ int flags)</CODE>
+
+<BR>
+ Losslessly transform the JPEG image associated with this transformer
+ instance and return an array of <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJDecompressor</CODE></A> instances, each of
+ which has a transformed JPEG image associated with it.</TD>
+</TR>
+</TABLE>
+ <A NAME="methods_inherited_from_class_org.libjpegturbo.turbojpeg.TJDecompressor"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Methods inherited from class org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A></B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#close()">close</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(java.awt.image.BufferedImage, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(byte[], int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompress(int, int, int, int, int)">decompress</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(byte[], int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#decompressToYUV(int)">decompressToYUV</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#finalize()">finalize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getHeight()">getHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGBuf()">getJPEGBuf</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getJPEGSize()">getJPEGSize</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledHeight(int, int)">getScaledHeight</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getScaledWidth(int, int)">getScaledWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getSubsamp()">getSubsamp</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#getWidth()">getWidth</A>, <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html#setJPEGImage(byte[], int)">setJPEGImage</A></CODE></TD>
+</TR>
+</TABLE>
+ <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD><CODE>clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
+</TR>
+</TABLE>
+
+<P>
+
+<!-- ========= CONSTRUCTOR DETAIL ======== -->
+
+<A NAME="constructor_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Constructor Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="TJTransformer()"><!-- --></A><H3>
+TJTransformer</H3>
+<PRE>
+public <B>TJTransformer</B>()
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Create a TurboJPEG lossless transformer instance.
+<P>
+<DL>
+
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DL>
+<HR>
+
+<A NAME="TJTransformer(byte[])"><!-- --></A><H3>
+TJTransformer</H3>
+<PRE>
+public <B>TJTransformer</B>(byte[] jpegImage)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Create a TurboJPEG lossless transformer instance and associate the JPEG
+ image stored in <code>jpegImage</code> with the newly-created instance.
+<P>
+<DL>
+<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer (size of the JPEG image is assumed to
+ be the length of the array)
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DL>
+<HR>
+
+<A NAME="TJTransformer(byte[], int)"><!-- --></A><H3>
+TJTransformer</H3>
+<PRE>
+public <B>TJTransformer</B>(byte[] jpegImage,
+ int imageSize)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>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.
+<P>
+<DL>
+<DT><B>Parameters:</B><DD><CODE>jpegImage</CODE> - JPEG image buffer<DD><CODE>imageSize</CODE> - size of the JPEG image (in bytes)
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DL>
+
+<!-- ============ METHOD DETAIL ========== -->
+
+<A NAME="method_detail"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Method Detail</B></FONT></TH>
+</TR>
+</TABLE>
+
+<A NAME="transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><!-- --></A><H3>
+transform</H3>
+<PRE>
+public void <B>transform</B>(byte[][] dstBufs,
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>[] transforms,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Losslessly transform the JPEG image associated with this transformer
+ instance into one or more JPEG images stored in the given destination
+ buffers. Lossless transforms work by moving the raw coefficients from one
+ JPEG image structure to another without altering the values of the
+ coefficients. While this is typically faster than decompressing the
+ image, transforming it, and re-compressing it, lossless transforms are not
+ free. Each lossless transform requires reading and Huffman decoding all
+ of the coefficients in the source image, regardless of the size of the
+ destination image. Thus, this method provides a means of generating
+ multiple transformed images from the same source or of applying multiple
+ transformations simultaneously, in order to eliminate the need to read the
+ source coefficients multiple times.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>dstBufs</CODE> - an array of image buffers. <code>dstbufs[i]</code> will
+ receive a JPEG image that has been transformed using the parameters in
+ <code>transforms[i]</code>. Use <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html#bufSize(int, int, int)"><CODE>TJ.bufSize(int, int, int)</CODE></A> to determine the
+ maximum size for each buffer based on the cropped width and height.<DD><CODE>transforms</CODE> - an array of <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJTransform</CODE></A> instances, each of
+ which specifies the transform parameters and/or cropping region for the
+ corresponding transformed output image<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="transform(org.libjpegturbo.turbojpeg.TJTransform[], int)"><!-- --></A><H3>
+transform</H3>
+<PRE>
+public <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A>[] <B>transform</B>(<A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A>[] transforms,
+ int flags)
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Losslessly transform the JPEG image associated with this transformer
+ instance and return an array of <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJDecompressor</CODE></A> instances, each of
+ which has a transformed JPEG image associated with it.
+<P>
+<DD><DL>
+<DT><B>Parameters:</B><DD><CODE>transforms</CODE> - an array of <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJTransform</CODE></A> instances, each of
+ which specifies the transform parameters and/or cropping region for the
+ corresponding transformed output image<DD><CODE>flags</CODE> - the bitwise OR of one or more of <A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJ.FLAG_*</CODE></A>
+<DT><B>Returns:</B><DD>an array of <A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><CODE>TJDecompressor</CODE></A> instances, each of
+ which has a transformed JPEG image associated with it
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<HR>
+
+<A NAME="getTransformedSizes()"><!-- --></A><H3>
+getTransformedSizes</H3>
+<PRE>
+public int[] <B>getTransformedSizes</B>()
+ throws java.lang.Exception</PRE>
+<DL>
+<DD>Returns an array containing the sizes of the transformed JPEG images from
+ the most recent call to <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>transform()</CODE></A>.
+<P>
+<DD><DL>
+
+<DT><B>Returns:</B><DD>an array containing the sizes of the transformed JPEG images from
+ the most recent call to <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html#transform(byte[][], org.libjpegturbo.turbojpeg.TJTransform[], int)"><CODE>transform()</CODE></A>
+<DT><B>Throws:</B>
+<DD><CODE>java.lang.Exception</CODE></DL>
+</DD>
+</DL>
+<!-- ========= END OF CLASS DATA ========= -->
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><B>PREV CLASS</B></A>
+ NEXT CLASS</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/TJTransformer.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="TJTransformer.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+<TR>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+ SUMMARY: NESTED | <A HREF="#fields_inherited_from_class_org.libjpegturbo.turbojpeg.TJDecompressor">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
+<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
+DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/org/libjpegturbo/turbojpeg/package-frame.html b/java/doc/org/libjpegturbo/turbojpeg/package-frame.html
new file mode 100644
index 0000000..0fd2512
--- /dev/null
+++ b/java/doc/org/libjpegturbo/turbojpeg/package-frame.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+org.libjpegturbo.turbojpeg
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
+
+
+</HEAD>
+
+<BODY BGCOLOR="white">
+<FONT size="+1" CLASS="FrameTitleFont">
+<A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html" target="classFrame">org.libjpegturbo.turbojpeg</A></FONT>
+<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
+<TR>
+<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">
+Interfaces</FONT>
+<FONT CLASS="FrameItemFont">
+<BR>
+<A HREF="TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg" target="classFrame"><I>TJCustomFilter</I></A></FONT></TD>
+</TR>
+</TABLE>
+
+
+<TABLE BORDER="0" WIDTH="100%" SUMMARY="">
+<TR>
+<TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont">
+Classes</FONT>
+<FONT CLASS="FrameItemFont">
+<BR>
+<A HREF="TJ.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJ</A>
+<BR>
+<A HREF="TJCompressor.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJCompressor</A>
+<BR>
+<A HREF="TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJDecompressor</A>
+<BR>
+<A HREF="TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJScalingFactor</A>
+<BR>
+<A HREF="TJTransform.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJTransform</A>
+<BR>
+<A HREF="TJTransformer.html" title="class in org.libjpegturbo.turbojpeg" target="classFrame">TJTransformer</A></FONT></TD>
+</TR>
+</TABLE>
+
+
+</BODY>
+</HTML>
diff --git a/java/doc/org/libjpegturbo/turbojpeg/package-summary.html b/java/doc/org/libjpegturbo/turbojpeg/package-summary.html
new file mode 100644
index 0000000..52b963b
--- /dev/null
+++ b/java/doc/org/libjpegturbo/turbojpeg/package-summary.html
@@ -0,0 +1,187 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+org.libjpegturbo.turbojpeg
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="org.libjpegturbo.turbojpeg";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV PACKAGE
+ NEXT PACKAGE</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/package-summary.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<H2>
+Package org.libjpegturbo.turbojpeg
+</H2>
+
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Interface Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD WIDTH="15%"><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</A></B></TD>
+<TD>Custom filter callback interface</TD>
+</TR>
+</TABLE>
+
+
+<P>
+
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Class Summary</B></FONT></TH>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD WIDTH="15%"><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg">TJ</A></B></TD>
+<TD>TurboJPEG utility class (cannot be instantiated)</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD WIDTH="15%"><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg">TJCompressor</A></B></TD>
+<TD>TurboJPEG compressor</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD WIDTH="15%"><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg">TJDecompressor</A></B></TD>
+<TD>TurboJPEG decompressor</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD WIDTH="15%"><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg">TJScalingFactor</A></B></TD>
+<TD>Fractional scaling factor</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD WIDTH="15%"><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">TJTransform</A></B></TD>
+<TD>Lossless transform parameters</TD>
+</TR>
+<TR BGCOLOR="white" CLASS="TableRowColor">
+<TD WIDTH="15%"><B><A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg">TJTransformer</A></B></TD>
+<TD>TurboJPEG lossless transformer</TD>
+</TR>
+</TABLE>
+
+
+<P>
+<DL>
+</DL>
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV PACKAGE
+ NEXT PACKAGE</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/package-summary.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/org/libjpegturbo/turbojpeg/package-tree.html b/java/doc/org/libjpegturbo/turbojpeg/package-tree.html
new file mode 100644
index 0000000..ecb8596
--- /dev/null
+++ b/java/doc/org/libjpegturbo/turbojpeg/package-tree.html
@@ -0,0 +1,161 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+org.libjpegturbo.turbojpeg Class Hierarchy
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="org.libjpegturbo.turbojpeg Class Hierarchy";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/package-tree.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="package-tree.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<CENTER>
+<H2>
+Hierarchy For Package org.libjpegturbo.turbojpeg
+</H2>
+</CENTER>
+<H2>
+Class Hierarchy
+</H2>
+<UL>
+<LI TYPE="circle">java.lang.Object<UL>
+<LI TYPE="circle">java.awt.geom.RectangularShape (implements java.lang.Cloneable, java.awt.Shape)
+<UL>
+<LI TYPE="circle">java.awt.geom.Rectangle2D<UL>
+<LI TYPE="circle">java.awt.Rectangle (implements java.io.Serializable, java.awt.Shape)
+<UL>
+<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><B>TJTransform</B></A></UL>
+</UL>
+</UL>
+<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><B>TJ</B></A><LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJCompressor</B></A><LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJDecompressor</B></A><UL>
+<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg"><B>TJTransformer</B></A></UL>
+<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJScalingFactor</B></A></UL>
+</UL>
+<H2>
+Interface Hierarchy
+</H2>
+<UL>
+<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="../../../org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><B>TJCustomFilter</B></A></UL>
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="../../../index.html?org/libjpegturbo/turbojpeg/package-tree.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="package-tree.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/overview-tree.html b/java/doc/overview-tree.html
new file mode 100644
index 0000000..6f1e784
--- /dev/null
+++ b/java/doc/overview-tree.html
@@ -0,0 +1,163 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+Class Hierarchy
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="Class Hierarchy";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="index.html?overview-tree.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="overview-tree.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<CENTER>
+<H2>
+Hierarchy For All Packages</H2>
+</CENTER>
+<DL>
+<DT><B>Package Hierarchies:</B><DD><A HREF="org/libjpegturbo/turbojpeg/package-tree.html">org.libjpegturbo.turbojpeg</A></DL>
+<HR>
+<H2>
+Class Hierarchy
+</H2>
+<UL>
+<LI TYPE="circle">java.lang.Object<UL>
+<LI TYPE="circle">java.awt.geom.RectangularShape (implements java.lang.Cloneable, java.awt.Shape)
+<UL>
+<LI TYPE="circle">java.awt.geom.Rectangle2D<UL>
+<LI TYPE="circle">java.awt.Rectangle (implements java.io.Serializable, java.awt.Shape)
+<UL>
+<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg"><B>TJTransform</B></A></UL>
+</UL>
+</UL>
+<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJ.html" title="class in org.libjpegturbo.turbojpeg"><B>TJ</B></A><LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJCompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJCompressor</B></A><LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJDecompressor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJDecompressor</B></A><UL>
+<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJTransformer.html" title="class in org.libjpegturbo.turbojpeg"><B>TJTransformer</B></A></UL>
+<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJScalingFactor.html" title="class in org.libjpegturbo.turbojpeg"><B>TJScalingFactor</B></A></UL>
+</UL>
+<H2>
+Interface Hierarchy
+</H2>
+<UL>
+<LI TYPE="circle">org.libjpegturbo.turbojpeg.<A HREF="org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg"><B>TJCustomFilter</B></A></UL>
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Tree</B></FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="index.html?overview-tree.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="overview-tree.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/package-list b/java/doc/package-list
new file mode 100644
index 0000000..918d936
--- /dev/null
+++ b/java/doc/package-list
@@ -0,0 +1 @@
+org.libjpegturbo.turbojpeg
diff --git a/java/doc/resources/inherit.gif b/java/doc/resources/inherit.gif
new file mode 100644
index 0000000..c814867
--- /dev/null
+++ b/java/doc/resources/inherit.gif
Binary files differ
diff --git a/java/doc/serialized-form.html b/java/doc/serialized-form.html
new file mode 100644
index 0000000..c1a0b75
--- /dev/null
+++ b/java/doc/serialized-form.html
@@ -0,0 +1,202 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<!--NewPage-->
+<HTML>
+<HEAD>
+<!-- Generated by javadoc (build 1.6.0_26) on Mon Sep 19 23:46:08 CDT 2011 -->
+<TITLE>
+Serialized Form
+</TITLE>
+
+<META NAME="date" CONTENT="2011-09-19">
+
+<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
+
+<SCRIPT type="text/javascript">
+function windowTitle()
+{
+ if (location.href.indexOf('is-external=true') == -1) {
+ parent.document.title="Serialized Form";
+ }
+}
+</SCRIPT>
+<NOSCRIPT>
+</NOSCRIPT>
+
+</HEAD>
+
+<BODY BGCOLOR="white" onload="windowTitle();">
+<HR>
+
+
+<!-- ========= START OF TOP NAVBAR ======= -->
+<A NAME="navbar_top"><!-- --></A>
+<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_top_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="index.html?serialized-form.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="serialized-form.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_top"></A>
+<!-- ========= END OF TOP NAVBAR ========= -->
+
+<HR>
+<CENTER>
+<H1>
+Serialized Form</H1>
+</CENTER>
+<HR SIZE="4" NOSHADE>
+
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="center"><FONT SIZE="+2">
+<B>Package</B> <B>org.libjpegturbo.turbojpeg</B></FONT></TH>
+</TR>
+</TABLE>
+
+<P>
+<A NAME="org.libjpegturbo.turbojpeg.TJTransform"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableSubHeadingColor">
+<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
+<B>Class <A HREF="org/libjpegturbo/turbojpeg/TJTransform.html" title="class in org.libjpegturbo.turbojpeg">org.libjpegturbo.turbojpeg.TJTransform</A> extends java.awt.Rectangle implements Serializable</B></FONT></TH>
+</TR>
+</TABLE>
+
+<P>
+<B>serialVersionUID: </B>-127367705761430371L
+
+<P>
+<A NAME="serializedForm"><!-- --></A>
+<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
+<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
+<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
+<B>Serialized Fields</B></FONT></TH>
+</TR>
+</TABLE>
+
+<H3>
+op</H3>
+<PRE>
+int <B>op</B></PRE>
+<DL>
+<DD>Transform operation (one of <code>OP_*</code>)
+<P>
+<DL>
+</DL>
+</DL>
+<HR>
+<H3>
+options</H3>
+<PRE>
+int <B>options</B></PRE>
+<DL>
+<DD>Transform options (bitwise OR of one or more of <code>OPT_*</code>)
+<P>
+<DL>
+</DL>
+</DL>
+<HR>
+<H3>
+cf</H3>
+<PRE>
+<A HREF="org/libjpegturbo/turbojpeg/TJCustomFilter.html" title="interface in org.libjpegturbo.turbojpeg">TJCustomFilter</A> <B>cf</B></PRE>
+<DL>
+<DD>Custom filter instance
+<P>
+<DL>
+</DL>
+</DL>
+
+<P>
+<HR>
+
+
+<!-- ======= START OF BOTTOM NAVBAR ====== -->
+<A NAME="navbar_bottom"><!-- --></A>
+<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
+<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
+<TR>
+<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
+<A NAME="navbar_bottom_firstrow"><!-- --></A>
+<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
+ <TR ALIGN="center" VALIGN="top">
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="org/libjpegturbo/turbojpeg/package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
+ <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
+ </TR>
+</TABLE>
+</TD>
+<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
+</EM>
+</TD>
+</TR>
+
+<TR>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ PREV
+ NEXT</FONT></TD>
+<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
+ <A HREF="index.html?serialized-form.html" target="_top"><B>FRAMES</B></A>
+ <A HREF="serialized-form.html" target="_top"><B>NO FRAMES</B></A>
+ <SCRIPT type="text/javascript">
+ <!--
+ if(window==top) {
+ document.writeln('<A HREF="allclasses-noframe.html"><B>All Classes</B></A>');
+ }
+ //-->
+</SCRIPT>
+<NOSCRIPT>
+ <A HREF="allclasses-noframe.html"><B>All Classes</B></A>
+</NOSCRIPT>
+
+
+</FONT></TD>
+</TR>
+</TABLE>
+<A NAME="skip-navbar_bottom"></A>
+<!-- ======== END OF BOTTOM NAVBAR ======= -->
+
+<HR>
+
+</BODY>
+</HTML>
diff --git a/java/doc/stylesheet.css b/java/doc/stylesheet.css
new file mode 100644
index 0000000..6ea9e51
--- /dev/null
+++ b/java/doc/stylesheet.css
@@ -0,0 +1,29 @@
+/* Javadoc style sheet */
+
+/* Define colors, fonts and other style attributes here to override the defaults */
+
+/* Page background color */
+body { background-color: #FFFFFF; color:#000000 }
+
+/* Headings */
+h1 { font-size: 145% }
+
+/* Table colors */
+.TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */
+.TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */
+.TableRowColor { background: #FFFFFF; color:#000000 } /* White */
+
+/* Font used in left-hand frame lists */
+.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
+.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
+.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 }
+
+/* Navigation bar fonts and colors */
+.NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */
+.NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */
+.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;}
+.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;}
+
+.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000}
+.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000}
+
diff --git a/java/org/libjpegturbo/turbojpeg/TJ.java b/java/org/libjpegturbo/turbojpeg/TJ.java
new file mode 100644
index 0000000..cd22ee0
--- /dev/null
+++ b/java/org/libjpegturbo/turbojpeg/TJ.java
@@ -0,0 +1,322 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+package org.libjpegturbo.turbojpeg;
+
+/**
+ * TurboJPEG utility class (cannot be instantiated)
+ */
+final public class TJ {
+
+
+ /**
+ * The number of chrominance subsampling options
+ */
+ final public static int NUMSAMP = 5;
+ /**
+ * 4:4:4 chrominance subsampling (no chrominance subsampling). The JPEG
+ * or YUV image will contain one chrominance component for every pixel in the
+ * source image.
+ */
+ final public static int SAMP_444 = 0;
+ /**
+ * 4:2:2 chrominance subsampling. The JPEG or YUV image will contain one
+ * chrominance component for every 2x1 block of pixels in the source image.
+ */
+ final public static int SAMP_422 = 1;
+ /**
+ * 4:2:0 chrominance subsampling. The JPEG or YUV image will contain one
+ * chrominance component for every 2x2 block of pixels in the source image.
+ */
+ final public static int SAMP_420 = 2;
+ /**
+ * Grayscale. The JPEG or YUV image will contain no chrominance components.
+ */
+ final public static int SAMP_GRAY = 3;
+ /**
+ * 4:4:0 chrominance subsampling. The JPEG or YUV image will contain one
+ * chrominance component for every 1x2 block of pixels in the source image.
+ */
+ final public static int SAMP_440 = 4;
+
+
+ /**
+ * Returns the MCU block width for the given level of chrominance
+ * subsampling.
+ *
+ * @param subsamp the level of chrominance subsampling (one of
+ * <code>SAMP_*</code>)
+ *
+ * @return the MCU block width for the given level of chrominance subsampling
+ */
+ public static int getMCUWidth(int subsamp) throws Exception {
+ if(subsamp < 0 || subsamp >= NUMSAMP)
+ throw new Exception("Invalid subsampling type");
+ return mcuWidth[subsamp];
+ }
+
+ final private static int mcuWidth[] = {
+ 8, 16, 16, 8, 8
+ };
+
+
+ /**
+ * Returns the MCU block height for the given level of chrominance
+ * subsampling.
+ *
+ * @param subsamp the level of chrominance subsampling (one of
+ * <code>SAMP_*</code>)
+ *
+ * @return the MCU block height for the given level of chrominance
+ * subsampling
+ */
+ public static int getMCUHeight(int subsamp) throws Exception {
+ if(subsamp < 0 || subsamp >= NUMSAMP)
+ throw new Exception("Invalid subsampling type");
+ return mcuHeight[subsamp];
+ }
+
+ final private static int mcuHeight[] = {
+ 8, 8, 16, 8, 16
+ };
+
+
+ /**
+ * The number of pixel formats
+ */
+ final public static int NUMPF = 7;
+ /**
+ * RGB pixel format. The red, green, and blue components in the image are
+ * stored in 3-byte pixels in the order R, G, B from lowest to highest byte
+ * address within each pixel.
+ */
+ final public static int PF_RGB = 0;
+ /**
+ * BGR pixel format. The red, green, and blue components in the image are
+ * stored in 3-byte pixels in the order B, G, R from lowest to highest byte
+ * address within each pixel.
+ */
+ final public static int PF_BGR = 1;
+ /**
+ * RGBX pixel format. The red, green, and blue components in the image are
+ * stored in 4-byte pixels in the order R, G, B from lowest to highest byte
+ * address within each pixel.
+ */
+ final public static int PF_RGBX = 2;
+ /**
+ * BGRX pixel format. The red, green, and blue components in the image are
+ * stored in 4-byte pixels in the order B, G, R from lowest to highest byte
+ * address within each pixel.
+ */
+ final public static int PF_BGRX = 3;
+ /**
+ * XBGR pixel format. The red, green, and blue components in the image are
+ * stored in 4-byte pixels in the order R, G, B from highest to lowest byte
+ * address within each pixel.
+ */
+ final public static int PF_XBGR = 4;
+ /**
+ * XRGB pixel format. The red, green, and blue components in the image are
+ * stored in 4-byte pixels in the order B, G, R from highest to lowest byte
+ * address within each pixel.
+ */
+ final public static int PF_XRGB = 5;
+ /**
+ * Grayscale pixel format. Each 1-byte pixel represents a luminance
+ * (brightness) level from 0 to 255.
+ */
+ final public static int PF_GRAY = 6;
+
+
+ /**
+ * Returns the pixel size (in bytes) of the given pixel format.
+ *
+ * @param pixelFormat the pixel format (one of <code>PF_*</code>)
+ *
+ * @return the pixel size (in bytes) of the given pixel format
+ */
+ public static int getPixelSize(int pixelFormat) throws Exception {
+ if(pixelFormat < 0 || pixelFormat >= NUMPF)
+ throw new Exception("Invalid pixel format");
+ return pixelSize[pixelFormat];
+ }
+
+ final private static int pixelSize[] = {
+ 3, 3, 4, 4, 4, 4, 1
+ };
+
+
+ /**
+ * For the given pixel format, returns the number of bytes that the red
+ * component is offset from the start of the pixel. For instance, if a pixel
+ * of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
+ * then the red component will be
+ * <code>pixel[TJ.getRedOffset(TJ.PF_BGRX)]</code>.
+ *
+ * @param pixelFormat the pixel format (one of <code>PF_*</code>)
+ *
+ * @return the red offset for the given pixel format
+ */
+ public static int getRedOffset(int pixelFormat) throws Exception {
+ if(pixelFormat < 0 || pixelFormat >= NUMPF)
+ throw new Exception("Invalid pixel format");
+ return redOffset[pixelFormat];
+ }
+
+ final private static int redOffset[] = {
+ 0, 2, 0, 2, 3, 1, 0
+ };
+
+
+ /**
+ * For the given pixel format, returns the number of bytes that the green
+ * component is offset from the start of the pixel. For instance, if a pixel
+ * of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
+ * then the green component will be
+ * <code>pixel[TJ.getGreenOffset(TJ.PF_BGRX)]</code>.
+ *
+ * @param pixelFormat the pixel format (one of <code>PF_*</code>)
+ *
+ * @return the green offset for the given pixel format
+ */
+ public static int getGreenOffset(int pixelFormat) throws Exception {
+ if(pixelFormat < 0 || pixelFormat >= NUMPF)
+ throw new Exception("Invalid pixel format");
+ return greenOffset[pixelFormat];
+ }
+
+ final private static int greenOffset[] = {
+ 1, 1, 1, 1, 2, 2, 0
+ };
+
+
+ /**
+ * For the given pixel format, returns the number of bytes that the blue
+ * component is offset from the start of the pixel. For instance, if a pixel
+ * of format <code>TJ.PF_BGRX</code> is stored in <code>char pixel[]</code>,
+ * then the blue component will be
+ * <code>pixel[TJ.getBlueOffset(TJ.PF_BGRX)]</code>.
+ *
+ * @param pixelFormat the pixel format (one of <code>PF_*</code>)
+ *
+ * @return the blue offset for the given pixel format
+ */
+ public static int getBlueOffset(int pixelFormat) throws Exception {
+ if(pixelFormat < 0 || pixelFormat >= NUMPF)
+ throw new Exception("Invalid pixel format");
+ return blueOffset[pixelFormat];
+ }
+
+ final private static int blueOffset[] = {
+ 2, 0, 2, 0, 1, 3, 0
+ };
+
+
+ /**
+ * The uncompressed source/destination image is stored in bottom-up (Windows,
+ * OpenGL) order, not top-down (X11) order.
+ */
+ final public static int FLAG_BOTTOMUP = 2;
+ /**
+ * Turn off CPU auto-detection and force TurboJPEG to use MMX code
+ * (IPP and 32-bit libjpeg-turbo versions only.)
+ */
+ final public static int FLAG_FORCEMMX = 8;
+ /**
+ * Turn off CPU auto-detection and force TurboJPEG to use SSE code
+ * (32-bit IPP and 32-bit libjpeg-turbo versions only.)
+ */
+ final public static int FLAG_FORCESSE = 16;
+ /**
+ * Turn off CPU auto-detection and force TurboJPEG to use SSE2 code
+ * (32-bit IPP and 32-bit libjpeg-turbo versions only.)
+ */
+ final public static int FLAG_FORCESSE2 = 32;
+ /**
+ * Turn off CPU auto-detection and force TurboJPEG to use SSE3 code
+ *(64-bit IPP version only.)
+ */
+ final public static int FLAG_FORCESSE3 = 128;
+ /**
+ * Use fast, inaccurate chrominance upsampling routines in the JPEG
+ * decompressor (libjpeg and libjpeg-turbo versions only.)
+ */
+ final public static int FLAG_FASTUPSAMPLE = 256;
+
+
+ /**
+ * Returns the maximum size of the buffer (in bytes) required to hold a JPEG
+ * image with the given width and height, and level of chrominance
+ * subsampling.
+ *
+ * @param width the width (in pixels) of the JPEG image
+ *
+ * @param height the height (in pixels) of the JPEG image
+ *
+ * @param jpegSubsamp the level of chrominance subsampling to be used when
+ * generating the JPEG image (one of {@link TJ TJ.SAMP_*})
+ *
+ * @return the maximum size of the buffer (in bytes) required to hold a JPEG
+ * image with the given width and height, and level of chrominance
+ * subsampling
+ */
+ public native static int bufSize(int width, int height, int jpegSubsamp)
+ throws Exception;
+
+ /**
+ * Returns the size of the buffer (in bytes) required to hold a YUV planar
+ * image with the given width, height, and level of chrominance subsampling.
+ *
+ * @param width the width (in pixels) of the YUV image
+ *
+ * @param height the height (in pixels) of the YUV image
+ *
+ * @param subsamp the level of chrominance subsampling used in the YUV
+ * image (one of {@link TJ TJ.SAMP_*})
+ *
+ * @return the size of the buffer (in bytes) required to hold a YUV planar
+ * image with the given width, height, and level of chrominance subsampling
+ */
+ public native static int bufSizeYUV(int width, int height,
+ int subsamp)
+ throws Exception;
+
+ /**
+ * Returns a list of fractional scaling factors that the JPEG decompressor in
+ * this implementation of TurboJPEG supports.
+ *
+ * @return a list of fractional scaling factors that the JPEG decompressor in
+ * this implementation of TurboJPEG supports
+ */
+ public native static TJScalingFactor[] getScalingFactors()
+ throws Exception;
+
+ static {
+ TJLoader.load();
+ }
+};
diff --git a/java/org/libjpegturbo/turbojpeg/TJCompressor.java b/java/org/libjpegturbo/turbojpeg/TJCompressor.java
new file mode 100644
index 0000000..8c6a608
--- /dev/null
+++ b/java/org/libjpegturbo/turbojpeg/TJCompressor.java
@@ -0,0 +1,470 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+package org.libjpegturbo.turbojpeg;
+
+import java.awt.image.*;
+import java.nio.*;
+
+/**
+ * TurboJPEG compressor
+ */
+public class TJCompressor {
+
+ private final static String NO_ASSOC_ERROR =
+ "No source image is associated with this instance";
+
+ /**
+ * Create a TurboJPEG compressor instance.
+ */
+ public TJCompressor() throws Exception {
+ init();
+ }
+
+ /**
+ * Create a TurboJPEG compressor instance and associate the uncompressed
+ * source image stored in <code>srcImage</code> with the newly-created
+ * instance.
+ *
+ * @param srcImage see {@link #setSourceImage} for description
+ *
+ * @param width see {@link #setSourceImage} for description
+ *
+ * @param pitch see {@link #setSourceImage} for description
+ *
+ * @param height see {@link #setSourceImage} for description
+ *
+ * @param pixelFormat see {@link #setSourceImage} for description
+ */
+ public TJCompressor(byte[] srcImage, int width, int pitch, int height,
+ int pixelFormat) throws Exception {
+ setSourceImage(srcImage, width, pitch, height, pixelFormat);
+ }
+
+ /**
+ * Associate an uncompressed source image with this compressor instance.
+ *
+ * @param srcImage image buffer containing RGB or grayscale pixels to be
+ * compressed
+ *
+ * @param width width (in pixels) of the source image
+ *
+ * @param pitch bytes per line of the source image. Normally, this should be
+ * <code>width * TJ.pixelSize(pixelFormat)</code> if the source image is
+ * unpadded, but you can use this parameter to, for instance, specify that
+ * the scanlines in the source image are padded to 4-byte boundaries, 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 *
+ * TJ.pixelSize(pixelFormat)</code>.
+ *
+ * @param height height (in pixels) of the source image
+ *
+ * @param pixelFormat pixel format of the source image (one of
+ * {@link TJ TJ.PF_*})
+ */
+ public void setSourceImage(byte[] srcImage, int width, int pitch,
+ int height, int pixelFormat) throws Exception {
+ if(handle == 0) init();
+ if(srcImage == null || width < 1 || height < 1 || pitch < 0
+ || pixelFormat < 0 || pixelFormat >= TJ.NUMPF)
+ throw new Exception("Invalid argument in setSourceImage()");
+ srcBuf = srcImage;
+ srcWidth = width;
+ if(pitch == 0) srcPitch = width * TJ.getPixelSize(pixelFormat);
+ else srcPitch = pitch;
+ srcHeight = height;
+ srcPixelFormat = pixelFormat;
+ }
+
+ /**
+ * Set the level of chrominance subsampling for subsequent compress/encode
+ * operations.
+ *
+ * @param newSubsamp the new level of chrominance subsampling (one of
+ * {@link TJ TJ.SAMP_*})
+ */
+ public void setSubsamp(int newSubsamp) throws Exception {
+ if(newSubsamp < 0 || newSubsamp >= TJ.NUMSAMP)
+ throw new Exception("Invalid argument in setSubsamp()");
+ subsamp = newSubsamp;
+ }
+
+ /**
+ * Set the JPEG image quality level for subsequent compress operations.
+ *
+ * @param quality the new JPEG image quality level (1 to 100, 1 = worst,
+ * 100 = best)
+ */
+ public void setJPEGQuality(int quality) throws Exception {
+ if(quality < 1 || quality > 100)
+ throw new Exception("Invalid argument in setJPEGQuality()");
+ jpegQuality = quality;
+ }
+
+ /**
+ * Compress the uncompressed source image associated with this compressor
+ * instance and output a JPEG image to the given destination buffer.
+ *
+ * @param dstBuf buffer which will receive the JPEG image. Use
+ * {@link TJ#bufSize} to determine the maximum size for this buffer based on
+ * the image width and height.
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ */
+ public void compress(byte[] dstBuf, int flags) throws Exception {
+ if(dstBuf == null || flags < 0)
+ throw new Exception("Invalid argument in compress()");
+ if(srcBuf == null) throw new Exception(NO_ASSOC_ERROR);
+ if(jpegQuality < 0) throw new Exception("JPEG Quality not set");
+ if(subsamp < 0) throw new Exception("Subsampling level not set");
+ compressedSize = compress(srcBuf, srcWidth, srcPitch,
+ srcHeight, srcPixelFormat, dstBuf, subsamp, jpegQuality, flags);
+ }
+
+ /**
+ * Compress the uncompressed source image associated with this compressor
+ * instance and return a buffer containing a JPEG image.
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ *
+ * @return a buffer containing a JPEG image. The length of this buffer will
+ * not be equal to the size of the JPEG image. Use {@link
+ * #getCompressedSize} to obtain the size of the JPEG image.
+ */
+ public byte[] compress(int flags) throws Exception {
+ if(srcWidth < 1 || srcHeight < 1)
+ throw new Exception(NO_ASSOC_ERROR);
+ byte[] buf = new byte[TJ.bufSize(srcWidth, srcHeight, subsamp)];
+ compress(buf, flags);
+ return buf;
+ }
+
+ /**
+ * Compress the uncompressed source image stored in <code>srcImage</code>
+ * and output a JPEG image to the given destination buffer.
+ *
+ * @param srcImage a <code>BufferedImage</code> instance containing RGB or
+ * grayscale pixels to be compressed
+ *
+ * @param dstBuf buffer which will receive the JPEG image. Use
+ * {@link TJ#bufSize} to determine the maximum size for this buffer based on
+ * the image width and height.
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ */
+ public void compress(BufferedImage srcImage, byte[] dstBuf, int flags)
+ throws Exception {
+ if(srcImage == null || dstBuf == null || flags < 0)
+ throw new Exception("Invalid argument in compress()");
+ int width = srcImage.getWidth();
+ int height = srcImage.getHeight();
+ int pixelFormat; boolean intPixels = false;
+ if(byteOrder == null)
+ byteOrder = ByteOrder.nativeOrder();
+ switch(srcImage.getType()) {
+ case BufferedImage.TYPE_3BYTE_BGR:
+ pixelFormat = TJ.PF_BGR; break;
+ case BufferedImage.TYPE_4BYTE_ABGR:
+ case BufferedImage.TYPE_4BYTE_ABGR_PRE:
+ pixelFormat = TJ.PF_XBGR; break;
+ case BufferedImage.TYPE_BYTE_GRAY:
+ pixelFormat = TJ.PF_GRAY; break;
+ case BufferedImage.TYPE_INT_BGR:
+ if(byteOrder == ByteOrder.BIG_ENDIAN)
+ pixelFormat = TJ.PF_XBGR;
+ else
+ pixelFormat = TJ.PF_RGBX;
+ intPixels = true; break;
+ case BufferedImage.TYPE_INT_RGB:
+ case BufferedImage.TYPE_INT_ARGB:
+ case BufferedImage.TYPE_INT_ARGB_PRE:
+ if(byteOrder == ByteOrder.BIG_ENDIAN)
+ pixelFormat = TJ.PF_XRGB;
+ else
+ pixelFormat = TJ.PF_BGRX;
+ intPixels = true; break;
+ default:
+ throw new Exception("Unsupported BufferedImage format");
+ }
+ WritableRaster wr = srcImage.getRaster();
+ if(jpegQuality < 0) throw new Exception("JPEG Quality not set");
+ if(subsamp < 0) throw new Exception("Subsampling level not set");
+ if(intPixels) {
+ SinglePixelPackedSampleModel sm =
+ (SinglePixelPackedSampleModel)srcImage.getSampleModel();
+ int pitch = sm.getScanlineStride();
+ DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
+ int[] buf = db.getData();
+ compressedSize = compress(buf, width, pitch, height, pixelFormat, dstBuf,
+ subsamp, jpegQuality, flags);
+ }
+ else {
+ ComponentSampleModel sm =
+ (ComponentSampleModel)srcImage.getSampleModel();
+ int pixelSize = sm.getPixelStride();
+ if(pixelSize != TJ.getPixelSize(pixelFormat))
+ throw new Exception("Inconsistency between pixel format and pixel size in BufferedImage");
+ int pitch = sm.getScanlineStride();
+ DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
+ byte[] buf = db.getData();
+ compressedSize = compress(buf, width, pitch, height, pixelFormat, dstBuf,
+ subsamp, jpegQuality, flags);
+ }
+ }
+
+ /**
+ * Compress the uncompressed source image stored in <code>srcImage</code>
+ * and return a buffer containing a JPEG image.
+ *
+ * @param srcImage a <code>BufferedImage</code> instance containing RGB or
+ * grayscale pixels to be compressed
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ *
+ * @return a buffer containing a JPEG image. The length of this buffer will
+ * not be equal to the size of the JPEG image. Use {@link
+ * #getCompressedSize} to obtain the size of the JPEG image.
+ */
+ public byte[] compress(BufferedImage srcImage, int flags) throws Exception {
+ int width = srcImage.getWidth();
+ int height = srcImage.getHeight();
+ byte[] buf = new byte[TJ.bufSize(width, height, subsamp)];
+ compress(srcImage, buf, flags);
+ return buf;
+ }
+
+ /**
+ * Encode the uncompressed source image associated with this compressor
+ * instance and output a YUV planar image to the given destination buffer.
+ * This method uses the accelerated color conversion routines in
+ * TurboJPEG's underlying codec to produce a planar YUV image that is
+ * suitable for direct video display. Specifically, if the chrominance
+ * components are subsampled along the horizontal dimension, then the width
+ * of the luminance plane is padded to 2 in the output image (same goes for
+ * the height of the luminance plane, if the chrominance components are
+ * subsampled along the vertical dimension.) Also, each line of each plane
+ * in the output image is padded to 4 bytes. Although this will work with
+ * any subsampling option, it is really only useful in combination with
+ * {@link TJ#SAMP_420}, which produces an image compatible with the I420 (AKA
+ * "YUV420P") format.
+ *
+ * @param dstBuf buffer which will receive the YUV planar image. Use
+ * {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
+ * based on the image width, height, and level of chrominance subsampling.
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ */
+ public void encodeYUV(byte[] dstBuf, int flags) throws Exception {
+ if(dstBuf == null || flags < 0)
+ throw new Exception("Invalid argument in compress()");
+ if(srcBuf == null) throw new Exception(NO_ASSOC_ERROR);
+ if(subsamp < 0) throw new Exception("Subsampling level not set");
+ encodeYUV(srcBuf, srcWidth, srcPitch, srcHeight,
+ srcPixelFormat, dstBuf, subsamp, flags);
+ compressedSize = TJ.bufSizeYUV(srcWidth, srcHeight, subsamp);
+ }
+
+ /**
+ * Encode the uncompressed source image associated with this compressor
+ * instance and return a buffer containing a YUV planar image. See
+ * {@link #encodeYUV(byte[], int)} for more detail.
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ *
+ * @return a buffer containing a YUV planar image
+ */
+ public byte[] encodeYUV(int flags) throws Exception {
+ if(srcWidth < 1 || srcHeight < 1)
+ throw new Exception(NO_ASSOC_ERROR);
+ if(subsamp < 0) throw new Exception("Subsampling level not set");
+ byte[] buf = new byte[TJ.bufSizeYUV(srcWidth, srcHeight, subsamp)];
+ encodeYUV(buf, flags);
+ return buf;
+ }
+
+ /**
+ * Encode the uncompressed source image stored in <code>srcImage</code>
+ * and output a YUV planar image to the given destination buffer. See
+ * {@link #encodeYUV(byte[], int)} for more detail.
+ *
+ * @param srcImage a <code>BufferedImage</code> instance containing RGB or
+ * grayscale pixels to be encoded
+ *
+ * @param dstBuf buffer which will receive the YUV planar image. Use
+ * {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
+ * based on the image width, height, and level of chrominance subsampling.
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ */
+ public void encodeYUV(BufferedImage srcImage, byte[] dstBuf, int flags)
+ throws Exception {
+ if(srcImage == null || dstBuf == null || flags < 0)
+ throw new Exception("Invalid argument in encodeYUV()");
+ int width = srcImage.getWidth();
+ int height = srcImage.getHeight();
+ int pixelFormat; boolean intPixels = false;
+ if(byteOrder == null)
+ byteOrder = ByteOrder.nativeOrder();
+ switch(srcImage.getType()) {
+ case BufferedImage.TYPE_3BYTE_BGR:
+ pixelFormat = TJ.PF_BGR; break;
+ case BufferedImage.TYPE_4BYTE_ABGR:
+ case BufferedImage.TYPE_4BYTE_ABGR_PRE:
+ pixelFormat = TJ.PF_XBGR; break;
+ case BufferedImage.TYPE_BYTE_GRAY:
+ pixelFormat = TJ.PF_GRAY; break;
+ case BufferedImage.TYPE_INT_BGR:
+ if(byteOrder == ByteOrder.BIG_ENDIAN)
+ pixelFormat = TJ.PF_XBGR;
+ else
+ pixelFormat = TJ.PF_RGBX;
+ intPixels = true; break;
+ case BufferedImage.TYPE_INT_RGB:
+ case BufferedImage.TYPE_INT_ARGB:
+ case BufferedImage.TYPE_INT_ARGB_PRE:
+ if(byteOrder == ByteOrder.BIG_ENDIAN)
+ pixelFormat = TJ.PF_XRGB;
+ else
+ pixelFormat = TJ.PF_BGRX;
+ intPixels = true; break;
+ default:
+ throw new Exception("Unsupported BufferedImage format");
+ }
+ WritableRaster wr = srcImage.getRaster();
+ if(subsamp < 0) throw new Exception("Subsampling level not set");
+ if(intPixels) {
+ SinglePixelPackedSampleModel sm =
+ (SinglePixelPackedSampleModel)srcImage.getSampleModel();
+ int pitch = sm.getScanlineStride();
+ DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
+ int[] buf = db.getData();
+ encodeYUV(buf, width, pitch, height, pixelFormat, dstBuf, subsamp,
+ flags);
+ }
+ else {
+ ComponentSampleModel sm =
+ (ComponentSampleModel)srcImage.getSampleModel();
+ int pixelSize = sm.getPixelStride();
+ if(pixelSize != TJ.getPixelSize(pixelFormat))
+ throw new Exception("Inconsistency between pixel format and pixel size in BufferedImage");
+ int pitch = sm.getScanlineStride();
+ DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
+ byte[] buf = db.getData();
+ encodeYUV(buf, width, pitch, height, pixelFormat, dstBuf, subsamp,
+ flags);
+ }
+ compressedSize = TJ.bufSizeYUV(width, height, subsamp);
+ }
+
+ /**
+ * Encode the uncompressed source image stored in <code>srcImage</code>
+ * and return a buffer containing a YUV planar image. See
+ * {@link #encodeYUV(byte[], int)} for more detail.
+ *
+ * @param srcImage a <code>BufferedImage</code> instance containing RGB or
+ * grayscale pixels to be encoded
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ *
+ * @return a buffer containing a YUV planar image
+ */
+ public byte[] encodeYUV(BufferedImage srcImage, int flags)
+ throws Exception {
+ if(subsamp < 0) throw new Exception("Subsampling level not set");
+ int width = srcImage.getWidth();
+ int height = srcImage.getHeight();
+ byte[] buf = new byte[TJ.bufSizeYUV(width, height, subsamp)];
+ encodeYUV(srcImage, buf, flags);
+ return buf;
+ }
+
+ /**
+ * Returns the size of the image (in bytes) generated by the most recent
+ * compress/encode operation.
+ *
+ * @return the size of the image (in bytes) generated by the most recent
+ * compress/encode operation
+ */
+ public int getCompressedSize() {
+ return compressedSize;
+ }
+
+ /**
+ * Free the native structures associated with this compressor instance.
+ */
+ public void close() throws Exception {
+ destroy();
+ }
+
+ protected void finalize() throws Throwable {
+ try {
+ close();
+ }
+ catch(Exception e) {}
+ finally {
+ super.finalize();
+ }
+ };
+
+ private native void init() throws Exception;
+
+ private native void destroy() throws Exception;
+
+ // JPEG size in bytes is returned
+ private native int compress(byte[] srcBuf, int width, int pitch,
+ int height, int pixelFormat, byte[] dstbuf, int jpegSubsamp, int jpegQual,
+ int flags) throws Exception;
+
+ private native int compress(int[] srcBuf, int width, int pitch,
+ int height, int pixelFormat, byte[] dstbuf, int jpegSubsamp, int jpegQual,
+ int flags) throws Exception;
+
+ private native void encodeYUV(byte[] srcBuf, int width, int pitch,
+ int height, int pixelFormat, byte[] dstbuf, int subsamp, int flags)
+ throws Exception;
+
+ private native void encodeYUV(int[] srcBuf, int width, int pitch,
+ int height, int pixelFormat, byte[] dstbuf, int subsamp, int flags)
+ throws Exception;
+
+ static {
+ TJLoader.load();
+ }
+
+ private long handle = 0;
+ private byte[] srcBuf = null;
+ private int srcWidth = 0;
+ private int srcHeight = 0;
+ private int srcPitch = 0;
+ private int srcPixelFormat = -1;
+ private int subsamp = -1;
+ private int jpegQuality = -1;
+ private int compressedSize = 0;
+ private ByteOrder byteOrder = null;
+};
diff --git a/java/org/libjpegturbo/turbojpeg/TJCustomFilter.java b/java/org/libjpegturbo/turbojpeg/TJCustomFilter.java
new file mode 100644
index 0000000..711225b
--- /dev/null
+++ b/java/org/libjpegturbo/turbojpeg/TJCustomFilter.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+package org.libjpegturbo.turbojpeg;
+
+import java.awt.*;
+import java.nio.*;
+
+/**
+ * Custom filter callback interface
+ */
+public interface TJCustomFilter {
+
+ /**
+ * A callback function that can be used to modify the DCT coefficients after
+ * they are losslessly transformed but before they are transcoded to a new
+ * JPEG file. This allows for custom filters or other transformations to be
+ * applied in the frequency domain.
+ *
+ * @param coeffBuffer a buffer containing transformed DCT coefficients.
+ * (NOTE: this buffer is not guaranteed to be valid once the callback
+ * returns, so applications wishing to hand off the DCT coefficients to
+ * another function or library should make a copy of them within the body of
+ * the callback.)
+ *
+ * @param bufferRegion rectangle containing the width and height of
+ * <code>coeffBuffer</code> as well as its offset relative to the component
+ * plane. TurboJPEG implementations may choose to split each component plane
+ * into multiple DCT coefficient buffers and call the callback function once
+ * for each buffer.
+ *
+ * @param planeRegion rectangle containing the width and height of the
+ * component plane to which <code>coeffBuffer</code> belongs
+ *
+ * @param componentID ID number of the component plane to which
+ * <code>coeffBuffer</code>belongs (Y, Cb, and Cr have, respectively, ID's of
+ * 0, 1, and 2 in typical JPEG images.)
+ *
+ * @param transformID ID number of the transformed image to which
+ * <code>coeffBuffer</code> belongs. This is the same as the index of the
+ * transform in the transforms array that was passed to {@link
+ * TJTransformer#transform TJTransformer.transform()}.
+ *
+ * @param transform a {@link TJTransform} instance that specifies the
+ * parameters and/or cropping region for this transform
+ */
+ public void customFilter(ShortBuffer coeffBuffer, Rectangle bufferRegion,
+ Rectangle planeRegion, int componentID, int transformID,
+ TJTransform transform)
+ throws Exception;
+}
diff --git a/java/org/libjpegturbo/turbojpeg/TJDecompressor.java b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
new file mode 100644
index 0000000..4be5494
--- /dev/null
+++ b/java/org/libjpegturbo/turbojpeg/TJDecompressor.java
@@ -0,0 +1,515 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+package org.libjpegturbo.turbojpeg;
+
+import java.awt.image.*;
+import java.nio.*;
+
+/**
+ * TurboJPEG decompressor
+ */
+public class TJDecompressor {
+
+ private final static String NO_ASSOC_ERROR =
+ "No JPEG image is associated with this instance";
+
+ /**
+ * Create a TurboJPEG decompresssor instance.
+ */
+ public TJDecompressor() throws Exception {
+ init();
+ }
+
+ /**
+ * Create a TurboJPEG decompressor instance and associate the JPEG 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)
+ */
+ public TJDecompressor(byte[] jpegImage) throws Exception {
+ init();
+ setJPEGImage(jpegImage, jpegImage.length);
+ }
+
+ /**
+ * Create a TurboJPEG decompressor instance and associate the JPEG image
+ * of length <code>imageSize</code> bytes stored in <code>jpegImage</code>
+ * with the newly-created instance.
+ *
+ * @param jpegImage JPEG image buffer
+ *
+ * @param imageSize size of the JPEG image (in bytes)
+ */
+ public TJDecompressor(byte[] jpegImage, int imageSize) throws Exception {
+ init();
+ setJPEGImage(jpegImage, imageSize);
+ }
+
+ /**
+ * 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.
+ *
+ * @param jpegImage JPEG image buffer
+ *
+ * @param imageSize size of the JPEG image (in bytes)
+ */
+ public void setJPEGImage(byte[] jpegImage, int imageSize) throws Exception {
+ if(jpegImage == null || imageSize < 1)
+ throw new Exception("Invalid argument in setJPEGImage()");
+ jpegBuf = jpegImage;
+ jpegBufSize = imageSize;
+ decompressHeader(jpegBuf, jpegBufSize);
+ }
+
+ /**
+ * Returns the width of the JPEG image associated with this decompressor
+ * instance.
+ *
+ * @return the width of the JPEG image associated with this decompressor
+ * instance
+ */
+ public int getWidth() throws Exception {
+ if(jpegWidth < 1) throw new Exception(NO_ASSOC_ERROR);
+ return jpegWidth;
+ }
+
+ /**
+ * Returns the height of the JPEG image associated with this decompressor
+ * instance.
+ *
+ * @return the height of the JPEG image associated with this decompressor
+ * instance
+ */
+ public int getHeight() throws Exception {
+ if(jpegHeight < 1) throw new Exception(NO_ASSOC_ERROR);
+ return jpegHeight;
+ }
+
+ /**
+ * Returns the level of chrominance subsampling used in the JPEG image
+ * associated with this decompressor instance.
+ *
+ * @return the level of chrominance subsampling used in the JPEG image
+ * associated with this decompressor instance
+ */
+ public int getSubsamp() throws Exception {
+ if(jpegSubsamp < 0) throw new Exception(NO_ASSOC_ERROR);
+ if(jpegSubsamp >= TJ.NUMSAMP)
+ throw new Exception("JPEG header information is invalid");
+ return jpegSubsamp;
+ }
+
+ /**
+ * Returns the JPEG image buffer associated with this decompressor instance.
+ *
+ * @return the JPEG image buffer associated with this decompressor instance
+ */
+ public byte[] getJPEGBuf() throws Exception {
+ if(jpegBuf == null) throw new Exception(NO_ASSOC_ERROR);
+ return jpegBuf;
+ }
+
+ /**
+ * Returns the size of the JPEG image (in bytes) associated with this
+ * decompressor instance.
+ *
+ * @return the size of the JPEG image (in bytes) associated with this
+ * decompressor instance
+ */
+ public int getJPEGSize() throws Exception {
+ if(jpegBufSize < 1) throw new Exception(NO_ASSOC_ERROR);
+ return jpegBufSize;
+ }
+
+
+ /**
+ * Returns the width of the largest scaled down image that the TurboJPEG
+ * decompressor can generate without exceeding the desired image width and
+ * height.
+ *
+ * @param desiredWidth desired width (in pixels) of the decompressed image.
+ * Setting this to 0 is the same as setting it to the width of the JPEG image
+ * (in other words, the width will not be considered when determining the
+ * scaled image size.)
+ *
+ * @param desiredHeight desired height (in pixels) of the decompressed image.
+ * Setting this to 0 is the same as setting it to the height of the JPEG
+ * image (in other words, the height will not be considered when determining
+ * the scaled image size.)
+ *
+ * @return the width of the largest scaled down image that the TurboJPEG
+ * decompressor can generate without exceeding the desired image width and
+ * height
+ */
+ public int getScaledWidth(int desiredWidth, int desiredHeight)
+ throws Exception {
+ if(jpegWidth < 1 || jpegHeight < 1)
+ throw new Exception(NO_ASSOC_ERROR);
+ if(desiredWidth < 0 || desiredHeight < 0)
+ throw new Exception("Invalid argument in getScaledWidth()");
+ TJScalingFactor sf[] = TJ.getScalingFactors();
+ if(desiredWidth == 0) desiredWidth = jpegWidth;
+ if(desiredHeight == 0) desiredHeight = jpegHeight;
+ int scaledWidth = jpegWidth, scaledHeight = jpegHeight;
+ for(int i = 0; i < sf.length; i++) {
+ scaledWidth = sf[i].getScaled(jpegWidth);
+ scaledHeight = sf[i].getScaled(jpegHeight);
+ if(scaledWidth <= desiredWidth && scaledHeight <= desiredHeight)
+ break;
+ }
+ if(scaledWidth > desiredWidth || scaledHeight > desiredHeight)
+ throw new Exception("Could not scale down to desired image dimensions");
+ return scaledWidth;
+ }
+
+ /**
+ * Returns the height of the largest scaled down image that the TurboJPEG
+ * decompressor can generate without exceeding the desired image width and
+ * height.
+ *
+ * @param desiredWidth desired width (in pixels) of the decompressed image.
+ * Setting this to 0 is the same as setting it to the width of the JPEG image
+ * (in other words, the width will not be considered when determining the
+ * scaled image size.)
+ *
+ * @param desiredHeight desired height (in pixels) of the decompressed image.
+ * Setting this to 0 is the same as setting it to the height of the JPEG
+ * image (in other words, the height will not be considered when determining
+ * the scaled image size.)
+ *
+ * @return the height of the largest scaled down image that the TurboJPEG
+ * decompressor can generate without exceeding the desired image width and
+ * height
+ */
+ public int getScaledHeight(int desiredWidth, int desiredHeight)
+ throws Exception {
+ if(jpegWidth < 1 || jpegHeight < 1)
+ throw new Exception(NO_ASSOC_ERROR);
+ if(desiredWidth < 0 || desiredHeight < 0)
+ throw new Exception("Invalid argument in getScaledHeight()");
+ TJScalingFactor sf[] = TJ.getScalingFactors();
+ if(desiredWidth == 0) desiredWidth = jpegWidth;
+ if(desiredHeight == 0) desiredHeight = jpegHeight;
+ int scaledWidth = jpegWidth, scaledHeight = jpegHeight;
+ for(int i = 0; i < sf.length; i++) {
+ scaledWidth = sf[i].getScaled(jpegWidth);
+ scaledHeight = sf[i].getScaled(jpegHeight);
+ if(scaledWidth <= desiredWidth && scaledHeight <= desiredHeight)
+ break;
+ }
+ if(scaledWidth > desiredWidth || scaledHeight > desiredHeight)
+ throw new Exception("Could not scale down to desired image dimensions");
+ return scaledHeight;
+ }
+
+ /**
+ * Decompress the JPEG source image associated with this decompressor
+ * instance and output a decompressed image to the given destination buffer.
+ *
+ * @param dstBuf buffer which 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 <code>
+ * scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegHeight)
+ * </code> with one of the scaling factors returned from {@link
+ * TJ#getScalingFactors} or by calling {@link #getScaledHeight}.
+ *
+ * @param desiredWidth desired width (in pixels) of the decompressed image.
+ * If the desired image dimensions are smaller than the dimensions 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 dimensions. Setting this to 0 is the same as setting it to
+ * the width of the JPEG image (in other words, the width will not be
+ * considered when determining the scaled image size.)
+ *
+ * @param pitch bytes per line of the destination image. Normally, this
+ * should be set to <code>scaledWidth * TJ.pixelSize(pixelFormat)</code> if
+ * the decompressed image is unpadded, but you can use this to, for instance,
+ * pad each line of the decompressed image to a 4-byte boundary. NOTE:
+ * <code>scaledWidth</code> can be determined by calling <code>
+ * scalingFactor.{@link TJScalingFactor#getScaled getScaled}(jpegWidth)
+ * </code> or by calling {@link #getScaledWidth}. Setting this parameter to
+ * 0 is the equivalent of setting it to <code>scaledWidth *
+ * TJ.pixelSize(pixelFormat)</code>.
+ *
+ * @param desiredHeight desired height (in pixels) of the decompressed image.
+ * If the desired image dimensions are smaller than the dimensions 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 dimensions. Setting this to 0 is the same as setting it to
+ * the height of the JPEG image (in other words, the height will not be
+ * considered when determining the scaled image size.)
+ *
+ * @param pixelFormat pixel format of the decompressed image (one of
+ * {@link TJ TJ.PF_*})
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ */
+ public void decompress(byte[] dstBuf, int desiredWidth, int pitch,
+ int desiredHeight, int pixelFormat, int flags) throws Exception {
+ if(jpegBuf == null) throw new Exception(NO_ASSOC_ERROR);
+ if(dstBuf == null || desiredWidth < 0 || pitch < 0 || desiredHeight < 0
+ || pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
+ throw new Exception("Invalid argument in decompress()");
+ decompress(jpegBuf, jpegBufSize, dstBuf, desiredWidth, pitch,
+ desiredHeight, pixelFormat, flags);
+ }
+
+ /**
+ * Decompress the JPEG source image associated with this decompressor
+ * instance and return a buffer containing the decompressed image.
+ *
+ * @param desiredWidth see
+ * {@link #decompress(byte[], int, int, int, int, int)} for description
+ *
+ * @param pitch see
+ * {@link #decompress(byte[], int, int, int, int, int)} for description
+ *
+ * @param desiredHeight see
+ * {@link #decompress(byte[], int, int, int, int, int)} for description
+ *
+ * @param pixelFormat pixel format of the decompressed image (one of
+ * {@link TJ TJ.PF_*})
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ *
+ * @return a buffer containing the decompressed image
+ */
+ public byte[] decompress(int desiredWidth, int pitch, int desiredHeight,
+ int pixelFormat, int flags) throws Exception {
+ if(desiredWidth < 0 || pitch < 0 || desiredHeight < 0
+ || pixelFormat < 0 || pixelFormat >= TJ.NUMPF || flags < 0)
+ throw new Exception("Invalid argument in decompress()");
+ int pixelSize = TJ.getPixelSize(pixelFormat);
+ int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
+ int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
+ if(pitch == 0) pitch = scaledWidth * pixelSize;
+ byte[] buf = new byte[pitch * scaledHeight];
+ decompress(buf, desiredWidth, pitch, desiredHeight, pixelFormat, flags);
+ return buf;
+ }
+
+ /**
+ * Decompress the JPEG source image associated with this decompressor
+ * instance and output a YUV planar image to the given destination buffer.
+ * This method performs JPEG decompression but leaves out the color
+ * conversion step, so a planar YUV image is generated instead of an RGB
+ * image. The padding of the planes in this image is the same as the images
+ * generated by {@link TJCompressor#encodeYUV(byte[], int)}. Note that, if
+ * the width or height of the image is not an even multiple of the MCU block
+ * size (see {@link TJ#getMCUWidth} and {@link TJ#getMCUHeight}), then an
+ * intermediate buffer copy will be performed within TurboJPEG.
+ *
+ * @param dstBuf buffer which will receive the YUV planar image. Use
+ * {@link TJ#bufSizeYUV} to determine the appropriate size for this buffer
+ * based on the image width, height, and level of chrominance subsampling.
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ */
+ public void decompressToYUV(byte[] dstBuf, int flags) throws Exception {
+ if(jpegBuf == null) throw new Exception(NO_ASSOC_ERROR);
+ if(dstBuf == null || flags < 0)
+ throw new Exception("Invalid argument in decompressToYUV()");
+ decompressToYUV(jpegBuf, jpegBufSize, dstBuf, flags);
+ }
+
+
+ /**
+ * Decompress the JPEG source image associated with this decompressor
+ * instance and return a buffer containing a YUV planar image. See {@link
+ * #decompressToYUV(byte[], int)} for more detail.
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ *
+ * @return a buffer containing a YUV planar image
+ */
+ public byte[] decompressToYUV(int flags) throws Exception {
+ if(flags < 0)
+ throw new Exception("Invalid argument in decompressToYUV()");
+ if(jpegWidth < 1 || jpegHeight < 1 || jpegSubsamp < 0)
+ throw new Exception(NO_ASSOC_ERROR);
+ if(jpegSubsamp >= TJ.NUMSAMP)
+ throw new Exception("JPEG header information is invalid");
+ byte[] buf = new byte[TJ.bufSizeYUV(jpegWidth, jpegHeight, jpegSubsamp)];
+ decompressToYUV(buf, flags);
+ return buf;
+ }
+
+ /**
+ * Decompress the JPEG source image associated with this decompressor
+ * instance and output a decompressed image to the given
+ * <code>BufferedImage</code> instance.
+ *
+ * @param dstImage a <code>BufferedImage</code> instance which will receive
+ * the decompressed image
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ */
+ public void decompress(BufferedImage dstImage, int flags) throws Exception {
+ if(dstImage == null || flags < 0)
+ throw new Exception("Invalid argument in decompress()");
+ int desiredWidth = dstImage.getWidth();
+ int desiredHeight = dstImage.getHeight();
+ int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
+ int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
+ if(scaledWidth != desiredWidth || scaledHeight != desiredHeight)
+ throw new Exception("BufferedImage dimensions do not match a scaled image size that TurboJPEG is capable of generating.");
+ int pixelFormat; boolean intPixels = false;
+ if(byteOrder == null)
+ byteOrder = ByteOrder.nativeOrder();
+ switch(dstImage.getType()) {
+ case BufferedImage.TYPE_3BYTE_BGR:
+ pixelFormat = TJ.PF_BGR; break;
+ case BufferedImage.TYPE_4BYTE_ABGR:
+ case BufferedImage.TYPE_4BYTE_ABGR_PRE:
+ pixelFormat = TJ.PF_XBGR; break;
+ case BufferedImage.TYPE_BYTE_GRAY:
+ pixelFormat = TJ.PF_GRAY; break;
+ case BufferedImage.TYPE_INT_BGR:
+ if(byteOrder == ByteOrder.BIG_ENDIAN)
+ pixelFormat = TJ.PF_XBGR;
+ else
+ pixelFormat = TJ.PF_RGBX;
+ intPixels = true; break;
+ case BufferedImage.TYPE_INT_RGB:
+ case BufferedImage.TYPE_INT_ARGB:
+ case BufferedImage.TYPE_INT_ARGB_PRE:
+ if(byteOrder == ByteOrder.BIG_ENDIAN)
+ pixelFormat = TJ.PF_XRGB;
+ else
+ pixelFormat = TJ.PF_BGRX;
+ intPixels = true; break;
+ default:
+ throw new Exception("Unsupported BufferedImage format");
+ }
+ WritableRaster wr = dstImage.getRaster();
+ if(intPixels) {
+ SinglePixelPackedSampleModel sm =
+ (SinglePixelPackedSampleModel)dstImage.getSampleModel();
+ int pitch = sm.getScanlineStride();
+ DataBufferInt db = (DataBufferInt)wr.getDataBuffer();
+ int[] buf = db.getData();
+ if(jpegBuf == null) throw new Exception(NO_ASSOC_ERROR);
+ decompress(jpegBuf, jpegBufSize, buf, scaledWidth, pitch, scaledHeight,
+ pixelFormat, flags);
+ }
+ else {
+ ComponentSampleModel sm =
+ (ComponentSampleModel)dstImage.getSampleModel();
+ int pixelSize = sm.getPixelStride();
+ if(pixelSize != TJ.getPixelSize(pixelFormat))
+ throw new Exception("Inconsistency between pixel format and pixel size in BufferedImage");
+ int pitch = sm.getScanlineStride();
+ DataBufferByte db = (DataBufferByte)wr.getDataBuffer();
+ byte[] buf = db.getData();
+ decompress(buf, scaledWidth, pitch, scaledHeight, pixelFormat, flags);
+ }
+ }
+
+ /**
+ * Decompress the JPEG source image associated with this decompressor
+ * instance and return a <code>BufferedImage</code> instance containing the
+ * decompressed image.
+ *
+ * @param desiredWidth see
+ * {@link #decompress(byte[], int, int, int, int, int)} for description
+ *
+ * @param desiredHeight see
+ * {@link #decompress(byte[], int, int, int, int, int)} for description
+ *
+ * @param bufferedImageType the image type of the newly-created
+ * <code>BufferedImage</code> instance (for instance,
+ * <code>BufferedImage.TYPE_INT_RGB</code>)
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ *
+ * @return a <code>BufferedImage</code> instance containing the
+ * decompressed image
+ */
+ public BufferedImage decompress(int desiredWidth, int desiredHeight,
+ int bufferedImageType, int flags) throws Exception {
+ if(desiredWidth < 0 || desiredHeight < 0 || flags < 0)
+ throw new Exception("Invalid argument in decompress()");
+ int scaledWidth = getScaledWidth(desiredWidth, desiredHeight);
+ int scaledHeight = getScaledHeight(desiredWidth, desiredHeight);
+ BufferedImage img = new BufferedImage(scaledWidth, scaledHeight,
+ bufferedImageType);
+ decompress(img, flags);
+ return img;
+ }
+
+ /**
+ * Free the native structures associated with this decompressor instance.
+ */
+ public void close() throws Exception {
+ destroy();
+ }
+
+ protected void finalize() throws Throwable {
+ try {
+ close();
+ }
+ catch(Exception e) {}
+ finally {
+ super.finalize();
+ }
+ };
+
+ private native void init() throws Exception;
+
+ private native void destroy() throws Exception;
+
+ private native void decompressHeader(byte[] srcBuf, int size)
+ throws Exception;
+
+ private native void decompress(byte[] srcBuf, int size, byte[] dstBuf,
+ int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)
+ throws Exception;
+
+ private native void decompress(byte[] srcBuf, int size, int[] dstBuf,
+ int desiredWidth, int pitch, int desiredHeight, int pixelFormat, int flags)
+ throws Exception;
+
+ private native void decompressToYUV(byte[] srcBuf, int size, byte[] dstBuf,
+ int flags)
+ throws Exception;
+
+ static {
+ TJLoader.load();
+ }
+
+ protected long handle = 0;
+ protected byte[] jpegBuf = null;
+ protected int jpegBufSize = 0;
+ protected int jpegWidth = 0;
+ protected int jpegHeight = 0;
+ protected int jpegSubsamp = -1;
+ private ByteOrder byteOrder = null;
+};
diff --git a/java/org/libjpegturbo/turbojpeg/TJLoader.java b/java/org/libjpegturbo/turbojpeg/TJLoader.java
new file mode 100644
index 0000000..db77bba
--- /dev/null
+++ b/java/org/libjpegturbo/turbojpeg/TJLoader.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+package org.libjpegturbo.turbojpeg;
+
+final class TJLoader {
+ static void load() {
+ System.loadLibrary("turbojpeg");
+ }
+};
diff --git a/java/org/libjpegturbo/turbojpeg/TJLoader.java.in b/java/org/libjpegturbo/turbojpeg/TJLoader.java.in
new file mode 100644
index 0000000..22353a5
--- /dev/null
+++ b/java/org/libjpegturbo/turbojpeg/TJLoader.java.in
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+package org.libjpegturbo.turbojpeg;
+
+final class TJLoader {
+ static void load() {
+ System.loadLibrary("@TURBOJPEG_DLL_NAME@");
+ }
+};
diff --git a/java/org/libjpegturbo/turbojpeg/TJScalingFactor.java b/java/org/libjpegturbo/turbojpeg/TJScalingFactor.java
new file mode 100644
index 0000000..d71ceee
--- /dev/null
+++ b/java/org/libjpegturbo/turbojpeg/TJScalingFactor.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+package org.libjpegturbo.turbojpeg;
+
+/**
+ * Fractional scaling factor
+ */
+public class TJScalingFactor {
+
+ public TJScalingFactor(int num, int denom) throws Exception {
+ if(num < 1 || denom < 1)
+ throw new Exception("Numerator and denominator must be >= 1");
+ this.num = num;
+ this.denom = denom;
+ }
+
+ /**
+ * Returns numerator
+ * @return numerator
+ */
+ public int getNum() {
+ return num;
+ }
+
+ /**
+ * Returns denominator
+ * @return denominator
+ */
+ public int getDenom() {
+ return denom;
+ }
+
+ /**
+ * Returns the scaled value of <code>dimension</code>. This function
+ * performs the integer equivalent of
+ * <code>ceil(dimension * scalingFactor)</code>.
+ * @return the scaled value of <code>dimension</code>
+ */
+ public int getScaled(int dimension) {
+ return (dimension * num + denom - 1) / denom;
+ }
+
+ /**
+ * Returns true or false, depending on whether this instance and
+ * <code>other</code> have the same numerator and denominator.
+ * @return true or false, depending on whether this instance and
+ * <code>other</code> have the same numerator and denominator
+ */
+ public boolean equals(TJScalingFactor other) {
+ return (this.num == other.num && this.denom == other.denom);
+ }
+
+ /**
+ * Returns true or false, depending on whether this instance is equal to
+ * 1/1.
+ * @return true or false, depending on whether this instance is equal to
+ * 1/1
+ */
+ public boolean isOne() {
+ return (num == 1 && denom == 1);
+ }
+
+ /**
+ * Numerator
+ */
+ private int num = 1;
+
+ /**
+ * Denominator
+ */
+ private int denom = 1;
+};
diff --git a/java/org/libjpegturbo/turbojpeg/TJTransform.java b/java/org/libjpegturbo/turbojpeg/TJTransform.java
new file mode 100644
index 0000000..b9fbad5
--- /dev/null
+++ b/java/org/libjpegturbo/turbojpeg/TJTransform.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+package org.libjpegturbo.turbojpeg;
+
+import java.awt.*;
+
+/**
+ * Lossless transform parameters
+ */
+public class TJTransform extends Rectangle {
+
+ private static final long serialVersionUID = -127367705761430371L;
+
+ /**
+ * The number of lossless transform operations
+ */
+ final public static int NUMOP = 8;
+ /**
+ * Do not transform the position of the image pixels.
+ */
+ final public static int OP_NONE = 0;
+ /**
+ * Flip (mirror) image horizontally. This transform is imperfect if there
+ * are any partial MCU blocks on the right edge.
+ * @see #OPT_PERFECT
+ */
+ final public static int OP_HFLIP = 1;
+ /**
+ * Flip (mirror) image vertically. This transform is imperfect if there are
+ * any partial MCU blocks on the bottom edge.
+ * @see #OPT_PERFECT
+ */
+ final public static int OP_VFLIP = 2;
+ /**
+ * Transpose image (flip/mirror along upper left to lower right axis). This
+ * transform is always perfect.
+ * @see #OPT_PERFECT
+ */
+ final public static int OP_TRANSPOSE = 3;
+ /**
+ * Transverse transpose image (flip/mirror along upper right to lower left
+ * axis). This transform is imperfect if there are any partial MCU blocks in
+ * the image.
+ * @see #OPT_PERFECT
+ */
+ final public static int OP_TRANSVERSE = 4;
+ /**
+ * Rotate image clockwise by 90 degrees. This transform is imperfect if
+ * there are any partial MCU blocks on the bottom edge.
+ * @see #OPT_PERFECT
+ */
+ final public static int OP_ROT90 = 5;
+ /**
+ * Rotate image 180 degrees. This transform is imperfect if there are any
+ * partial MCU blocks in the image.
+ * @see #OPT_PERFECT
+ */
+ final public static int OP_ROT180 = 6;
+ /**
+ * Rotate image counter-clockwise by 90 degrees. This transform is imperfect
+ * if there are any partial MCU blocks on the right edge.
+ * @see #OPT_PERFECT
+ */
+ final public static int OP_ROT270 = 7;
+
+
+ /**
+ * This option will cause {@link TJTransformer#transform
+ * TJTransformer.transform()} to throw an exception if the transform is not
+ * perfect. Lossless transforms operate on MCU blocks, whose size depends on
+ * the level of chrominance subsampling used. If the image's width or height
+ * is not evenly divisible by the MCU block size (see {@link TJ#getMCUWidth}
+ * and {@link TJ#getMCUHeight}), then there will be partial MCU blocks on the
+ * right and/or bottom edges. It is not possible to move these partial MCU
+ * blocks to the top or left of the image, so any transform that would
+ * require that is "imperfect." If this option is not specified, then any
+ * partial MCU blocks that cannot be transformed will be left in place, which
+ * will create odd-looking strips on the right or bottom edge of the image.
+ */
+ final public static int OPT_PERFECT = 1;
+ /**
+ * This option will discard any partial MCU blocks that cannot be
+ * transformed.
+ */
+ final public static int OPT_TRIM = 2;
+ /**
+ * This option will enable lossless cropping.
+ */
+ final public static int OPT_CROP = 4;
+ /**
+ * This option will discard the color data in the input image and produce
+ * a grayscale output image.
+ */
+ final public static int OPT_GRAY = 8;
+ /**
+ * This option will prevent {@link TJTransformer#transform
+ * TJTransformer.transform()} from outputting a JPEG image for this
+ * particular transform. This can be used in conjunction with a custom
+ * filter to capture the transformed DCT coefficients without transcoding
+ * them.
+ */
+ final public static int OPT_NOOUTPUT = 16;
+
+
+ /**
+ * Create a new lossless transform instance.
+ */
+ public TJTransform() {
+ }
+
+ /**
+ * Create a new lossless transform instance with the given parameters.
+ *
+ * @param x the left boundary of the cropping region. This must be evenly
+ * divisible by the MCU block width (see {@link TJ#getMCUWidth})
+ *
+ * @param y the upper boundary of the cropping region. This must be evenly
+ * divisible by the MCU block height (see {@link TJ#getMCUHeight})
+ *
+ * @param w the width of the cropping region. Setting this to 0 is the
+ * equivalent of setting it to the width of the source JPEG image - x.
+ *
+ * @param h the height of the cropping region. Setting this to 0 is the
+ * equivalent of setting it to the height of the source JPEG image - y.
+ *
+ * @param op one of the transform operations (<code>OP_*</code>)
+ *
+ * @param options the bitwise OR of one or more of the transform options
+ * (<code>OPT_*</code>)
+ *
+ * @param cf an instance of an object that implements the {@link
+ * TJCustomFilter} interface, or null if no custom filter is needed
+ */
+ public TJTransform(int x, int y, int w, int h, int op, int options,
+ TJCustomFilter cf) throws Exception {
+ super(x, y, w, h);
+ this.op = op; this.options = options; this.cf = cf;
+ }
+
+ /**
+ * Create a new lossless transform instance with the given parameters.
+ *
+ * @param r a <code>Rectangle</code> instance which specifies the cropping
+ * region. See {@link
+ * #TJTransform(int, int, int, int, int, int, TJCustomFilter)} for more
+ * detail.
+ *
+ * @param op one of the transform operations (<code>OP_*</code>)
+ *
+ * @param options the bitwise OR of one or more of the transform options
+ * (<code>OPT_*</code>)
+ *
+ * @param cf an instance of an object that implements the {@link
+ * TJCustomFilter} interface, or null if no custom filter is needed
+ */
+ public TJTransform(Rectangle r, int op, int options,
+ TJCustomFilter cf) throws Exception {
+ super(r);
+ this.op = op; this.options = options; this.cf = cf;
+ }
+
+ /**
+ * Transform operation (one of <code>OP_*</code>)
+ */
+ public int op = 0;
+
+ /**
+ * Transform options (bitwise OR of one or more of <code>OPT_*</code>)
+ */
+ public int options = 0;
+
+ /**
+ * Custom filter instance
+ */
+ public TJCustomFilter cf = null;
+}
diff --git a/java/org/libjpegturbo/turbojpeg/TJTransformer.java b/java/org/libjpegturbo/turbojpeg/TJTransformer.java
new file mode 100644
index 0000000..6c07483
--- /dev/null
+++ b/java/org/libjpegturbo/turbojpeg/TJTransformer.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+package org.libjpegturbo.turbojpeg;
+
+/**
+ * TurboJPEG lossless transformer
+ */
+public class TJTransformer extends TJDecompressor {
+
+ /**
+ * Create a TurboJPEG lossless transformer instance.
+ */
+ public TJTransformer() throws Exception {
+ init();
+ }
+
+ /**
+ * Create a TurboJPEG lossless transformer instance and associate the JPEG
+ * 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)
+ */
+ public TJTransformer(byte[] jpegImage) throws Exception {
+ init();
+ setJPEGImage(jpegImage, jpegImage.length);
+ }
+
+ /**
+ * 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.
+ *
+ * @param jpegImage JPEG image buffer
+ *
+ * @param imageSize size of the JPEG image (in bytes)
+ */
+ public TJTransformer(byte[] jpegImage, int imageSize) throws Exception {
+ init();
+ setJPEGImage(jpegImage, imageSize);
+ }
+
+ /**
+ * Losslessly transform the JPEG image associated with this transformer
+ * instance into one or more JPEG images stored in the given destination
+ * buffers. Lossless transforms work by moving the raw coefficients from one
+ * JPEG image structure to another without altering the values of the
+ * coefficients. While this is typically faster than decompressing the
+ * image, transforming it, and re-compressing it, lossless transforms are not
+ * free. Each lossless transform requires reading and Huffman decoding all
+ * of the coefficients in the source image, regardless of the size of the
+ * destination image. Thus, this method provides a means of generating
+ * multiple transformed images from the same source or of applying multiple
+ * transformations simultaneously, in order to eliminate the need to read the
+ * source coefficients multiple times.
+ *
+ * @param dstBufs an array of image buffers. <code>dstbufs[i]</code> will
+ * receive a JPEG image that has been transformed using the parameters in
+ * <code>transforms[i]</code>. Use {@link TJ#bufSize} to determine the
+ * maximum size for each buffer based on the cropped width and height.
+ *
+ * @param transforms an array of {@link TJTransform} instances, each of
+ * which specifies the transform parameters and/or cropping region for the
+ * corresponding transformed output image
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ */
+ public void transform(byte[][] dstBufs, TJTransform[] transforms,
+ int flags) throws Exception {
+ if(jpegBuf == null) throw new Exception("JPEG buffer not initialized");
+ transformedSizes = transform(jpegBuf, jpegBufSize, dstBufs, transforms,
+ flags);
+ }
+
+ /**
+ * Losslessly transform the JPEG image associated with this transformer
+ * instance and return an array of {@link TJDecompressor} instances, each of
+ * which has a transformed JPEG image associated with it.
+ *
+ * @param transforms an array of {@link TJTransform} instances, each of
+ * which specifies the transform parameters and/or cropping region for the
+ * corresponding transformed output image
+ *
+ * @return an array of {@link TJDecompressor} instances, each of
+ * which has a transformed JPEG image associated with it
+ *
+ * @param flags the bitwise OR of one or more of {@link TJ TJ.FLAG_*}
+ */
+ public TJDecompressor[] transform(TJTransform[] transforms, int flags)
+ throws Exception {
+ byte[][] dstBufs = new byte[transforms.length][];
+ if(jpegWidth < 1 || jpegHeight < 1)
+ throw new Exception("JPEG buffer not initialized");
+ for(int i = 0; i < transforms.length; i++) {
+ int w = jpegWidth, h = jpegHeight;
+ if((transforms[i].options & TJTransform.OPT_CROP) != 0) {
+ if(transforms[i].width != 0) w = transforms[i].width;
+ if(transforms[i].height != 0) h = transforms[i].height;
+ }
+ dstBufs[i] = new byte[TJ.bufSize(w, h, jpegSubsamp)];
+ }
+ TJDecompressor[] tjd = new TJDecompressor[transforms.length];
+ transform(dstBufs, transforms, flags);
+ for(int i = 0; i < transforms.length; i++)
+ tjd[i] = new TJDecompressor(dstBufs[i], transformedSizes[i]);
+ return tjd;
+ }
+
+ /**
+ * Returns an array containing the sizes of the transformed JPEG images from
+ * the most recent call to {@link #transform transform()}.
+ *
+ * @return an array containing the sizes of the transformed JPEG images from
+ * the most recent call to {@link #transform transform()}
+ */
+ public int[] getTransformedSizes() throws Exception {
+ if(transformedSizes == null)
+ throw new Exception("No image has been transformed yet");
+ return transformedSizes;
+ }
+
+ private native void init() throws Exception;
+
+ private native int[] transform(byte[] srcBuf, int srcSize, byte[][] dstBufs,
+ TJTransform[] transforms, int flags) throws Exception;
+
+ static {
+ TJLoader.load();
+ }
+
+ private int[] transformedSizes = null;
+};
diff --git a/java/org_libjpegturbo_turbojpeg_TJ.h b/java/org_libjpegturbo_turbojpeg_TJ.h
new file mode 100644
index 0000000..54479be
--- /dev/null
+++ b/java/org_libjpegturbo_turbojpeg_TJ.h
@@ -0,0 +1,77 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_libjpegturbo_turbojpeg_TJ */
+
+#ifndef _Included_org_libjpegturbo_turbojpeg_TJ
+#define _Included_org_libjpegturbo_turbojpeg_TJ
+#ifdef __cplusplus
+extern "C" {
+#endif
+#undef org_libjpegturbo_turbojpeg_TJ_NUMSAMP
+#define org_libjpegturbo_turbojpeg_TJ_NUMSAMP 5L
+#undef org_libjpegturbo_turbojpeg_TJ_SAMP_444
+#define org_libjpegturbo_turbojpeg_TJ_SAMP_444 0L
+#undef org_libjpegturbo_turbojpeg_TJ_SAMP_422
+#define org_libjpegturbo_turbojpeg_TJ_SAMP_422 1L
+#undef org_libjpegturbo_turbojpeg_TJ_SAMP_420
+#define org_libjpegturbo_turbojpeg_TJ_SAMP_420 2L
+#undef org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY
+#define org_libjpegturbo_turbojpeg_TJ_SAMP_GRAY 3L
+#undef org_libjpegturbo_turbojpeg_TJ_SAMP_440
+#define org_libjpegturbo_turbojpeg_TJ_SAMP_440 4L
+#undef org_libjpegturbo_turbojpeg_TJ_NUMPF
+#define org_libjpegturbo_turbojpeg_TJ_NUMPF 7L
+#undef org_libjpegturbo_turbojpeg_TJ_PF_RGB
+#define org_libjpegturbo_turbojpeg_TJ_PF_RGB 0L
+#undef org_libjpegturbo_turbojpeg_TJ_PF_BGR
+#define org_libjpegturbo_turbojpeg_TJ_PF_BGR 1L
+#undef org_libjpegturbo_turbojpeg_TJ_PF_RGBX
+#define org_libjpegturbo_turbojpeg_TJ_PF_RGBX 2L
+#undef org_libjpegturbo_turbojpeg_TJ_PF_BGRX
+#define org_libjpegturbo_turbojpeg_TJ_PF_BGRX 3L
+#undef org_libjpegturbo_turbojpeg_TJ_PF_XBGR
+#define org_libjpegturbo_turbojpeg_TJ_PF_XBGR 4L
+#undef org_libjpegturbo_turbojpeg_TJ_PF_XRGB
+#define org_libjpegturbo_turbojpeg_TJ_PF_XRGB 5L
+#undef org_libjpegturbo_turbojpeg_TJ_PF_GRAY
+#define org_libjpegturbo_turbojpeg_TJ_PF_GRAY 6L
+#undef org_libjpegturbo_turbojpeg_TJ_FLAG_BOTTOMUP
+#define org_libjpegturbo_turbojpeg_TJ_FLAG_BOTTOMUP 2L
+#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FORCEMMX
+#define org_libjpegturbo_turbojpeg_TJ_FLAG_FORCEMMX 8L
+#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FORCESSE
+#define org_libjpegturbo_turbojpeg_TJ_FLAG_FORCESSE 16L
+#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FORCESSE2
+#define org_libjpegturbo_turbojpeg_TJ_FLAG_FORCESSE2 32L
+#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FORCESSE3
+#define org_libjpegturbo_turbojpeg_TJ_FLAG_FORCESSE3 128L
+#undef org_libjpegturbo_turbojpeg_TJ_FLAG_FASTUPSAMPLE
+#define org_libjpegturbo_turbojpeg_TJ_FLAG_FASTUPSAMPLE 256L
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJ
+ * Method: bufSize
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSize
+ (JNIEnv *, jclass, jint, jint, jint);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJ
+ * Method: bufSizeYUV
+ * Signature: (III)I
+ */
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV
+ (JNIEnv *, jclass, jint, jint, jint);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJ
+ * Method: getScalingFactors
+ * Signature: ()[Lorg/libjpegturbo/turbojpeg/TJScalingFactor;
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_libjpegturbo_turbojpeg_TJ_getScalingFactors
+ (JNIEnv *, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/java/org_libjpegturbo_turbojpeg_TJCompressor.h b/java/org_libjpegturbo_turbojpeg_TJCompressor.h
new file mode 100644
index 0000000..59f81e3
--- /dev/null
+++ b/java/org_libjpegturbo_turbojpeg_TJCompressor.h
@@ -0,0 +1,61 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_libjpegturbo_turbojpeg_TJCompressor */
+
+#ifndef _Included_org_libjpegturbo_turbojpeg_TJCompressor
+#define _Included_org_libjpegturbo_turbojpeg_TJCompressor
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJCompressor
+ * Method: init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_init
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJCompressor
+ * Method: destroy
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJCompressor
+ * Method: compress
+ * Signature: ([BIIII[BIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIII_3BIII
+ (JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJCompressor
+ * Method: compress
+ * Signature: ([IIIII[BIII)I
+ */
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3IIIII_3BIII
+ (JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jbyteArray, jint, jint, jint);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJCompressor
+ * Method: encodeYUV
+ * Signature: ([BIIII[BII)V
+ */
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII
+ (JNIEnv *, jobject, jbyteArray, jint, jint, jint, jint, jbyteArray, jint, jint);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJCompressor
+ * Method: encodeYUV
+ * Signature: ([IIIII[BII)V
+ */
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BII
+ (JNIEnv *, jobject, jintArray, jint, jint, jint, jint, jbyteArray, jint, jint);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/java/org_libjpegturbo_turbojpeg_TJDecompressor.h b/java/org_libjpegturbo_turbojpeg_TJDecompressor.h
new file mode 100644
index 0000000..6b67296
--- /dev/null
+++ b/java/org_libjpegturbo_turbojpeg_TJDecompressor.h
@@ -0,0 +1,61 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_libjpegturbo_turbojpeg_TJDecompressor */
+
+#ifndef _Included_org_libjpegturbo_turbojpeg_TJDecompressor
+#define _Included_org_libjpegturbo_turbojpeg_TJDecompressor
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJDecompressor
+ * Method: init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_init
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJDecompressor
+ * Method: destroy
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_destroy
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJDecompressor
+ * Method: decompressHeader
+ * Signature: ([BI)V
+ */
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressHeader
+ (JNIEnv *, jobject, jbyteArray, jint);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJDecompressor
+ * Method: decompress
+ * Signature: ([BI[BIIIII)V
+ */
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIII
+ (JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint, jint, jint, jint, jint);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJDecompressor
+ * Method: decompress
+ * Signature: ([BI[IIIIII)V
+ */
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIII
+ (JNIEnv *, jobject, jbyteArray, jint, jintArray, jint, jint, jint, jint, jint);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJDecompressor
+ * Method: decompressToYUV
+ * Signature: ([BI[BI)V
+ */
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV
+ (JNIEnv *, jobject, jbyteArray, jint, jbyteArray, jint);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/java/org_libjpegturbo_turbojpeg_TJTransformer.h b/java/org_libjpegturbo_turbojpeg_TJTransformer.h
new file mode 100644
index 0000000..a9dad4d
--- /dev/null
+++ b/java/org_libjpegturbo_turbojpeg_TJTransformer.h
@@ -0,0 +1,29 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_libjpegturbo_turbojpeg_TJTransformer */
+
+#ifndef _Included_org_libjpegturbo_turbojpeg_TJTransformer
+#define _Included_org_libjpegturbo_turbojpeg_TJTransformer
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJTransformer
+ * Method: init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_init
+ (JNIEnv *, jobject);
+
+/*
+ * Class: org_libjpegturbo_turbojpeg_TJTransformer
+ * Method: transform
+ * Signature: ([BI[[B[Lorg/libjpegturbo/turbojpeg/TJTransform;I)[I
+ */
+JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transform
+ (JNIEnv *, jobject, jbyteArray, jint, jobjectArray, jobjectArray, jint);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/jccolext.c b/jccolext.c
new file mode 100644
index 0000000..acbfa23
--- /dev/null
+++ b/jccolext.c
@@ -0,0 +1,114 @@
+/*
+ * jccolext.c
+ *
+ * Copyright (C) 1991-1996, Thomas G. Lane.
+ * Copyright (C) 2009-2011, D. R. Commander.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains input colorspace conversion routines.
+ */
+
+
+/* This file is included by jccolor.c */
+
+
+/*
+ * Convert some rows of samples to the JPEG colorspace.
+ *
+ * Note that we change from the application's interleaved-pixel format
+ * to our internal noninterleaved, one-plane-per-component format.
+ * The input buffer is therefore three times as wide as the output buffer.
+ *
+ * A starting row offset is provided only for the output buffer. The caller
+ * can easily adjust the passed input_buf value to accommodate any row
+ * offset required on that side.
+ */
+
+INLINE
+LOCAL(void)
+rgb_ycc_convert_internal (j_compress_ptr cinfo,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows)
+{
+ my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ register int r, g, b;
+ register INT32 * ctab = cconvert->rgb_ycc_tab;
+ register JSAMPROW inptr;
+ register JSAMPROW outptr0, outptr1, outptr2;
+ register JDIMENSION col;
+ JDIMENSION num_cols = cinfo->image_width;
+
+ while (--num_rows >= 0) {
+ inptr = *input_buf++;
+ outptr0 = output_buf[0][output_row];
+ outptr1 = output_buf[1][output_row];
+ outptr2 = output_buf[2][output_row];
+ output_row++;
+ for (col = 0; col < num_cols; col++) {
+ r = GETJSAMPLE(inptr[RGB_RED]);
+ g = GETJSAMPLE(inptr[RGB_GREEN]);
+ b = GETJSAMPLE(inptr[RGB_BLUE]);
+ inptr += RGB_PIXELSIZE;
+ /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
+ * must be too; we do not need an explicit range-limiting operation.
+ * Hence the value being shifted is never negative, and we don't
+ * need the general RIGHT_SHIFT macro.
+ */
+ /* Y */
+ outptr0[col] = (JSAMPLE)
+ ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
+ >> SCALEBITS);
+ /* Cb */
+ outptr1[col] = (JSAMPLE)
+ ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
+ >> SCALEBITS);
+ /* Cr */
+ outptr2[col] = (JSAMPLE)
+ ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
+ >> SCALEBITS);
+ }
+ }
+}
+
+
+/**************** Cases other than RGB -> YCbCr **************/
+
+
+/*
+ * Convert some rows of samples to the JPEG colorspace.
+ * This version handles RGB->grayscale conversion, which is the same
+ * as the RGB->Y portion of RGB->YCbCr.
+ * We assume rgb_ycc_start has been called (we only use the Y tables).
+ */
+
+INLINE
+LOCAL(void)
+rgb_gray_convert_internal (j_compress_ptr cinfo,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows)
+{
+ my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ register int r, g, b;
+ register INT32 * ctab = cconvert->rgb_ycc_tab;
+ register JSAMPROW inptr;
+ register JSAMPROW outptr;
+ register JDIMENSION col;
+ JDIMENSION num_cols = cinfo->image_width;
+
+ while (--num_rows >= 0) {
+ inptr = *input_buf++;
+ outptr = output_buf[0][output_row];
+ output_row++;
+ for (col = 0; col < num_cols; col++) {
+ r = GETJSAMPLE(inptr[RGB_RED]);
+ g = GETJSAMPLE(inptr[RGB_GREEN]);
+ b = GETJSAMPLE(inptr[RGB_BLUE]);
+ inptr += RGB_PIXELSIZE;
+ /* Y */
+ outptr[col] = (JSAMPLE)
+ ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
+ >> SCALEBITS);
+ }
+ }
+}
diff --git a/jccolor.c b/jccolor.c
index b374c8b..12804f3 100644
--- a/jccolor.c
+++ b/jccolor.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 1991-1996, Thomas G. Lane.
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
- * Copyright 2009-2011 D. R. Commander
+ * Copyright (C) 2009-2011, D. R. Commander.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -81,72 +81,97 @@
#define TABLE_SIZE (8*(MAXJSAMPLE+1))
-#if BITS_IN_JSAMPLE == 8
+/* Include inline routines for colorspace extensions */
-static const unsigned char red_lut[256] = {
- 0 , 0 , 1 , 1 , 1 , 1 , 2 , 2 , 2 , 3 , 3 , 3 , 4 , 4 , 4 , 4 ,
- 5 , 5 , 5 , 6 , 6 , 6 , 7 , 7 , 7 , 7 , 8 , 8 , 8 , 9 , 9 , 9 ,
- 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 13, 14, 14,
- 14, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19,
- 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 24,
- 24, 24, 25, 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 28,
- 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33,
- 33, 34, 34, 34, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 38, 38,
- 38, 39, 39, 39, 39, 40, 40, 40, 41, 41, 41, 42, 42, 42, 42, 43,
- 43, 43, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 47, 47, 47, 48,
- 48, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 51, 51, 52, 52, 52,
- 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 56, 56, 56, 57, 57, 57,
- 57, 58, 58, 58, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 62, 62,
- 62, 62, 63, 63, 63, 64, 64, 64, 65, 65, 65, 65, 66, 66, 66, 67,
- 67, 67, 68, 68, 68, 68, 69, 69, 69, 70, 70, 70, 71, 71, 71, 71,
- 72, 72, 72, 73, 73, 73, 74, 74, 74, 74, 75, 75, 75, 76, 76, 76
-};
+#include "jccolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
-static const unsigned char green_lut[256] = {
- 0 , 1 , 1 , 2 , 2 , 3 , 4 , 4 , 5 , 5 , 6 , 6 ,
- 7 , 8 , 8 , 9 , 9 , 10 , 11 , 11 , 12 , 12 , 13 , 14 ,
- 14 , 15 , 15 , 16 , 16 , 17 , 18 , 18 , 19 , 19 , 20 , 21 ,
- 21 , 22 , 22 , 23 , 23 , 24 , 25 , 25 , 26 , 26 , 27 , 28 ,
- 28 , 29 , 29 , 30 , 31 , 31 , 32 , 32 , 33 , 33 , 34 , 35 ,
- 35 , 36 , 36 , 37 , 38 , 38 , 39 , 39 , 40 , 41 , 41 , 42 ,
- 42 , 43 , 43 , 44 , 45 , 45 , 46 , 46 , 47 , 48 , 48 , 49 ,
- 49 , 50 , 50 , 51 , 52 , 52 , 53 , 53 , 54 , 55 , 55 , 56 ,
- 56 , 57 , 58 , 58 , 59 , 59 , 60 , 60 , 61 , 62 , 62 , 63 ,
- 63 , 64 , 65 , 65 , 66 , 66 , 67 , 68 , 68 , 69 , 69 , 70 ,
- 70 , 71 , 72 , 72 , 73 , 73 , 74 , 75 , 75 , 76 , 76 , 77 ,
- 77 , 78 , 79 , 79 , 80 , 80 , 81 , 82 , 82 , 83 , 83 , 84 ,
- 85 , 85 , 86 , 86 , 87 , 87 , 88 , 89 , 89 , 90 , 90 , 91 ,
- 92 , 92 , 93 , 93 , 94 , 95 , 95 , 96 , 96 , 97 , 97 , 98 ,
- 99 , 99 , 100, 100, 101, 102, 102, 103, 103, 104, 104, 105,
- 106, 106, 107, 107, 108, 109, 109, 110, 110, 111, 112, 112,
- 113, 113, 114, 114, 115, 116, 116, 117, 117, 118, 119, 119,
- 120, 120, 121, 122, 122, 123, 123, 124, 124, 125, 126, 126,
- 127, 127, 128, 129, 129, 130, 130, 131, 131, 132, 133, 133,
- 134, 134, 135, 136, 136, 137, 137, 138, 139, 139, 140, 140,
- 141, 141, 142, 143, 143, 144, 144, 145, 146, 146, 147, 147,
- 148, 149, 149, 150
-};
+#define RGB_RED EXT_RGB_RED
+#define RGB_GREEN EXT_RGB_GREEN
+#define RGB_BLUE EXT_RGB_BLUE
+#define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
+#define rgb_ycc_convert_internal extrgb_ycc_convert_internal
+#define rgb_gray_convert_internal extrgb_gray_convert_internal
+#include "jccolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef rgb_ycc_convert_internal
+#undef rgb_gray_convert_internal
-static const unsigned char blue_lut[256] = {
- 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 2 , 2 ,
- 2 , 2 , 2 , 2 , 2 , 2 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 4 ,
- 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 ,
- 5 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 7 , 7 , 7 , 7 , 7 , 7 ,
- 7 , 7 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 9 , 9 , 9 , 9 , 9 ,
- 9 , 9 , 9 , 9 , 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11,
- 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13,
- 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14,
- 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
- 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18,
- 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20,
- 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24,
- 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25,
- 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27,
- 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29
-};
+#define RGB_RED EXT_RGBX_RED
+#define RGB_GREEN EXT_RGBX_GREEN
+#define RGB_BLUE EXT_RGBX_BLUE
+#define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
+#define rgb_ycc_convert_internal extrgbx_ycc_convert_internal
+#define rgb_gray_convert_internal extrgbx_gray_convert_internal
+#include "jccolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef rgb_ycc_convert_internal
+#undef rgb_gray_convert_internal
-#endif
+#define RGB_RED EXT_BGR_RED
+#define RGB_GREEN EXT_BGR_GREEN
+#define RGB_BLUE EXT_BGR_BLUE
+#define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
+#define rgb_ycc_convert_internal extbgr_ycc_convert_internal
+#define rgb_gray_convert_internal extbgr_gray_convert_internal
+#include "jccolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef rgb_ycc_convert_internal
+#undef rgb_gray_convert_internal
+
+#define RGB_RED EXT_BGRX_RED
+#define RGB_GREEN EXT_BGRX_GREEN
+#define RGB_BLUE EXT_BGRX_BLUE
+#define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
+#define rgb_ycc_convert_internal extbgrx_ycc_convert_internal
+#define rgb_gray_convert_internal extbgrx_gray_convert_internal
+#include "jccolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef rgb_ycc_convert_internal
+#undef rgb_gray_convert_internal
+
+#define RGB_RED EXT_XBGR_RED
+#define RGB_GREEN EXT_XBGR_GREEN
+#define RGB_BLUE EXT_XBGR_BLUE
+#define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
+#define rgb_ycc_convert_internal extxbgr_ycc_convert_internal
+#define rgb_gray_convert_internal extxbgr_gray_convert_internal
+#include "jccolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef rgb_ycc_convert_internal
+#undef rgb_gray_convert_internal
+
+#define RGB_RED EXT_XRGB_RED
+#define RGB_GREEN EXT_XRGB_GREEN
+#define RGB_BLUE EXT_XRGB_BLUE
+#define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
+#define rgb_ycc_convert_internal extxrgb_ycc_convert_internal
+#define rgb_gray_convert_internal extxrgb_gray_convert_internal
+#include "jccolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef rgb_ycc_convert_internal
+#undef rgb_gray_convert_internal
/*
@@ -187,14 +212,6 @@
/*
* Convert some rows of samples to the JPEG colorspace.
- *
- * Note that we change from the application's interleaved-pixel format
- * to our internal noninterleaved, one-plane-per-component format.
- * The input buffer is therefore three times as wide as the output buffer.
- *
- * A starting row offset is provided only for the output buffer. The caller
- * can easily adjust the passed input_buf value to accommodate any row
- * offset required on that side.
*/
METHODDEF(void)
@@ -202,43 +219,35 @@
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- register int r, g, b;
- register INT32 * ctab = cconvert->rgb_ycc_tab;
- register JSAMPROW inptr;
- register JSAMPROW outptr0, outptr1, outptr2;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->image_width;
-
- while (--num_rows >= 0) {
- inptr = *input_buf++;
- outptr0 = output_buf[0][output_row];
- outptr1 = output_buf[1][output_row];
- outptr2 = output_buf[2][output_row];
- output_row++;
- for (col = 0; col < num_cols; col++) {
- r = GETJSAMPLE(inptr[rgb_red[cinfo->in_color_space]]);
- g = GETJSAMPLE(inptr[rgb_green[cinfo->in_color_space]]);
- b = GETJSAMPLE(inptr[rgb_blue[cinfo->in_color_space]]);
- inptr += rgb_pixelsize[cinfo->in_color_space];
- /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
- * must be too; we do not need an explicit range-limiting operation.
- * Hence the value being shifted is never negative, and we don't
- * need the general RIGHT_SHIFT macro.
- */
- /* Y */
- outptr0[col] = (JSAMPLE)
- ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
- >> SCALEBITS);
- /* Cb */
- outptr1[col] = (JSAMPLE)
- ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
- >> SCALEBITS);
- /* Cr */
- outptr2[col] = (JSAMPLE)
- ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
- >> SCALEBITS);
- }
+ switch (cinfo->in_color_space) {
+ case JCS_EXT_RGB:
+ extrgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_RGBX:
+ extrgbx_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_BGR:
+ extbgr_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_BGRX:
+ extbgrx_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_XBGR:
+ extxbgr_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_XRGB:
+ extxrgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ default:
+ rgb_ycc_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
}
}
@@ -248,9 +257,6 @@
/*
* Convert some rows of samples to the JPEG colorspace.
- * This version handles RGB->grayscale conversion, which is the same
- * as the RGB->Y portion of RGB->YCbCr.
- * We assume rgb_ycc_start has been called (we only use the Y tables).
*/
METHODDEF(void)
@@ -258,37 +264,35 @@
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows)
{
- #if BITS_IN_JSAMPLE != 8
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- register INT32 * ctab = cconvert->rgb_ycc_tab;
- #endif
- register JSAMPROW inptr;
- register JSAMPROW outptr;
- JSAMPLE *maxoutptr;
- JDIMENSION num_cols = cinfo->image_width;
- int rindex = rgb_red[cinfo->in_color_space];
- int gindex = rgb_green[cinfo->in_color_space];
- int bindex = rgb_blue[cinfo->in_color_space];
- int rgbstride = rgb_pixelsize[cinfo->in_color_space];
-
- while (--num_rows >= 0) {
- inptr = *input_buf++;
- outptr = output_buf[0][output_row];
- maxoutptr = &outptr[num_cols];
- output_row++;
- for (; outptr < maxoutptr; outptr++, inptr += rgbstride) {
- /* Y */
- #if BITS_IN_JSAMPLE == 8
- *outptr = red_lut[inptr[rindex]] + green_lut[inptr[gindex]]
- + blue_lut[inptr[bindex]];
- #else
- *outptr = (JSAMPLE)
- ((ctab[GETJSAMPLE(inptr[rindex])+R_Y_OFF]
- + ctab[GETJSAMPLE(inptr[gindex])+G_Y_OFF]
- + ctab[GETJSAMPLE(inptr[bindex])+B_Y_OFF])
- >> SCALEBITS);
- #endif
- }
+ switch (cinfo->in_color_space) {
+ case JCS_EXT_RGB:
+ extrgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_RGBX:
+ extrgbx_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_BGR:
+ extbgr_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_BGRX:
+ extbgrx_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_XBGR:
+ extxbgr_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ case JCS_EXT_XRGB:
+ extxrgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
+ default:
+ rgb_gray_convert_internal(cinfo, input_buf, output_buf, output_row,
+ num_rows);
+ break;
}
}
@@ -489,8 +493,12 @@
cinfo->in_color_space == JCS_EXT_BGRX ||
cinfo->in_color_space == JCS_EXT_XBGR ||
cinfo->in_color_space == JCS_EXT_XRGB) {
- cconvert->pub.start_pass = rgb_ycc_start;
- cconvert->pub.color_convert = rgb_gray_convert;
+ if (jsimd_can_rgb_gray())
+ cconvert->pub.color_convert = jsimd_rgb_gray_convert;
+ else {
+ cconvert->pub.start_pass = rgb_ycc_start;
+ cconvert->pub.color_convert = rgb_gray_convert;
+ }
} else if (cinfo->in_color_space == JCS_YCbCr)
cconvert->pub.color_convert = grayscale_convert;
else
diff --git a/jchuff.c b/jchuff.c
index 8a46b98..fd4fa46 100644
--- a/jchuff.c
+++ b/jchuff.c
@@ -2,6 +2,7 @@
* jchuff.c
*
* Copyright (C) 1991-1997, Thomas G. Lane.
+ * Copyright (C) 2009-2011, D. R. Commander.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -14,34 +15,20 @@
* permanent JPEG objects only upon successful completion of an MCU.
*/
-/* Modifications:
- * Copyright (C)2007 Sun Microsystems, Inc.
- * Copyright (C)2009 D. R. Commander
- *
- * This library is free software and may be redistributed and/or modified under
- * the terms of the wxWindows Library License, Version 3.1 or (at your option)
- * any later version. The full license is in the LICENSE.txt file included
- * with this distribution.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * wxWindows Library License for more details.
- */
-
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jchuff.h" /* Declarations shared with jcphuff.c */
#include <limits.h>
-static unsigned char jpeg_first_bit_table[65536];
-static int jpeg_first_bit_table_init=0;
+static unsigned char jpeg_nbits_table[65536];
+static int jpeg_nbits_table_init = 0;
#ifndef min
#define min(a,b) ((a)<(b)?(a):(b))
#endif
+
/* Expanded entropy encoder object for Huffman encoding.
*
* The savable_state subrecord contains fields that change within an MCU,
@@ -181,7 +168,6 @@
}
/* Initialize bit buffer to empty */
-
entropy->saved.put_buffer = 0;
entropy->saved.put_bits = 0;
@@ -285,13 +271,13 @@
dtbl->ehufsi[i] = huffsize[p];
}
- if(!jpeg_first_bit_table_init) {
+ if(!jpeg_nbits_table_init) {
for(i = 0; i < 65536; i++) {
- int bit = 0, val = i;
- while (val) {val >>= 1; bit++;}
- jpeg_first_bit_table[i] = bit;
+ int nbits = 0, temp = i;
+ while (temp) {temp >>= 1; nbits++;}
+ jpeg_nbits_table[i] = nbits;
}
- jpeg_first_bit_table_init = 1;
+ jpeg_nbits_table_init = 1;
}
}
@@ -325,168 +311,123 @@
/* Outputting bits to the file */
-/* Only the right 24 bits of put_buffer are used; the valid bits are
- * left-justified in this part. At most 16 bits can be passed to emit_bits
- * in one call, and we never retain more than 7 bits in put_buffer
- * between calls, so 24 bits are sufficient.
+/* These macros perform the same task as the emit_bits() function in the
+ * original libjpeg code. In addition to reducing overhead by explicitly
+ * inlining the code, additional performance is achieved by taking into
+ * account the size of the bit buffer and waiting until it is almost full
+ * before emptying it. This mostly benefits 64-bit platforms, since 6
+ * bytes can be stored in a 64-bit bit buffer before it has to be emptied.
*/
-/***************************************************************/
-
-#define EMIT_BYTE() { \
- if (0xFF == (*buffer++ = (unsigned char)(put_buffer >> (put_bits -= 8)))) \
- *buffer++ = 0; \
+#define EMIT_BYTE() { \
+ JOCTET c; \
+ put_bits -= 8; \
+ c = (JOCTET)GETJOCTET(put_buffer >> put_bits); \
+ *buffer++ = c; \
+ if (c == 0xFF) /* need to stuff a zero byte? */ \
+ *buffer++ = 0; \
}
-/***************************************************************/
-
-#define DUMP_BITS_(code, size) { \
- put_bits += size; \
- put_buffer = (put_buffer << size) | code; \
- if (put_bits > 7) \
- while(put_bits > 7) \
- EMIT_BYTE() \
- }
-
-/***************************************************************/
-
-#define CHECKBUF15() { \
- if (put_bits > 15) { \
- EMIT_BYTE() \
- EMIT_BYTE() \
- } \
+#define PUT_BITS(code, size) { \
+ put_bits += size; \
+ put_buffer = (put_buffer << size) | code; \
}
-#define CHECKBUF47() { \
- if (put_bits > 47) { \
- EMIT_BYTE() \
- EMIT_BYTE() \
- EMIT_BYTE() \
- EMIT_BYTE() \
- EMIT_BYTE() \
- EMIT_BYTE() \
- } \
+#define CHECKBUF15() { \
+ if (put_bits > 15) { \
+ EMIT_BYTE() \
+ EMIT_BYTE() \
+ } \
}
-#define CHECKBUF31() { \
- if (put_bits > 31) { \
- EMIT_BYTE() \
- EMIT_BYTE() \
- EMIT_BYTE() \
- EMIT_BYTE() \
- } \
+#define CHECKBUF31() { \
+ if (put_bits > 31) { \
+ EMIT_BYTE() \
+ EMIT_BYTE() \
+ EMIT_BYTE() \
+ EMIT_BYTE() \
+ } \
}
-/***************************************************************/
-
-#define DUMP_BITS_NOCHECK(code, size) { \
- put_bits += size; \
- put_buffer = (put_buffer << size) | code; \
- }
+#define CHECKBUF47() { \
+ if (put_bits > 47) { \
+ EMIT_BYTE() \
+ EMIT_BYTE() \
+ EMIT_BYTE() \
+ EMIT_BYTE() \
+ EMIT_BYTE() \
+ EMIT_BYTE() \
+ } \
+}
#if __WORDSIZE==64 || defined(_WIN64)
-#define DUMP_BITS(code, size) { \
- CHECKBUF47() \
- put_bits += size; \
- put_buffer = (put_buffer << size) | code; \
+#define EMIT_BITS(code, size) { \
+ CHECKBUF47() \
+ PUT_BITS(code, size) \
+}
+
+#define EMIT_CODE(code, size) { \
+ temp2 &= (((INT32) 1)<<nbits) - 1; \
+ CHECKBUF31() \
+ PUT_BITS(code, size) \
+ PUT_BITS(temp2, nbits) \
}
#else
-#define DUMP_BITS(code, size) { \
- put_bits += size; \
- put_buffer = (put_buffer << size) | code; \
- CHECKBUF15() \
+#define EMIT_BITS(code, size) { \
+ PUT_BITS(code, size) \
+ CHECKBUF15() \
+}
+
+#define EMIT_CODE(code, size) { \
+ temp2 &= (((INT32) 1)<<nbits) - 1; \
+ PUT_BITS(code, size) \
+ CHECKBUF15() \
+ PUT_BITS(temp2, nbits) \
+ CHECKBUF15() \
}
#endif
-/***************************************************************/
-
-#define DUMP_SINGLE_VALUE(ht, codevalue) { \
- size = ht->ehufsi[codevalue]; \
- code = ht->ehufco[codevalue]; \
- \
- DUMP_BITS(code, size) \
- }
-
-/***************************************************************/
-
-#define DUMP_VALUE_SLOW(ht, codevalue, t, nbits) { \
- size = ht->ehufsi[codevalue]; \
- code = ht->ehufco[codevalue]; \
- t &= ~(-1 << nbits); \
- DUMP_BITS_NOCHECK(code, size) \
- CHECKBUF15() \
- DUMP_BITS_NOCHECK(t, nbits) \
- CHECKBUF15() \
- }
-
-#if __WORDSIZE==64 || defined(_WIN64)
-
-#define DUMP_VALUE(ht, codevalue, t, nbits) { \
- size = ht->ehufsi[codevalue]; \
- code = ht->ehufco[codevalue]; \
- t &= ~(-1 << nbits); \
- CHECKBUF31() \
- DUMP_BITS_NOCHECK(code, size) \
- DUMP_BITS_NOCHECK(t, nbits) \
- }
-
-#else
-
-#define DUMP_VALUE(ht, codevalue, t, nbits) { \
- size = ht->ehufsi[codevalue]; \
- code = ht->ehufco[codevalue]; \
- t &= ~(-1 << nbits); \
- DUMP_BITS_NOCHECK(code, size) \
- CHECKBUF15() \
- DUMP_BITS_NOCHECK(t, nbits) \
- CHECKBUF15() \
- }
-
-#endif
-
-/***************************************************************/
#define BUFSIZE (DCTSIZE2 * 2)
-#define LOAD_BUFFER() { \
- if (state->free_in_buffer < BUFSIZE) { \
- localbuf = 1; \
- buffer = _buffer; \
- } \
- else buffer = state->next_output_byte; \
+#define LOAD_BUFFER() { \
+ if (state->free_in_buffer < BUFSIZE) { \
+ localbuf = 1; \
+ buffer = _buffer; \
+ } \
+ else buffer = state->next_output_byte; \
}
-#define STORE_BUFFER() { \
- if (localbuf) { \
- bytes = buffer - _buffer; \
- buffer = _buffer; \
- while (bytes > 0) { \
- bytestocopy = min(bytes, state->free_in_buffer); \
- MEMCOPY(state->next_output_byte, buffer, bytestocopy); \
- state->next_output_byte += bytestocopy; \
- buffer += bytestocopy; \
- state->free_in_buffer -= bytestocopy; \
- if (state->free_in_buffer == 0) \
- if (! dump_buffer(state)) return FALSE; \
- bytes -= bytestocopy; \
- } \
- } \
- else { \
- state->free_in_buffer -= (buffer - state->next_output_byte); \
- state->next_output_byte = buffer; \
- } \
+#define STORE_BUFFER() { \
+ if (localbuf) { \
+ bytes = buffer - _buffer; \
+ buffer = _buffer; \
+ while (bytes > 0) { \
+ bytestocopy = min(bytes, state->free_in_buffer); \
+ MEMCOPY(state->next_output_byte, buffer, bytestocopy); \
+ state->next_output_byte += bytestocopy; \
+ buffer += bytestocopy; \
+ state->free_in_buffer -= bytestocopy; \
+ if (state->free_in_buffer == 0) \
+ if (! dump_buffer(state)) return FALSE; \
+ bytes -= bytestocopy; \
+ } \
+ } \
+ else { \
+ state->free_in_buffer -= (buffer - state->next_output_byte); \
+ state->next_output_byte = buffer; \
+ } \
}
-/***************************************************************/
LOCAL(boolean)
flush_bits (working_state * state)
{
- unsigned char _buffer[BUFSIZE], *buffer;
+ JOCTET _buffer[BUFSIZE], *buffer;
size_t put_buffer; int put_bits;
size_t bytes, bytestocopy; int localbuf = 0;
@@ -494,7 +435,9 @@
put_bits = state->cur.put_bits;
LOAD_BUFFER()
- DUMP_BITS_(0x7F, 7)
+ /* fill any partial byte with ones */
+ PUT_BITS(0x7F, 7)
+ while (put_bits >= 8) EMIT_BYTE()
state->cur.put_buffer = 0; /* and reset bit-buffer to empty */
state->cur.put_bits = 0;
@@ -503,16 +446,17 @@
return TRUE;
}
+
/* Encode a single block's worth of coefficients */
LOCAL(boolean)
encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
c_derived_tbl *dctbl, c_derived_tbl *actbl)
{
- int temp, temp2;
+ int temp, temp2, temp3;
int nbits;
- int r, sflag, size, code;
- unsigned char _buffer[BUFSIZE], *buffer;
+ int r, code, size;
+ JOCTET _buffer[BUFSIZE], *buffer;
size_t put_buffer; int put_bits;
int code_0xf0 = actbl->ehufco[0xf0], size_0xf0 = actbl->ehufsi[0xf0];
size_t bytes, bytestocopy; int localbuf = 0;
@@ -525,50 +469,88 @@
temp = temp2 = block[0] - last_dc_val;
- sflag = temp >> 31;
- temp -= ((temp + temp) & sflag);
- temp2 += sflag;
- nbits = jpeg_first_bit_table[temp];
- DUMP_VALUE_SLOW(dctbl, nbits, temp2, nbits)
+ /* This is a well-known technique for obtaining the absolute value without a
+ * branch. It is derived from an assembly language technique presented in
+ * "How to Optimize for the Pentium Processors", Copyright (c) 1996, 1997 by
+ * Agner Fog.
+ */
+ temp3 = temp >> (CHAR_BIT * sizeof(int) - 1);
+ temp ^= temp3;
+ temp -= temp3;
+
+ /* For a negative input, want temp2 = bitwise complement of abs(input) */
+ /* This code assumes we are on a two's complement machine */
+ temp2 += temp3;
+
+ /* Find the number of bits needed for the magnitude of the coefficient */
+ nbits = jpeg_nbits_table[temp];
+
+ /* Emit the Huffman-coded symbol for the number of bits */
+ code = dctbl->ehufco[nbits];
+ size = dctbl->ehufsi[nbits];
+ PUT_BITS(code, size)
+ CHECKBUF15()
+
+ /* 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()
/* Encode the AC coefficients per section F.1.2.2 */
r = 0; /* r = run length of zeros */
-#define innerloop(order) { \
- temp2 = *(JCOEF*)((unsigned char*)block + order); \
- if(temp2 == 0) r++; \
- else { \
- temp = (JCOEF)temp2; \
- sflag = temp >> 31; \
- temp = (temp ^ sflag) - sflag; \
- temp2 += sflag; \
- nbits = jpeg_first_bit_table[temp]; \
- for(; r > 15; r -= 16) DUMP_BITS(code_0xf0, size_0xf0) \
- sflag = (r << 4) + nbits; \
- DUMP_VALUE(actbl, sflag, temp2, nbits) \
+/* Manually unroll the k loop to eliminate the counter variable. This
+ * improves performance greatly on systems with a limited number of
+ * registers (such as x86.)
+ */
+#define kloop(jpeg_natural_order_of_k) { \
+ if ((temp = block[jpeg_natural_order_of_k]) == 0) { \
+ r++; \
+ } else { \
+ temp2 = temp; \
+ /* Branch-less absolute value, bitwise complement, etc., same as above */ \
+ temp3 = temp >> (CHAR_BIT * sizeof(int) - 1); \
+ temp ^= temp3; \
+ temp -= temp3; \
+ temp2 += temp3; \
+ nbits = jpeg_nbits_table[temp]; \
+ /* if run length > 15, must emit special run-length-16 codes (0xF0) */ \
+ while (r > 15) { \
+ EMIT_BITS(code_0xf0, size_0xf0) \
+ r -= 16; \
+ } \
+ /* Emit Huffman symbol for run length / number of bits */ \
+ temp3 = (r << 4) + nbits; \
+ code = actbl->ehufco[temp3]; \
+ size = actbl->ehufsi[temp3]; \
+ EMIT_CODE(code, size) \
r = 0; \
- }}
+ } \
+}
- innerloop(2*1); innerloop(2*8); innerloop(2*16); innerloop(2*9);
- innerloop(2*2); innerloop(2*3); innerloop(2*10); innerloop(2*17);
- innerloop(2*24); innerloop(2*32); innerloop(2*25); innerloop(2*18);
- innerloop(2*11); innerloop(2*4); innerloop(2*5); innerloop(2*12);
- innerloop(2*19); innerloop(2*26); innerloop(2*33); innerloop(2*40);
- innerloop(2*48); innerloop(2*41); innerloop(2*34); innerloop(2*27);
- innerloop(2*20); innerloop(2*13); innerloop(2*6); innerloop(2*7);
- innerloop(2*14); innerloop(2*21); innerloop(2*28); innerloop(2*35);
- innerloop(2*42); innerloop(2*49); innerloop(2*56); innerloop(2*57);
- innerloop(2*50); innerloop(2*43); innerloop(2*36); innerloop(2*29);
- innerloop(2*22); innerloop(2*15); innerloop(2*23); innerloop(2*30);
- innerloop(2*37); innerloop(2*44); innerloop(2*51); innerloop(2*58);
- innerloop(2*59); innerloop(2*52); innerloop(2*45); innerloop(2*38);
- innerloop(2*31); innerloop(2*39); innerloop(2*46); innerloop(2*53);
- innerloop(2*60); innerloop(2*61); innerloop(2*54); innerloop(2*47);
- innerloop(2*55); innerloop(2*62); innerloop(2*63);
+ /* One iteration for each value in jpeg_natural_order[] */
+ kloop(1); kloop(8); kloop(16); kloop(9); kloop(2); kloop(3);
+ kloop(10); kloop(17); kloop(24); kloop(32); kloop(25); kloop(18);
+ kloop(11); kloop(4); kloop(5); kloop(12); kloop(19); kloop(26);
+ kloop(33); kloop(40); kloop(48); kloop(41); kloop(34); kloop(27);
+ kloop(20); kloop(13); kloop(6); kloop(7); kloop(14); kloop(21);
+ kloop(28); kloop(35); kloop(42); kloop(49); kloop(56); kloop(57);
+ kloop(50); kloop(43); kloop(36); kloop(29); kloop(22); kloop(15);
+ kloop(23); kloop(30); kloop(37); kloop(44); kloop(51); kloop(58);
+ kloop(59); kloop(52); kloop(45); kloop(38); kloop(31); kloop(39);
+ kloop(46); kloop(53); kloop(60); kloop(61); kloop(54); kloop(47);
+ kloop(55); kloop(62); kloop(63);
/* If the last coef(s) were zero, emit an end-of-block code */
- if (r > 0) DUMP_SINGLE_VALUE(actbl, 0x0)
+ if (r > 0) {
+ code = actbl->ehufco[0];
+ size = actbl->ehufsi[0];
+ EMIT_BITS(code, size)
+ }
state->cur.put_buffer = put_buffer;
state->cur.put_bits = put_bits;
diff --git a/jcmainct.c b/jcmainct.c
index e0279a7..bd0051a 100644
--- a/jcmainct.c
+++ b/jcmainct.c
@@ -68,32 +68,32 @@
METHODDEF(void)
start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
{
- my_main_ptr main = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
/* Do nothing in raw-data mode. */
if (cinfo->raw_data_in)
return;
- main->cur_iMCU_row = 0; /* initialize counters */
- main->rowgroup_ctr = 0;
- main->suspended = FALSE;
- main->pass_mode = pass_mode; /* save mode for use by process_data */
+ main_ptr->cur_iMCU_row = 0; /* initialize counters */
+ main_ptr->rowgroup_ctr = 0;
+ main_ptr->suspended = FALSE;
+ main_ptr->pass_mode = pass_mode; /* save mode for use by process_data */
switch (pass_mode) {
case JBUF_PASS_THRU:
#ifdef FULL_MAIN_BUFFER_SUPPORTED
- if (main->whole_image[0] != NULL)
+ if (main_ptr->whole_image[0] != NULL)
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
#endif
- main->pub.process_data = process_data_simple_main;
+ main_ptr->pub.process_data = process_data_simple_main;
break;
#ifdef FULL_MAIN_BUFFER_SUPPORTED
case JBUF_SAVE_SOURCE:
case JBUF_CRANK_DEST:
case JBUF_SAVE_AND_PASS:
- if (main->whole_image[0] == NULL)
+ if (main_ptr->whole_image[0] == NULL)
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- main->pub.process_data = process_data_buffer_main;
+ main_ptr->pub.process_data = process_data_buffer_main;
break;
#endif
default:
@@ -114,46 +114,46 @@
JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
JDIMENSION in_rows_avail)
{
- my_main_ptr main = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
- while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
+ while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) {
/* Read input data if we haven't filled the main buffer yet */
- if (main->rowgroup_ctr < DCTSIZE)
+ if (main_ptr->rowgroup_ctr < DCTSIZE)
(*cinfo->prep->pre_process_data) (cinfo,
input_buf, in_row_ctr, in_rows_avail,
- main->buffer, &main->rowgroup_ctr,
+ main_ptr->buffer, &main_ptr->rowgroup_ctr,
(JDIMENSION) DCTSIZE);
/* If we don't have a full iMCU row buffered, return to application for
* more data. Note that preprocessor will always pad to fill the iMCU row
* at the bottom of the image.
*/
- if (main->rowgroup_ctr != DCTSIZE)
+ if (main_ptr->rowgroup_ctr != DCTSIZE)
return;
/* Send the completed row to the compressor */
- if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) {
+ if (! (*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) {
/* If compressor did not consume the whole row, then we must need to
* suspend processing and return to the application. In this situation
* we pretend we didn't yet consume the last input row; otherwise, if
* it happened to be the last row of the image, the application would
* think we were done.
*/
- if (! main->suspended) {
+ if (! main_ptr->suspended) {
(*in_row_ctr)--;
- main->suspended = TRUE;
+ main_ptr->suspended = TRUE;
}
return;
}
/* We did finish the row. Undo our little suspension hack if a previous
* call suspended; then mark the main buffer empty.
*/
- if (main->suspended) {
+ if (main_ptr->suspended) {
(*in_row_ctr)++;
- main->suspended = FALSE;
+ main_ptr->suspended = FALSE;
}
- main->rowgroup_ctr = 0;
- main->cur_iMCU_row++;
+ main_ptr->rowgroup_ctr = 0;
+ main_ptr->cur_iMCU_row++;
}
}
@@ -173,22 +173,22 @@
my_main_ptr main = (my_main_ptr) cinfo->main;
int ci;
jpeg_component_info *compptr;
- boolean writing = (main->pass_mode != JBUF_CRANK_DEST);
+ boolean writing = (main_ptr->pass_mode != JBUF_CRANK_DEST);
- while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
+ while (main_ptr->cur_iMCU_row < cinfo->total_iMCU_rows) {
/* Realign the virtual buffers if at the start of an iMCU row. */
- if (main->rowgroup_ctr == 0) {
+ if (main_ptr->rowgroup_ctr == 0) {
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
- main->buffer[ci] = (*cinfo->mem->access_virt_sarray)
- ((j_common_ptr) cinfo, main->whole_image[ci],
- main->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE),
+ main_ptr->buffer[ci] = (*cinfo->mem->access_virt_sarray)
+ ((j_common_ptr) cinfo, main_ptr->whole_image[ci],
+ main_ptr->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE),
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing);
}
/* In a read pass, pretend we just read some source data. */
if (! writing) {
*in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE;
- main->rowgroup_ctr = DCTSIZE;
+ main_ptr->rowgroup_ctr = DCTSIZE;
}
}
@@ -197,40 +197,40 @@
if (writing) {
(*cinfo->prep->pre_process_data) (cinfo,
input_buf, in_row_ctr, in_rows_avail,
- main->buffer, &main->rowgroup_ctr,
+ main_ptr->buffer, &main_ptr->rowgroup_ctr,
(JDIMENSION) DCTSIZE);
/* Return to application if we need more data to fill the iMCU row. */
- if (main->rowgroup_ctr < DCTSIZE)
+ if (main_ptr->rowgroup_ctr < DCTSIZE)
return;
}
/* Emit data, unless this is a sink-only pass. */
- if (main->pass_mode != JBUF_SAVE_SOURCE) {
- if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) {
+ if (main_ptr->pass_mode != JBUF_SAVE_SOURCE) {
+ if (! (*cinfo->coef->compress_data) (cinfo, main_ptr->buffer)) {
/* If compressor did not consume the whole row, then we must need to
* suspend processing and return to the application. In this situation
* we pretend we didn't yet consume the last input row; otherwise, if
* it happened to be the last row of the image, the application would
* think we were done.
*/
- if (! main->suspended) {
+ if (! main_ptr->suspended) {
(*in_row_ctr)--;
- main->suspended = TRUE;
+ main_ptr->suspended = TRUE;
}
return;
}
/* We did finish the row. Undo our little suspension hack if a previous
* call suspended; then mark the main buffer empty.
*/
- if (main->suspended) {
+ if (main_ptr->suspended) {
(*in_row_ctr)++;
- main->suspended = FALSE;
+ main_ptr->suspended = FALSE;
}
}
/* If get here, we are done with this iMCU row. Mark buffer empty. */
- main->rowgroup_ctr = 0;
- main->cur_iMCU_row++;
+ main_ptr->rowgroup_ctr = 0;
+ main_ptr->cur_iMCU_row++;
}
}
@@ -244,15 +244,15 @@
GLOBAL(void)
jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
{
- my_main_ptr main;
+ my_main_ptr main_ptr;
int ci;
jpeg_component_info *compptr;
- main = (my_main_ptr)
+ main_ptr = (my_main_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(my_main_controller));
- cinfo->main = (struct jpeg_c_main_controller *) main;
- main->pub.start_pass = start_pass_main;
+ cinfo->main = (struct jpeg_c_main_controller *) main_ptr;
+ main_ptr->pub.start_pass = start_pass_main;
/* We don't need to create a buffer in raw-data mode. */
if (cinfo->raw_data_in)
@@ -267,7 +267,7 @@
/* Note we pad the bottom to a multiple of the iMCU height */
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
- main->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
+ main_ptr->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
compptr->width_in_blocks * DCTSIZE,
(JDIMENSION) jround_up((long) compptr->height_in_blocks,
@@ -279,12 +279,12 @@
#endif
} else {
#ifdef FULL_MAIN_BUFFER_SUPPORTED
- main->whole_image[0] = NULL; /* flag for no virtual arrays */
+ main_ptr->whole_image[0] = NULL; /* flag for no virtual arrays */
#endif
/* Allocate a strip buffer for each component */
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
- main->buffer[ci] = (*cinfo->mem->alloc_sarray)
+ main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray)
((j_common_ptr) cinfo, JPOOL_IMAGE,
compptr->width_in_blocks * DCTSIZE,
(JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
diff --git a/jconfig.h.in b/jconfig.h.in
index 670afab..4aef763 100644
--- a/jconfig.h.in
+++ b/jconfig.h.in
@@ -9,7 +9,7 @@
/* Support arithmetic decoding */
#undef D_ARITH_CODING_SUPPORTED
-/* Define if your compiler supports prototypes */
+/* Compiler supports function prototypes. */
#undef HAVE_PROTOTYPES
/* Define to 1 if you have the <stddef.h> header file. */
@@ -18,25 +18,28 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
-/* Define to 1 if the system has the type `unsigned char'. */
+/* Compiler supports 'unsigned char'. */
#undef HAVE_UNSIGNED_CHAR
-/* Define to 1 if the system has the type `unsigned short'. */
+/* Compiler supports 'unsigned short'. */
#undef HAVE_UNSIGNED_SHORT
-/* Define if you want use complete types */
+/* Compiler does not support pointers to unspecified structures. */
#undef INCOMPLETE_TYPES_BROKEN
-/* Define if you have BSD-like bzero and bcopy */
+/* How to obtain function inlining. */
+#undef INLINE
+
+/* Compiler has <strings.h> rather than standard <string.h>. */
#undef NEED_BSD_STRINGS
-/* Define if you need short function names */
+/* Linker requires that global names be unique in first 15 characters. */
#undef NEED_SHORT_EXTERNAL_NAMES
-/* Define if you have sys/types.h */
+/* Need to include <sys/types.h> in order to obtain size_t. */
#undef NEED_SYS_TYPES_H
-/* Define if shift is unsigned */
+/* Broken compiler shifts signed values as an unsigned shift. */
#undef RIGHT_SHIFT_IS_UNSIGNED
/* Use accelerated SIMD routines. */
@@ -50,11 +53,5 @@
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
-/* Define to `__inline__' or `__inline' if that's what the C compiler
- calls it, or to nothing if 'inline' is not supported under any name. */
-#ifndef __cplusplus
-#undef inline
-#endif
-
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
diff --git a/jdatadst-tj.c b/jdatadst-tj.c
new file mode 100644
index 0000000..cb674dc
--- /dev/null
+++ b/jdatadst-tj.c
@@ -0,0 +1,188 @@
+/*
+ * jdatadst.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * Modified 2009 by Guido Vollbeding.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains compression data destination routines for the case of
+ * emitting JPEG data to memory or to a file (or any stdio stream).
+ * While these routines are sufficient for most applications,
+ * some will want to use a different destination manager.
+ * IMPORTANT: we assume that fwrite() will correctly transcribe an array of
+ * JOCTETs into 8-bit-wide elements on external storage. If char is wider
+ * than 8 bits on your machine, you may need to do some tweaking.
+ */
+
+/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jerror.h"
+
+#ifndef HAVE_STDLIB_H /* <stdlib.h> should declare malloc(),free() */
+extern void * malloc JPP((size_t size));
+extern void free JPP((void *ptr));
+#endif
+
+
+#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */
+
+
+/* Expanded data destination object for memory output */
+
+typedef struct {
+ struct jpeg_destination_mgr pub; /* public fields */
+
+ unsigned char ** outbuffer; /* target buffer */
+ unsigned long * outsize;
+ unsigned char * newbuffer; /* newly allocated buffer */
+ JOCTET * buffer; /* start of buffer */
+ size_t bufsize;
+ boolean alloc;
+} my_mem_destination_mgr;
+
+typedef my_mem_destination_mgr * my_mem_dest_ptr;
+
+
+/*
+ * Initialize destination --- called by jpeg_start_compress
+ * before any data is actually written.
+ */
+
+METHODDEF(void)
+init_mem_destination (j_compress_ptr cinfo)
+{
+ /* no work necessary here */
+}
+
+
+/*
+ * Empty the output buffer --- called whenever buffer fills up.
+ *
+ * In typical applications, this should write the entire output buffer
+ * (ignoring the current state of next_output_byte & free_in_buffer),
+ * reset the pointer & count to the start of the buffer, and return TRUE
+ * indicating that the buffer has been dumped.
+ *
+ * In applications that need to be able to suspend compression due to output
+ * overrun, a FALSE return indicates that the buffer cannot be emptied now.
+ * In this situation, the compressor will return to its caller (possibly with
+ * an indication that it has not accepted all the supplied scanlines). The
+ * application should resume compression after it has made more room in the
+ * output buffer. Note that there are substantial restrictions on the use of
+ * suspension --- see the documentation.
+ *
+ * When suspending, the compressor will back up to a convenient restart point
+ * (typically the start of the current MCU). next_output_byte & free_in_buffer
+ * indicate where the restart point will be if the current call returns FALSE.
+ * Data beyond this point will be regenerated after resumption, so do not
+ * write it out when emptying the buffer externally.
+ */
+
+METHODDEF(boolean)
+empty_mem_output_buffer (j_compress_ptr cinfo)
+{
+ size_t nextsize;
+ JOCTET * nextbuffer;
+ my_mem_dest_ptr dest = (my_mem_dest_ptr) cinfo->dest;
+
+ if (!dest->alloc) ERREXIT(cinfo, JERR_BUFFER_SIZE);
+
+ /* Try to allocate new buffer with double size */
+ nextsize = dest->bufsize * 2;
+ nextbuffer = malloc(nextsize);
+
+ if (nextbuffer == NULL)
+ ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
+
+ MEMCOPY(nextbuffer, dest->buffer, dest->bufsize);
+
+ if (dest->newbuffer != NULL)
+ free(dest->newbuffer);
+
+ dest->newbuffer = nextbuffer;
+
+ dest->pub.next_output_byte = nextbuffer + dest->bufsize;
+ dest->pub.free_in_buffer = dest->bufsize;
+
+ dest->buffer = nextbuffer;
+ dest->bufsize = nextsize;
+
+ return TRUE;
+}
+
+
+/*
+ * Terminate destination --- called by jpeg_finish_compress
+ * after all data has been written. Usually needs to flush buffer.
+ *
+ * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
+ * application must deal with any cleanup that should happen even
+ * for error exit.
+ */
+
+METHODDEF(void)
+term_mem_destination (j_compress_ptr cinfo)
+{
+ my_mem_dest_ptr dest = (my_mem_dest_ptr) cinfo->dest;
+
+ if(dest->alloc) *dest->outbuffer = dest->buffer;
+ *dest->outsize = (unsigned long)(dest->bufsize - dest->pub.free_in_buffer);
+}
+
+
+/*
+ * Prepare for output to a memory buffer.
+ * The caller may supply an own initial buffer with appropriate size.
+ * Otherwise, or when the actual data output exceeds the given size,
+ * the library adapts the buffer size as necessary.
+ * The standard library functions malloc/free are used for allocating
+ * larger memory, so the buffer is available to the application after
+ * finishing compression, and then the application is responsible for
+ * freeing the requested memory.
+ */
+
+GLOBAL(void)
+jpeg_mem_dest_tj (j_compress_ptr cinfo,
+ unsigned char ** outbuffer, unsigned long * outsize,
+ boolean alloc)
+{
+ my_mem_dest_ptr dest;
+
+ if (outbuffer == NULL || outsize == NULL) /* sanity check */
+ ERREXIT(cinfo, JERR_BUFFER_SIZE);
+
+ /* The destination object is made permanent so that multiple JPEG images
+ * can be written to the same buffer without re-executing jpeg_mem_dest.
+ */
+ if (cinfo->dest == NULL) { /* first time for this JPEG object? */
+ cinfo->dest = (struct jpeg_destination_mgr *)
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ SIZEOF(my_mem_destination_mgr));
+ dest = (my_mem_dest_ptr) cinfo->dest;
+ dest->newbuffer = NULL;
+ }
+
+ dest = (my_mem_dest_ptr) cinfo->dest;
+ dest->pub.init_destination = init_mem_destination;
+ dest->pub.empty_output_buffer = empty_mem_output_buffer;
+ dest->pub.term_destination = term_mem_destination;
+ dest->outbuffer = outbuffer;
+ dest->outsize = outsize;
+ dest->alloc = alloc;
+
+ if (*outbuffer == NULL || *outsize == 0) {
+ if (alloc) {
+ /* Allocate initial buffer */
+ dest->newbuffer = *outbuffer = malloc(OUTPUT_BUF_SIZE);
+ if (dest->newbuffer == NULL)
+ ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
+ *outsize = OUTPUT_BUF_SIZE;
+ }
+ else ERREXIT(cinfo, JERR_BUFFER_SIZE);
+ }
+
+ dest->pub.next_output_byte = dest->buffer = *outbuffer;
+ dest->pub.free_in_buffer = dest->bufsize = *outsize;
+}
diff --git a/jdatasrc-tj.c b/jdatasrc-tj.c
new file mode 100644
index 0000000..d860a02
--- /dev/null
+++ b/jdatasrc-tj.c
@@ -0,0 +1,182 @@
+/*
+ * jdatasrc.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * Modified 2009-2010 by Guido Vollbeding.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains decompression data source routines for the case of
+ * reading JPEG data from memory or from a file (or any stdio stream).
+ * While these routines are sufficient for most applications,
+ * some will want to use a different source manager.
+ * IMPORTANT: we assume that fread() will correctly transcribe an array of
+ * JOCTETs from 8-bit-wide elements on external storage. If char is wider
+ * than 8 bits on your machine, you may need to do some tweaking.
+ */
+
+/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
+#include "jinclude.h"
+#include "jpeglib.h"
+#include "jerror.h"
+
+
+/*
+ * Initialize source --- called by jpeg_read_header
+ * before any data is actually read.
+ */
+
+METHODDEF(void)
+init_mem_source (j_decompress_ptr cinfo)
+{
+ /* no work necessary here */
+}
+
+
+/*
+ * Fill the input buffer --- called whenever buffer is emptied.
+ *
+ * In typical applications, this should read fresh data into the buffer
+ * (ignoring the current state of next_input_byte & bytes_in_buffer),
+ * reset the pointer & count to the start of the buffer, and return TRUE
+ * indicating that the buffer has been reloaded. It is not necessary to
+ * fill the buffer entirely, only to obtain at least one more byte.
+ *
+ * There is no such thing as an EOF return. If the end of the file has been
+ * reached, the routine has a choice of ERREXIT() or inserting fake data into
+ * the buffer. In most cases, generating a warning message and inserting a
+ * fake EOI marker is the best course of action --- this will allow the
+ * decompressor to output however much of the image is there. However,
+ * the resulting error message is misleading if the real problem is an empty
+ * input file, so we handle that case specially.
+ *
+ * In applications that need to be able to suspend compression due to input
+ * not being available yet, a FALSE return indicates that no more data can be
+ * obtained right now, but more may be forthcoming later. In this situation,
+ * the decompressor will return to its caller (with an indication of the
+ * number of scanlines it has read, if any). The application should resume
+ * decompression after it has loaded more data into the input buffer. Note
+ * that there are substantial restrictions on the use of suspension --- see
+ * the documentation.
+ *
+ * When suspending, the decompressor will back up to a convenient restart point
+ * (typically the start of the current MCU). next_input_byte & bytes_in_buffer
+ * indicate where the restart point will be if the current call returns FALSE.
+ * Data beyond this point must be rescanned after resumption, so move it to
+ * the front of the buffer rather than discarding it.
+ */
+
+METHODDEF(boolean)
+fill_mem_input_buffer (j_decompress_ptr cinfo)
+{
+ static JOCTET mybuffer[4];
+
+ /* The whole JPEG data is expected to reside in the supplied memory
+ * buffer, so any request for more data beyond the given buffer size
+ * is treated as an error.
+ */
+ WARNMS(cinfo, JWRN_JPEG_EOF);
+ /* Insert a fake EOI marker */
+ mybuffer[0] = (JOCTET) 0xFF;
+ mybuffer[1] = (JOCTET) JPEG_EOI;
+
+ cinfo->src->next_input_byte = mybuffer;
+ cinfo->src->bytes_in_buffer = 2;
+
+ return TRUE;
+}
+
+
+/*
+ * Skip data --- used to skip over a potentially large amount of
+ * uninteresting data (such as an APPn marker).
+ *
+ * Writers of suspendable-input applications must note that skip_input_data
+ * is not granted the right to give a suspension return. If the skip extends
+ * beyond the data currently in the buffer, the buffer can be marked empty so
+ * that the next read will cause a fill_input_buffer call that can suspend.
+ * Arranging for additional bytes to be discarded before reloading the input
+ * buffer is the application writer's problem.
+ */
+
+METHODDEF(void)
+skip_input_data (j_decompress_ptr cinfo, long num_bytes)
+{
+ struct jpeg_source_mgr * src = cinfo->src;
+
+ /* Just a dumb implementation for now. Could use fseek() except
+ * it doesn't work on pipes. Not clear that being smart is worth
+ * any trouble anyway --- large skips are infrequent.
+ */
+ if (num_bytes > 0) {
+ while (num_bytes > (long) src->bytes_in_buffer) {
+ num_bytes -= (long) src->bytes_in_buffer;
+ (void) (*src->fill_input_buffer) (cinfo);
+ /* note we assume that fill_input_buffer will never return FALSE,
+ * so suspension need not be handled.
+ */
+ }
+ src->next_input_byte += (size_t) num_bytes;
+ src->bytes_in_buffer -= (size_t) num_bytes;
+ }
+}
+
+
+/*
+ * An additional method that can be provided by data source modules is the
+ * resync_to_restart method for error recovery in the presence of RST markers.
+ * For the moment, this source module just uses the default resync method
+ * provided by the JPEG library. That method assumes that no backtracking
+ * is possible.
+ */
+
+
+/*
+ * Terminate source --- called by jpeg_finish_decompress
+ * after all data has been read. Often a no-op.
+ *
+ * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
+ * application must deal with any cleanup that should happen even
+ * for error exit.
+ */
+
+METHODDEF(void)
+term_source (j_decompress_ptr cinfo)
+{
+ /* no work necessary here */
+}
+
+
+/*
+ * Prepare for input from a supplied memory buffer.
+ * The buffer must contain the whole JPEG data.
+ */
+
+GLOBAL(void)
+jpeg_mem_src_tj (j_decompress_ptr cinfo,
+ unsigned char * inbuffer, unsigned long insize)
+{
+ struct jpeg_source_mgr * src;
+
+ if (inbuffer == NULL || insize == 0) /* Treat empty input as fatal error */
+ ERREXIT(cinfo, JERR_INPUT_EMPTY);
+
+ /* The source object is made permanent so that a series of JPEG images
+ * can be read from the same buffer by calling jpeg_mem_src only before
+ * the first one.
+ */
+ if (cinfo->src == NULL) { /* first time for this JPEG object? */
+ cinfo->src = (struct jpeg_source_mgr *)
+ (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ SIZEOF(struct jpeg_source_mgr));
+ }
+
+ src = cinfo->src;
+ src->init_source = init_mem_source;
+ src->fill_input_buffer = fill_mem_input_buffer;
+ src->skip_input_data = skip_input_data;
+ src->resync_to_restart = jpeg_resync_to_restart; /* use default method */
+ src->term_source = term_source;
+ src->bytes_in_buffer = (size_t) insize;
+ src->next_input_byte = (JOCTET *) inbuffer;
+}
diff --git a/jdcolext.c b/jdcolext.c
new file mode 100644
index 0000000..07da949
--- /dev/null
+++ b/jdcolext.c
@@ -0,0 +1,104 @@
+/*
+ * jdcolext.c
+ *
+ * Copyright (C) 1991-1997, Thomas G. Lane.
+ * Copyright (C) 2009, 2011, D. R. Commander.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains output colorspace conversion routines.
+ */
+
+
+/* This file is included by jdcolor.c */
+
+
+/*
+ * Convert some rows of samples to the output colorspace.
+ *
+ * Note that we change from noninterleaved, one-plane-per-component format
+ * to interleaved-pixel format. The output buffer is therefore three times
+ * as wide as the input buffer.
+ * A starting row offset is provided only for the input buffer. The caller
+ * can easily adjust the passed output_buf value to accommodate any row
+ * offset required on that side.
+ */
+
+INLINE
+LOCAL(void)
+ycc_rgb_convert_internal (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows)
+{
+ my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
+ register int y, cb, cr;
+ register JSAMPROW outptr;
+ register JSAMPROW inptr0, inptr1, inptr2;
+ register JDIMENSION col;
+ JDIMENSION num_cols = cinfo->output_width;
+ /* copy these pointers into registers if possible */
+ register JSAMPLE * range_limit = cinfo->sample_range_limit;
+ register int * Crrtab = cconvert->Cr_r_tab;
+ register int * Cbbtab = cconvert->Cb_b_tab;
+ register INT32 * Crgtab = cconvert->Cr_g_tab;
+ register INT32 * Cbgtab = cconvert->Cb_g_tab;
+ SHIFT_TEMPS
+
+ while (--num_rows >= 0) {
+ inptr0 = input_buf[0][input_row];
+ inptr1 = input_buf[1][input_row];
+ inptr2 = input_buf[2][input_row];
+ input_row++;
+ outptr = *output_buf++;
+ for (col = 0; col < num_cols; col++) {
+ y = GETJSAMPLE(inptr0[col]);
+ cb = GETJSAMPLE(inptr1[col]);
+ cr = GETJSAMPLE(inptr2[col]);
+ /* Range-limiting is essential due to noise introduced by DCT losses. */
+ outptr[RGB_RED] = range_limit[y + Crrtab[cr]];
+ outptr[RGB_GREEN] = range_limit[y +
+ ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
+ SCALEBITS))];
+ outptr[RGB_BLUE] = range_limit[y + Cbbtab[cb]];
+ /* Set unused byte to 0xFF so it can be interpreted as an opaque */
+ /* alpha channel value */
+#ifdef RGB_ALPHA
+ outptr[RGB_ALPHA] = 0xFF;
+#endif
+ outptr += RGB_PIXELSIZE;
+ }
+ }
+}
+
+
+/*
+ * Convert grayscale to RGB: just duplicate the graylevel three times.
+ * This is provided to support applications that don't want to cope
+ * with grayscale as a separate case.
+ */
+
+INLINE
+LOCAL(void)
+gray_rgb_convert_internal (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows)
+{
+ register JSAMPROW inptr, outptr;
+ register JDIMENSION col;
+ JDIMENSION num_cols = cinfo->output_width;
+
+ while (--num_rows >= 0) {
+ inptr = input_buf[0][input_row++];
+ outptr = *output_buf++;
+ for (col = 0; col < num_cols; col++) {
+ /* We can dispense with GETJSAMPLE() here */
+ outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col];
+ /* Set unused byte to 0xFF so it can be interpreted as an opaque */
+ /* alpha channel value */
+#ifdef RGB_ALPHA
+ outptr[RGB_ALPHA] = 0xFF;
+#endif
+ outptr += RGB_PIXELSIZE;
+ }
+ }
+}
diff --git a/jdcolor.c b/jdcolor.c
index bc73b3f..05d389a 100644
--- a/jdcolor.c
+++ b/jdcolor.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 1991-1997, Thomas G. Lane.
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
- * Copyright (C) 2009, D. R. Commander.
+ * Copyright (C) 2009, 2011, D. R. Commander.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -65,6 +65,107 @@
#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
+/* Include inline routines for colorspace extensions */
+
+#include "jdcolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+
+#define RGB_RED EXT_RGB_RED
+#define RGB_GREEN EXT_RGB_GREEN
+#define RGB_BLUE EXT_RGB_BLUE
+#define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
+#define ycc_rgb_convert_internal ycc_extrgb_convert_internal
+#define gray_rgb_convert_internal gray_extrgb_convert_internal
+#include "jdcolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef ycc_rgb_convert_internal
+#undef gray_rgb_convert_internal
+
+#define RGB_RED EXT_RGBX_RED
+#define RGB_GREEN EXT_RGBX_GREEN
+#define RGB_BLUE EXT_RGBX_BLUE
+#define RGB_ALPHA 3
+#define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
+#define ycc_rgb_convert_internal ycc_extrgbx_convert_internal
+#define gray_rgb_convert_internal gray_extrgbx_convert_internal
+#include "jdcolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_ALPHA
+#undef RGB_PIXELSIZE
+#undef ycc_rgb_convert_internal
+#undef gray_rgb_convert_internal
+
+#define RGB_RED EXT_BGR_RED
+#define RGB_GREEN EXT_BGR_GREEN
+#define RGB_BLUE EXT_BGR_BLUE
+#define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
+#define ycc_rgb_convert_internal ycc_extbgr_convert_internal
+#define gray_rgb_convert_internal gray_extbgr_convert_internal
+#include "jdcolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef ycc_rgb_convert_internal
+#undef gray_rgb_convert_internal
+
+#define RGB_RED EXT_BGRX_RED
+#define RGB_GREEN EXT_BGRX_GREEN
+#define RGB_BLUE EXT_BGRX_BLUE
+#define RGB_ALPHA 3
+#define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
+#define ycc_rgb_convert_internal ycc_extbgrx_convert_internal
+#define gray_rgb_convert_internal gray_extbgrx_convert_internal
+#include "jdcolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_ALPHA
+#undef RGB_PIXELSIZE
+#undef ycc_rgb_convert_internal
+#undef gray_rgb_convert_internal
+
+#define RGB_RED EXT_XBGR_RED
+#define RGB_GREEN EXT_XBGR_GREEN
+#define RGB_BLUE EXT_XBGR_BLUE
+#define RGB_ALPHA 0
+#define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
+#define ycc_rgb_convert_internal ycc_extxbgr_convert_internal
+#define gray_rgb_convert_internal gray_extxbgr_convert_internal
+#include "jdcolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_ALPHA
+#undef RGB_PIXELSIZE
+#undef ycc_rgb_convert_internal
+#undef gray_rgb_convert_internal
+
+#define RGB_RED EXT_XRGB_RED
+#define RGB_GREEN EXT_XRGB_GREEN
+#define RGB_BLUE EXT_XRGB_BLUE
+#define RGB_ALPHA 0
+#define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
+#define ycc_rgb_convert_internal ycc_extxrgb_convert_internal
+#define gray_rgb_convert_internal gray_extxrgb_convert_internal
+#include "jdcolext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_ALPHA
+#undef RGB_PIXELSIZE
+#undef ycc_rgb_convert_internal
+#undef gray_rgb_convert_internal
+
+
/*
* Initialize tables for YCC->RGB colorspace conversion.
*/
@@ -110,13 +211,6 @@
/*
* Convert some rows of samples to the output colorspace.
- *
- * Note that we change from noninterleaved, one-plane-per-component format
- * to interleaved-pixel format. The output buffer is therefore three times
- * as wide as the input buffer.
- * A starting row offset is provided only for the input buffer. The caller
- * can easily adjust the passed output_buf value to accommodate any row
- * offset required on that side.
*/
METHODDEF(void)
@@ -124,38 +218,35 @@
JSAMPIMAGE input_buf, JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows)
{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- register int y, cb, cr;
- register JSAMPROW outptr;
- register JSAMPROW inptr0, inptr1, inptr2;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->output_width;
- /* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- register int * Crrtab = cconvert->Cr_r_tab;
- register int * Cbbtab = cconvert->Cb_b_tab;
- register INT32 * Crgtab = cconvert->Cr_g_tab;
- register INT32 * Cbgtab = cconvert->Cb_g_tab;
- SHIFT_TEMPS
-
- while (--num_rows >= 0) {
- inptr0 = input_buf[0][input_row];
- inptr1 = input_buf[1][input_row];
- inptr2 = input_buf[2][input_row];
- input_row++;
- outptr = *output_buf++;
- for (col = 0; col < num_cols; col++) {
- y = GETJSAMPLE(inptr0[col]);
- cb = GETJSAMPLE(inptr1[col]);
- cr = GETJSAMPLE(inptr2[col]);
- /* Range-limiting is essential due to noise introduced by DCT losses. */
- outptr[rgb_red[cinfo->out_color_space]] = range_limit[y + Crrtab[cr]];
- outptr[rgb_green[cinfo->out_color_space]] = range_limit[y +
- ((int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr],
- SCALEBITS))];
- outptr[rgb_blue[cinfo->out_color_space]] = range_limit[y + Cbbtab[cb]];
- outptr += rgb_pixelsize[cinfo->out_color_space];
- }
+ switch (cinfo->out_color_space) {
+ case JCS_EXT_RGB:
+ ycc_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_RGBX:
+ ycc_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_BGR:
+ ycc_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_BGRX:
+ ycc_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_XBGR:
+ ycc_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_XRGB:
+ ycc_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ default:
+ ycc_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
}
}
@@ -211,9 +302,7 @@
/*
- * Convert grayscale to RGB: just duplicate the graylevel three times.
- * This is provided to support applications that don't want to cope
- * with grayscale as a separate case.
+ * Convert grayscale to RGB
*/
METHODDEF(void)
@@ -221,22 +310,35 @@
JSAMPIMAGE input_buf, JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows)
{
- register JSAMPROW inptr, outptr;
- JSAMPLE *maxinptr;
- JDIMENSION num_cols = cinfo->output_width;
- int rindex = rgb_red[cinfo->out_color_space];
- int gindex = rgb_green[cinfo->out_color_space];
- int bindex = rgb_blue[cinfo->out_color_space];
- int rgbstride = rgb_pixelsize[cinfo->out_color_space];
-
- while (--num_rows >= 0) {
- inptr = input_buf[0][input_row++];
- maxinptr = &inptr[num_cols];
- outptr = *output_buf++;
- for (; inptr < maxinptr; inptr++, outptr += rgbstride) {
- /* We can dispense with GETJSAMPLE() here */
- outptr[rindex] = outptr[gindex] = outptr[bindex] = *inptr;
- }
+ switch (cinfo->out_color_space) {
+ case JCS_EXT_RGB:
+ gray_extrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_RGBX:
+ gray_extrgbx_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_BGR:
+ gray_extbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_BGRX:
+ gray_extbgrx_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_XBGR:
+ gray_extxbgr_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ case JCS_EXT_XRGB:
+ gray_extxrgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
+ default:
+ gray_rgb_convert_internal(cinfo, input_buf, input_row, output_buf,
+ num_rows);
+ break;
}
}
diff --git a/jdhuff.c b/jdhuff.c
index b795462..c2b38a9 100644
--- a/jdhuff.c
+++ b/jdhuff.c
@@ -2,7 +2,7 @@
* jdhuff.c
*
* Copyright (C) 1991-1997, Thomas G. Lane.
- * Copyright (C) 2010, D. R. Commander.
+ * Copyright (C) 2009-2011, D. R. Commander.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -15,21 +15,6 @@
* storage only upon successful completion of an MCU.
*/
-/* Performance enhancements:
- * Copyright (C)2007 Sun Microsystems, Inc.
- * Copyright (C)2009-2010 D. R. Commander
- *
- * This library is free software and may be redistributed and/or modified under
- * the terms of the wxWindows Library License, Version 3.1 or (at your option)
- * any later version. The full license is in the LICENSE.txt file included
- * with this distribution.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * wxWindows Library License for more details.
- */
-
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
@@ -407,6 +392,50 @@
}
+/* Macro version of the above, which performs much better but does not
+ handle markers. We have to hand off any blocks with markers to the
+ slower routines. */
+
+#define GET_BYTE \
+{ \
+ register int c0, c1; \
+ c0 = GETJOCTET(*buffer++); \
+ c1 = GETJOCTET(*buffer); \
+ /* Pre-execute most common case */ \
+ get_buffer = (get_buffer << 8) | c0; \
+ bits_left += 8; \
+ if (c0 == 0xFF) { \
+ /* Pre-execute case of FF/00, which represents an FF data byte */ \
+ buffer++; \
+ if (c1 != 0) { \
+ /* Oops, it's actually a marker indicating end of compressed data. */ \
+ cinfo->unread_marker = c1; \
+ /* Back out pre-execution and fill the buffer with zero bits */ \
+ buffer -= 2; \
+ get_buffer &= ~0xFF; \
+ } \
+ } \
+}
+
+#if __WORDSIZE == 64 || defined(_WIN64)
+
+/* Pre-fetch 48 bytes, because the holding register is 64-bit */
+#define FILL_BIT_BUFFER_FAST \
+ if (bits_left < 16) { \
+ GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE GET_BYTE \
+ }
+
+#else
+
+/* Pre-fetch 16 bytes, because the holding register is 32-bit */
+#define FILL_BIT_BUFFER_FAST \
+ if (bits_left < 16) { \
+ GET_BYTE GET_BYTE \
+ }
+
+#endif
+
+
/*
* Out-of-line code for Huffman code decoding.
* See jdhuff.h for info about usage.
@@ -612,61 +641,6 @@
}
-/***************************************************************/
-
-#define ADD_BYTE { \
- int val0 = *(buffer++); \
- int val1 = *(buffer); \
- \
- bits_left += 8; \
- get_buffer = (get_buffer << 8) | (val0); \
- if (val0 == 0xFF) { \
- buffer++; \
- if (val1 != 0) { \
- cinfo->unread_marker = val1; \
- buffer -= 2; \
- get_buffer &= ~0xFF; \
- } \
- } \
-}
-
-/***************************************************************/
-
-#if __WORDSIZE == 64 || defined(_WIN64)
-
-#define ENSURE_SHORT \
- if (bits_left < 16) { \
- ADD_BYTE ADD_BYTE ADD_BYTE ADD_BYTE ADD_BYTE ADD_BYTE \
- }
-
-#else
-
-#define ENSURE_SHORT if (bits_left < 16) { ADD_BYTE ADD_BYTE }
-
-#endif
-
-/***************************************************************/
-
-#define HUFF_DECODE_FAST(symbol, size, htbl) { \
- ENSURE_SHORT \
- symbol = PEEK_BITS(HUFF_LOOKAHEAD); \
- symbol = htbl->lookup[symbol]; \
- size = symbol >> 8; \
- bits_left -= size; \
- symbol = symbol & ((1 << HUFF_LOOKAHEAD) - 1); \
- if (size == HUFF_LOOKAHEAD + 1) { \
- symbol = (get_buffer >> bits_left) & ((1 << (size)) - 1); \
- while (symbol > htbl->maxcode[size]) { \
- symbol <<= 1; \
- symbol |= GET_BITS(1); \
- size++; \
- } \
- symbol = htbl->pub->huffval[ (int) (symbol + htbl->valoffset[size]) & 0xFF ]; \
- } \
-}
-
-/***************************************************************/
-
LOCAL(boolean)
decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
@@ -690,7 +664,7 @@
HUFF_DECODE_FAST(s, l, dctbl);
if (s) {
- ENSURE_SHORT
+ FILL_BIT_BUFFER_FAST
r = GET_BITS(s);
s = HUFF_EXTEND(r, s);
}
@@ -711,7 +685,7 @@
if (s) {
k += r;
- ENSURE_SHORT
+ FILL_BIT_BUFFER_FAST
r = GET_BITS(s);
s = HUFF_EXTEND(r, s);
(*block)[jpeg_natural_order[k]] = (JCOEF) s;
@@ -730,7 +704,7 @@
if (s) {
k += r;
- ENSURE_SHORT
+ FILL_BIT_BUFFER_FAST
DROP_BITS(s);
} else {
if (r != 15) break;
diff --git a/jdhuff.h b/jdhuff.h
index 2697488..96f2dab 100644
--- a/jdhuff.h
+++ b/jdhuff.h
@@ -2,7 +2,7 @@
* jdhuff.h
*
* Copyright (C) 1991-1997, Thomas G. Lane.
- * Copyright (C) 2010, D. R. Commander.
+ * Copyright (C) 2010-2011, D. R. Commander.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -208,6 +208,26 @@
} \
}
+#define HUFF_DECODE_FAST(s,nb,htbl) \
+ FILL_BIT_BUFFER_FAST; \
+ s = PEEK_BITS(HUFF_LOOKAHEAD); \
+ s = htbl->lookup[s]; \
+ nb = s >> HUFF_LOOKAHEAD; \
+ /* Pre-execute the common case of nb <= HUFF_LOOKAHEAD */ \
+ DROP_BITS(nb); \
+ s = s & ((1 << HUFF_LOOKAHEAD) - 1); \
+ if (nb > HUFF_LOOKAHEAD) { \
+ /* Equivalent of jpeg_huff_decode() */ \
+ /* Don't use GET_BITS() here because we don't want to modify bits_left */ \
+ s = (get_buffer >> bits_left) & ((1 << (nb)) - 1); \
+ while (s > htbl->maxcode[nb]) { \
+ s <<= 1; \
+ s |= GET_BITS(1); \
+ nb++; \
+ } \
+ s = htbl->pub->huffval[ (int) (s + htbl->valoffset[nb]) & 0xFF ]; \
+ }
+
/* Out-of-line case for Huffman code fetching */
EXTERN(int) jpeg_huff_decode
JPP((bitread_working_state * state, register bit_buf_type get_buffer,
diff --git a/jdmainct.c b/jdmainct.c
index 67f6215..eb32cae 100644
--- a/jdmainct.c
+++ b/jdmainct.c
@@ -161,7 +161,7 @@
* This is done only once, not once per pass.
*/
{
- my_main_ptr main = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
int ci, rgroup;
int M = cinfo->_min_DCT_scaled_size;
jpeg_component_info *compptr;
@@ -170,10 +170,10 @@
/* Get top-level space for component array pointers.
* We alloc both arrays with one call to save a few cycles.
*/
- main->xbuffer[0] = (JSAMPIMAGE)
+ main_ptr->xbuffer[0] = (JSAMPIMAGE)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
cinfo->num_components * 2 * SIZEOF(JSAMPARRAY));
- main->xbuffer[1] = main->xbuffer[0] + cinfo->num_components;
+ main_ptr->xbuffer[1] = main_ptr->xbuffer[0] + cinfo->num_components;
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
@@ -186,9 +186,9 @@
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
2 * (rgroup * (M + 4)) * SIZEOF(JSAMPROW));
xbuf += rgroup; /* want one row group at negative offsets */
- main->xbuffer[0][ci] = xbuf;
+ main_ptr->xbuffer[0][ci] = xbuf;
xbuf += rgroup * (M + 4);
- main->xbuffer[1][ci] = xbuf;
+ main_ptr->xbuffer[1][ci] = xbuf;
}
}
@@ -196,13 +196,13 @@
LOCAL(void)
make_funny_pointers (j_decompress_ptr cinfo)
/* Create the funny pointer lists discussed in the comments above.
- * The actual workspace is already allocated (in main->buffer),
+ * The actual workspace is already allocated (in main_ptr->buffer),
* and the space for the pointer lists is allocated too.
* This routine just fills in the curiously ordered lists.
* This will be repeated at the beginning of each pass.
*/
{
- my_main_ptr main = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
int ci, i, rgroup;
int M = cinfo->_min_DCT_scaled_size;
jpeg_component_info *compptr;
@@ -212,10 +212,10 @@
ci++, compptr++) {
rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
cinfo->_min_DCT_scaled_size; /* height of a row group of component */
- xbuf0 = main->xbuffer[0][ci];
- xbuf1 = main->xbuffer[1][ci];
+ xbuf0 = main_ptr->xbuffer[0][ci];
+ xbuf1 = main_ptr->xbuffer[1][ci];
/* First copy the workspace pointers as-is */
- buf = main->buffer[ci];
+ buf = main_ptr->buffer[ci];
for (i = 0; i < rgroup * (M + 2); i++) {
xbuf0[i] = xbuf1[i] = buf[i];
}
@@ -242,7 +242,7 @@
* This changes the pointer list state from top-of-image to the normal state.
*/
{
- my_main_ptr main = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
int ci, i, rgroup;
int M = cinfo->_min_DCT_scaled_size;
jpeg_component_info *compptr;
@@ -252,8 +252,8 @@
ci++, compptr++) {
rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
cinfo->_min_DCT_scaled_size; /* height of a row group of component */
- xbuf0 = main->xbuffer[0][ci];
- xbuf1 = main->xbuffer[1][ci];
+ xbuf0 = main_ptr->xbuffer[0][ci];
+ xbuf1 = main_ptr->xbuffer[1][ci];
for (i = 0; i < rgroup; i++) {
xbuf0[i - rgroup] = xbuf0[rgroup*(M+1) + i];
xbuf1[i - rgroup] = xbuf1[rgroup*(M+1) + i];
@@ -271,7 +271,7 @@
* Also sets rowgroups_avail to indicate number of nondummy row groups in row.
*/
{
- my_main_ptr main = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
int ci, i, rgroup, iMCUheight, rows_left;
jpeg_component_info *compptr;
JSAMPARRAY xbuf;
@@ -288,12 +288,12 @@
* so we need only do it once.
*/
if (ci == 0) {
- main->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
+ main_ptr->rowgroups_avail = (JDIMENSION) ((rows_left-1) / rgroup + 1);
}
/* Duplicate the last real sample row rgroup*2 times; this pads out the
* last partial rowgroup and ensures at least one full rowgroup of context.
*/
- xbuf = main->xbuffer[main->whichptr][ci];
+ xbuf = main_ptr->xbuffer[main_ptr->whichptr][ci];
for (i = 0; i < rgroup * 2; i++) {
xbuf[rows_left + i] = xbuf[rows_left-1];
}
@@ -308,27 +308,27 @@
METHODDEF(void)
start_pass_main (j_decompress_ptr cinfo, J_BUF_MODE pass_mode)
{
- my_main_ptr main = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
switch (pass_mode) {
case JBUF_PASS_THRU:
if (cinfo->upsample->need_context_rows) {
- main->pub.process_data = process_data_context_main;
+ main_ptr->pub.process_data = process_data_context_main;
make_funny_pointers(cinfo); /* Create the xbuffer[] lists */
- main->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
- main->context_state = CTX_PREPARE_FOR_IMCU;
- main->iMCU_row_ctr = 0;
+ main_ptr->whichptr = 0; /* Read first iMCU row into xbuffer[0] */
+ main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
+ main_ptr->iMCU_row_ctr = 0;
} else {
/* Simple case with no context needed */
- main->pub.process_data = process_data_simple_main;
+ main_ptr->pub.process_data = process_data_simple_main;
}
- main->buffer_full = FALSE; /* Mark buffer empty */
- main->rowgroup_ctr = 0;
+ main_ptr->buffer_full = FALSE; /* Mark buffer empty */
+ main_ptr->rowgroup_ctr = 0;
break;
#ifdef QUANT_2PASS_SUPPORTED
case JBUF_CRANK_DEST:
/* For last pass of 2-pass quantization, just crank the postprocessor */
- main->pub.process_data = process_data_crank_post;
+ main_ptr->pub.process_data = process_data_crank_post;
break;
#endif
default:
@@ -348,14 +348,14 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- my_main_ptr main = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
JDIMENSION rowgroups_avail;
/* Read input data if we haven't filled the main buffer yet */
- if (! main->buffer_full) {
- if (! (*cinfo->coef->decompress_data) (cinfo, main->buffer))
+ if (! main_ptr->buffer_full) {
+ if (! (*cinfo->coef->decompress_data) (cinfo, main_ptr->buffer))
return; /* suspension forced, can do nothing more */
- main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
+ main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
}
/* There are always min_DCT_scaled_size row groups in an iMCU row. */
@@ -366,14 +366,14 @@
*/
/* Feed the postprocessor */
- (*cinfo->post->post_process_data) (cinfo, main->buffer,
- &main->rowgroup_ctr, rowgroups_avail,
+ (*cinfo->post->post_process_data) (cinfo, main_ptr->buffer,
+ &main_ptr->rowgroup_ctr, rowgroups_avail,
output_buf, out_row_ctr, out_rows_avail);
/* Has postprocessor consumed all the data yet? If so, mark buffer empty */
- if (main->rowgroup_ctr >= rowgroups_avail) {
- main->buffer_full = FALSE;
- main->rowgroup_ctr = 0;
+ if (main_ptr->rowgroup_ctr >= rowgroups_avail) {
+ main_ptr->buffer_full = FALSE;
+ main_ptr->rowgroup_ctr = 0;
}
}
@@ -388,15 +388,15 @@
JSAMPARRAY output_buf, JDIMENSION *out_row_ctr,
JDIMENSION out_rows_avail)
{
- my_main_ptr main = (my_main_ptr) cinfo->main;
+ my_main_ptr main_ptr = (my_main_ptr) cinfo->main;
/* Read input data if we haven't filled the main buffer yet */
- if (! main->buffer_full) {
+ if (! main_ptr->buffer_full) {
if (! (*cinfo->coef->decompress_data) (cinfo,
- main->xbuffer[main->whichptr]))
+ main_ptr->xbuffer[main_ptr->whichptr]))
return; /* suspension forced, can do nothing more */
- main->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
- main->iMCU_row_ctr++; /* count rows received */
+ main_ptr->buffer_full = TRUE; /* OK, we have an iMCU row to work with */
+ main_ptr->iMCU_row_ctr++; /* count rows received */
}
/* Postprocessor typically will not swallow all the input data it is handed
@@ -404,47 +404,47 @@
* to exit and restart. This switch lets us keep track of how far we got.
* Note that each case falls through to the next on successful completion.
*/
- switch (main->context_state) {
+ switch (main_ptr->context_state) {
case CTX_POSTPONED_ROW:
/* Call postprocessor using previously set pointers for postponed row */
- (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
- &main->rowgroup_ctr, main->rowgroups_avail,
+ (*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr],
+ &main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail,
output_buf, out_row_ctr, out_rows_avail);
- if (main->rowgroup_ctr < main->rowgroups_avail)
+ if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
return; /* Need to suspend */
- main->context_state = CTX_PREPARE_FOR_IMCU;
+ main_ptr->context_state = CTX_PREPARE_FOR_IMCU;
if (*out_row_ctr >= out_rows_avail)
return; /* Postprocessor exactly filled output buf */
/*FALLTHROUGH*/
case CTX_PREPARE_FOR_IMCU:
/* Prepare to process first M-1 row groups of this iMCU row */
- main->rowgroup_ctr = 0;
- main->rowgroups_avail = (JDIMENSION) (cinfo->_min_DCT_scaled_size - 1);
+ main_ptr->rowgroup_ctr = 0;
+ main_ptr->rowgroups_avail = (JDIMENSION) (cinfo->_min_DCT_scaled_size - 1);
/* Check for bottom of image: if so, tweak pointers to "duplicate"
* the last sample row, and adjust rowgroups_avail to ignore padding rows.
*/
- if (main->iMCU_row_ctr == cinfo->total_iMCU_rows)
+ if (main_ptr->iMCU_row_ctr == cinfo->total_iMCU_rows)
set_bottom_pointers(cinfo);
- main->context_state = CTX_PROCESS_IMCU;
+ main_ptr->context_state = CTX_PROCESS_IMCU;
/*FALLTHROUGH*/
case CTX_PROCESS_IMCU:
/* Call postprocessor using previously set pointers */
- (*cinfo->post->post_process_data) (cinfo, main->xbuffer[main->whichptr],
- &main->rowgroup_ctr, main->rowgroups_avail,
+ (*cinfo->post->post_process_data) (cinfo, main_ptr->xbuffer[main_ptr->whichptr],
+ &main_ptr->rowgroup_ctr, main_ptr->rowgroups_avail,
output_buf, out_row_ctr, out_rows_avail);
- if (main->rowgroup_ctr < main->rowgroups_avail)
+ if (main_ptr->rowgroup_ctr < main_ptr->rowgroups_avail)
return; /* Need to suspend */
/* After the first iMCU, change wraparound pointers to normal state */
- if (main->iMCU_row_ctr == 1)
+ if (main_ptr->iMCU_row_ctr == 1)
set_wraparound_pointers(cinfo);
/* Prepare to load new iMCU row using other xbuffer list */
- main->whichptr ^= 1; /* 0=>1 or 1=>0 */
- main->buffer_full = FALSE;
+ main_ptr->whichptr ^= 1; /* 0=>1 or 1=>0 */
+ main_ptr->buffer_full = FALSE;
/* Still need to process last row group of this iMCU row, */
/* which is saved at index M+1 of the other xbuffer */
- main->rowgroup_ctr = (JDIMENSION) (cinfo->_min_DCT_scaled_size + 1);
- main->rowgroups_avail = (JDIMENSION) (cinfo->_min_DCT_scaled_size + 2);
- main->context_state = CTX_POSTPONED_ROW;
+ main_ptr->rowgroup_ctr = (JDIMENSION) (cinfo->_min_DCT_scaled_size + 1);
+ main_ptr->rowgroups_avail = (JDIMENSION) (cinfo->_min_DCT_scaled_size + 2);
+ main_ptr->context_state = CTX_POSTPONED_ROW;
}
}
@@ -477,15 +477,15 @@
GLOBAL(void)
jinit_d_main_controller (j_decompress_ptr cinfo, boolean need_full_buffer)
{
- my_main_ptr main;
+ my_main_ptr main_ptr;
int ci, rgroup, ngroups;
jpeg_component_info *compptr;
- main = (my_main_ptr)
+ main_ptr = (my_main_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(my_main_controller));
- cinfo->main = (struct jpeg_d_main_controller *) main;
- main->pub.start_pass = start_pass_main;
+ cinfo->main = (struct jpeg_d_main_controller *) main_ptr;
+ main_ptr->pub.start_pass = start_pass_main;
if (need_full_buffer) /* shouldn't happen */
ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
@@ -506,7 +506,7 @@
ci++, compptr++) {
rgroup = (compptr->v_samp_factor * compptr->_DCT_scaled_size) /
cinfo->_min_DCT_scaled_size; /* height of a row group of component */
- main->buffer[ci] = (*cinfo->mem->alloc_sarray)
+ main_ptr->buffer[ci] = (*cinfo->mem->alloc_sarray)
((j_common_ptr) cinfo, JPOOL_IMAGE,
compptr->width_in_blocks * compptr->_DCT_scaled_size,
(JDIMENSION) (rgroup * ngroups));
diff --git a/jdmerge.c b/jdmerge.c
index edf061a..c75497a 100644
--- a/jdmerge.c
+++ b/jdmerge.c
@@ -3,7 +3,7 @@
*
* Copyright (C) 1994-1996, Thomas G. Lane.
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
- * Copyright (C) 2009, D. R. Commander.
+ * Copyright (C) 2009, 2011, D. R. Commander.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
@@ -77,6 +77,99 @@
#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
+/* Include inline routines for colorspace extensions */
+
+#include "jdmrgext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+
+#define RGB_RED EXT_RGB_RED
+#define RGB_GREEN EXT_RGB_GREEN
+#define RGB_BLUE EXT_RGB_BLUE
+#define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
+#define h2v1_merged_upsample_internal extrgb_h2v1_merged_upsample_internal
+#define h2v2_merged_upsample_internal extrgb_h2v2_merged_upsample_internal
+#include "jdmrgext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef h2v1_merged_upsample_internal
+#undef h2v2_merged_upsample_internal
+
+#define RGB_RED EXT_RGBX_RED
+#define RGB_GREEN EXT_RGBX_GREEN
+#define RGB_BLUE EXT_RGBX_BLUE
+#define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
+#define h2v1_merged_upsample_internal extrgbx_h2v1_merged_upsample_internal
+#define h2v2_merged_upsample_internal extrgbx_h2v2_merged_upsample_internal
+#include "jdmrgext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef h2v1_merged_upsample_internal
+#undef h2v2_merged_upsample_internal
+
+#define RGB_RED EXT_BGR_RED
+#define RGB_GREEN EXT_BGR_GREEN
+#define RGB_BLUE EXT_BGR_BLUE
+#define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
+#define h2v1_merged_upsample_internal extbgr_h2v1_merged_upsample_internal
+#define h2v2_merged_upsample_internal extbgr_h2v2_merged_upsample_internal
+#include "jdmrgext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef h2v1_merged_upsample_internal
+#undef h2v2_merged_upsample_internal
+
+#define RGB_RED EXT_BGRX_RED
+#define RGB_GREEN EXT_BGRX_GREEN
+#define RGB_BLUE EXT_BGRX_BLUE
+#define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
+#define h2v1_merged_upsample_internal extbgrx_h2v1_merged_upsample_internal
+#define h2v2_merged_upsample_internal extbgrx_h2v2_merged_upsample_internal
+#include "jdmrgext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef h2v1_merged_upsample_internal
+#undef h2v2_merged_upsample_internal
+
+#define RGB_RED EXT_XBGR_RED
+#define RGB_GREEN EXT_XBGR_GREEN
+#define RGB_BLUE EXT_XBGR_BLUE
+#define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
+#define h2v1_merged_upsample_internal extxbgr_h2v1_merged_upsample_internal
+#define h2v2_merged_upsample_internal extxbgr_h2v2_merged_upsample_internal
+#include "jdmrgext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef h2v1_merged_upsample_internal
+#undef h2v2_merged_upsample_internal
+
+#define RGB_RED EXT_XRGB_RED
+#define RGB_GREEN EXT_XRGB_GREEN
+#define RGB_BLUE EXT_XRGB_BLUE
+#define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
+#define h2v1_merged_upsample_internal extxrgb_h2v1_merged_upsample_internal
+#define h2v2_merged_upsample_internal extxrgb_h2v2_merged_upsample_internal
+#include "jdmrgext.c"
+#undef RGB_RED
+#undef RGB_GREEN
+#undef RGB_BLUE
+#undef RGB_PIXELSIZE
+#undef h2v1_merged_upsample_internal
+#undef h2v2_merged_upsample_internal
+
+
/*
* Initialize tables for YCC->RGB colorspace conversion.
* This is taken directly from jdcolor.c; see that file for more info.
@@ -230,55 +323,35 @@
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
- register int y, cred, cgreen, cblue;
- int cb, cr;
- register JSAMPROW outptr;
- JSAMPROW inptr0, inptr1, inptr2;
- JDIMENSION col;
- /* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- int * Crrtab = upsample->Cr_r_tab;
- int * Cbbtab = upsample->Cb_b_tab;
- INT32 * Crgtab = upsample->Cr_g_tab;
- INT32 * Cbgtab = upsample->Cb_g_tab;
- SHIFT_TEMPS
-
- inptr0 = input_buf[0][in_row_group_ctr];
- inptr1 = input_buf[1][in_row_group_ctr];
- inptr2 = input_buf[2][in_row_group_ctr];
- outptr = output_buf[0];
- /* Loop for each pair of output pixels */
- for (col = cinfo->output_width >> 1; col > 0; col--) {
- /* Do the chroma part of the calculation */
- cb = GETJSAMPLE(*inptr1++);
- cr = GETJSAMPLE(*inptr2++);
- cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
- cblue = Cbbtab[cb];
- /* Fetch 2 Y values and emit 2 pixels */
- y = GETJSAMPLE(*inptr0++);
- outptr[rgb_red[cinfo->out_color_space]] = range_limit[y + cred];
- outptr[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen];
- outptr[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue];
- outptr += rgb_pixelsize[cinfo->out_color_space];
- y = GETJSAMPLE(*inptr0++);
- outptr[rgb_red[cinfo->out_color_space]] = range_limit[y + cred];
- outptr[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen];
- outptr[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue];
- outptr += rgb_pixelsize[cinfo->out_color_space];
- }
- /* If image width is odd, do the last output column separately */
- if (cinfo->output_width & 1) {
- cb = GETJSAMPLE(*inptr1);
- cr = GETJSAMPLE(*inptr2);
- cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
- cblue = Cbbtab[cb];
- y = GETJSAMPLE(*inptr0);
- outptr[rgb_red[cinfo->out_color_space]] = range_limit[y + cred];
- outptr[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen];
- outptr[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue];
+ switch (cinfo->out_color_space) {
+ case JCS_EXT_RGB:
+ extrgb_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_RGBX:
+ extrgbx_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_BGR:
+ extbgr_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_BGRX:
+ extbgrx_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_XBGR:
+ extxbgr_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_XRGB:
+ extxrgb_h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ default:
+ h2v1_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
}
}
@@ -292,71 +365,35 @@
JSAMPIMAGE input_buf, JDIMENSION in_row_group_ctr,
JSAMPARRAY output_buf)
{
- my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
- register int y, cred, cgreen, cblue;
- int cb, cr;
- register JSAMPROW outptr0, outptr1;
- JSAMPROW inptr00, inptr01, inptr1, inptr2;
- JDIMENSION col;
- /* copy these pointers into registers if possible */
- register JSAMPLE * range_limit = cinfo->sample_range_limit;
- int * Crrtab = upsample->Cr_r_tab;
- int * Cbbtab = upsample->Cb_b_tab;
- INT32 * Crgtab = upsample->Cr_g_tab;
- INT32 * Cbgtab = upsample->Cb_g_tab;
- SHIFT_TEMPS
-
- inptr00 = input_buf[0][in_row_group_ctr*2];
- inptr01 = input_buf[0][in_row_group_ctr*2 + 1];
- inptr1 = input_buf[1][in_row_group_ctr];
- inptr2 = input_buf[2][in_row_group_ctr];
- outptr0 = output_buf[0];
- outptr1 = output_buf[1];
- /* Loop for each group of output pixels */
- for (col = cinfo->output_width >> 1; col > 0; col--) {
- /* Do the chroma part of the calculation */
- cb = GETJSAMPLE(*inptr1++);
- cr = GETJSAMPLE(*inptr2++);
- cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
- cblue = Cbbtab[cb];
- /* Fetch 4 Y values and emit 4 pixels */
- y = GETJSAMPLE(*inptr00++);
- outptr0[rgb_red[cinfo->out_color_space]] = range_limit[y + cred];
- outptr0[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen];
- outptr0[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue];
- outptr0 += RGB_PIXELSIZE;
- y = GETJSAMPLE(*inptr00++);
- outptr0[rgb_red[cinfo->out_color_space]] = range_limit[y + cred];
- outptr0[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen];
- outptr0[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue];
- outptr0 += RGB_PIXELSIZE;
- y = GETJSAMPLE(*inptr01++);
- outptr1[rgb_red[cinfo->out_color_space]] = range_limit[y + cred];
- outptr1[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen];
- outptr1[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue];
- outptr1 += RGB_PIXELSIZE;
- y = GETJSAMPLE(*inptr01++);
- outptr1[rgb_red[cinfo->out_color_space]] = range_limit[y + cred];
- outptr1[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen];
- outptr1[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue];
- outptr1 += RGB_PIXELSIZE;
- }
- /* If image width is odd, do the last output column separately */
- if (cinfo->output_width & 1) {
- cb = GETJSAMPLE(*inptr1);
- cr = GETJSAMPLE(*inptr2);
- cred = Crrtab[cr];
- cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
- cblue = Cbbtab[cb];
- y = GETJSAMPLE(*inptr00);
- outptr0[rgb_red[cinfo->out_color_space]] = range_limit[y + cred];
- outptr0[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen];
- outptr0[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue];
- y = GETJSAMPLE(*inptr01);
- outptr1[rgb_red[cinfo->out_color_space]] = range_limit[y + cred];
- outptr1[rgb_green[cinfo->out_color_space]] = range_limit[y + cgreen];
- outptr1[rgb_blue[cinfo->out_color_space]] = range_limit[y + cblue];
+ switch (cinfo->out_color_space) {
+ case JCS_EXT_RGB:
+ extrgb_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_RGBX:
+ extrgbx_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_BGR:
+ extbgr_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_BGRX:
+ extbgrx_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_XBGR:
+ extxbgr_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ case JCS_EXT_XRGB:
+ extxrgb_h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
+ default:
+ h2v2_merged_upsample_internal(cinfo, input_buf, in_row_group_ctr,
+ output_buf);
+ break;
}
}
diff --git a/jdmrgext.c b/jdmrgext.c
new file mode 100644
index 0000000..95ddd55
--- /dev/null
+++ b/jdmrgext.c
@@ -0,0 +1,156 @@
+/*
+ * jdmrgext.c
+ *
+ * Copyright (C) 1994-1996, Thomas G. Lane.
+ * This file is part of the Independent JPEG Group's software.
+ * For conditions of distribution and use, see the accompanying README file.
+ *
+ * This file contains code for merged upsampling/color conversion.
+ */
+
+
+/* This file is included by jdmerge.c */
+
+
+/*
+ * Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical.
+ */
+
+INLINE
+LOCAL(void)
+h2v1_merged_upsample_internal (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr,
+ JSAMPARRAY output_buf)
+{
+ my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ register int y, cred, cgreen, cblue;
+ int cb, cr;
+ register JSAMPROW outptr;
+ JSAMPROW inptr0, inptr1, inptr2;
+ JDIMENSION col;
+ /* copy these pointers into registers if possible */
+ register JSAMPLE * range_limit = cinfo->sample_range_limit;
+ int * Crrtab = upsample->Cr_r_tab;
+ int * Cbbtab = upsample->Cb_b_tab;
+ INT32 * Crgtab = upsample->Cr_g_tab;
+ INT32 * Cbgtab = upsample->Cb_g_tab;
+ SHIFT_TEMPS
+
+ inptr0 = input_buf[0][in_row_group_ctr];
+ inptr1 = input_buf[1][in_row_group_ctr];
+ inptr2 = input_buf[2][in_row_group_ctr];
+ outptr = output_buf[0];
+ /* Loop for each pair of output pixels */
+ for (col = cinfo->output_width >> 1; col > 0; col--) {
+ /* Do the chroma part of the calculation */
+ cb = GETJSAMPLE(*inptr1++);
+ cr = GETJSAMPLE(*inptr2++);
+ cred = Crrtab[cr];
+ cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cblue = Cbbtab[cb];
+ /* Fetch 2 Y values and emit 2 pixels */
+ y = GETJSAMPLE(*inptr0++);
+ outptr[RGB_RED] = range_limit[y + cred];
+ outptr[RGB_GREEN] = range_limit[y + cgreen];
+ outptr[RGB_BLUE] = range_limit[y + cblue];
+ outptr += RGB_PIXELSIZE;
+ y = GETJSAMPLE(*inptr0++);
+ outptr[RGB_RED] = range_limit[y + cred];
+ outptr[RGB_GREEN] = range_limit[y + cgreen];
+ outptr[RGB_BLUE] = range_limit[y + cblue];
+ outptr += RGB_PIXELSIZE;
+ }
+ /* If image width is odd, do the last output column separately */
+ if (cinfo->output_width & 1) {
+ cb = GETJSAMPLE(*inptr1);
+ cr = GETJSAMPLE(*inptr2);
+ cred = Crrtab[cr];
+ cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cblue = Cbbtab[cb];
+ y = GETJSAMPLE(*inptr0);
+ outptr[RGB_RED] = range_limit[y + cred];
+ outptr[RGB_GREEN] = range_limit[y + cgreen];
+ outptr[RGB_BLUE] = range_limit[y + cblue];
+ }
+}
+
+
+/*
+ * Upsample and color convert for the case of 2:1 horizontal and 2:1 vertical.
+ */
+
+INLINE
+LOCAL(void)
+h2v2_merged_upsample_internal (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr,
+ JSAMPARRAY output_buf)
+{
+ my_upsample_ptr upsample = (my_upsample_ptr) cinfo->upsample;
+ register int y, cred, cgreen, cblue;
+ int cb, cr;
+ register JSAMPROW outptr0, outptr1;
+ JSAMPROW inptr00, inptr01, inptr1, inptr2;
+ JDIMENSION col;
+ /* copy these pointers into registers if possible */
+ register JSAMPLE * range_limit = cinfo->sample_range_limit;
+ int * Crrtab = upsample->Cr_r_tab;
+ int * Cbbtab = upsample->Cb_b_tab;
+ INT32 * Crgtab = upsample->Cr_g_tab;
+ INT32 * Cbgtab = upsample->Cb_g_tab;
+ SHIFT_TEMPS
+
+ inptr00 = input_buf[0][in_row_group_ctr*2];
+ inptr01 = input_buf[0][in_row_group_ctr*2 + 1];
+ inptr1 = input_buf[1][in_row_group_ctr];
+ inptr2 = input_buf[2][in_row_group_ctr];
+ outptr0 = output_buf[0];
+ outptr1 = output_buf[1];
+ /* Loop for each group of output pixels */
+ for (col = cinfo->output_width >> 1; col > 0; col--) {
+ /* Do the chroma part of the calculation */
+ cb = GETJSAMPLE(*inptr1++);
+ cr = GETJSAMPLE(*inptr2++);
+ cred = Crrtab[cr];
+ cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cblue = Cbbtab[cb];
+ /* Fetch 4 Y values and emit 4 pixels */
+ y = GETJSAMPLE(*inptr00++);
+ outptr0[RGB_RED] = range_limit[y + cred];
+ outptr0[RGB_GREEN] = range_limit[y + cgreen];
+ outptr0[RGB_BLUE] = range_limit[y + cblue];
+ outptr0 += RGB_PIXELSIZE;
+ y = GETJSAMPLE(*inptr00++);
+ outptr0[RGB_RED] = range_limit[y + cred];
+ outptr0[RGB_GREEN] = range_limit[y + cgreen];
+ outptr0[RGB_BLUE] = range_limit[y + cblue];
+ outptr0 += RGB_PIXELSIZE;
+ y = GETJSAMPLE(*inptr01++);
+ outptr1[RGB_RED] = range_limit[y + cred];
+ outptr1[RGB_GREEN] = range_limit[y + cgreen];
+ outptr1[RGB_BLUE] = range_limit[y + cblue];
+ outptr1 += RGB_PIXELSIZE;
+ y = GETJSAMPLE(*inptr01++);
+ outptr1[RGB_RED] = range_limit[y + cred];
+ outptr1[RGB_GREEN] = range_limit[y + cgreen];
+ outptr1[RGB_BLUE] = range_limit[y + cblue];
+ outptr1 += RGB_PIXELSIZE;
+ }
+ /* If image width is odd, do the last output column separately */
+ if (cinfo->output_width & 1) {
+ cb = GETJSAMPLE(*inptr1);
+ cr = GETJSAMPLE(*inptr2);
+ cred = Crrtab[cr];
+ cgreen = (int) RIGHT_SHIFT(Cbgtab[cb] + Crgtab[cr], SCALEBITS);
+ cblue = Cbbtab[cb];
+ y = GETJSAMPLE(*inptr00);
+ outptr0[RGB_RED] = range_limit[y + cred];
+ outptr0[RGB_GREEN] = range_limit[y + cgreen];
+ outptr0[RGB_BLUE] = range_limit[y + cblue];
+ y = GETJSAMPLE(*inptr01);
+ outptr1[RGB_RED] = range_limit[y + cred];
+ outptr1[RGB_GREEN] = range_limit[y + cgreen];
+ outptr1[RGB_BLUE] = range_limit[y + cblue];
+ }
+}
diff --git a/jmorecfg.h b/jmorecfg.h
index c14a5f3..1448779 100644
--- a/jmorecfg.h
+++ b/jmorecfg.h
@@ -315,20 +315,54 @@
#define JPEG_NUMCS 12
+#define EXT_RGB_RED 0
+#define EXT_RGB_GREEN 1
+#define EXT_RGB_BLUE 2
+#define EXT_RGB_PIXELSIZE 3
+
+#define EXT_RGBX_RED 0
+#define EXT_RGBX_GREEN 1
+#define EXT_RGBX_BLUE 2
+#define EXT_RGBX_PIXELSIZE 4
+
+#define EXT_BGR_RED 2
+#define EXT_BGR_GREEN 1
+#define EXT_BGR_BLUE 0
+#define EXT_BGR_PIXELSIZE 3
+
+#define EXT_BGRX_RED 2
+#define EXT_BGRX_GREEN 1
+#define EXT_BGRX_BLUE 0
+#define EXT_BGRX_PIXELSIZE 4
+
+#define EXT_XBGR_RED 3
+#define EXT_XBGR_GREEN 2
+#define EXT_XBGR_BLUE 1
+#define EXT_XBGR_PIXELSIZE 4
+
+#define EXT_XRGB_RED 1
+#define EXT_XRGB_GREEN 2
+#define EXT_XRGB_BLUE 3
+#define EXT_XRGB_PIXELSIZE 4
+
static const int rgb_red[JPEG_NUMCS] = {
- -1, -1, RGB_RED, -1, -1, -1, 0, 0, 2, 2, 3, 1
+ -1, -1, RGB_RED, -1, -1, -1, EXT_RGB_RED, EXT_RGBX_RED,
+ EXT_BGR_RED, EXT_BGRX_RED, EXT_XBGR_RED, EXT_XRGB_RED
};
static const int rgb_green[JPEG_NUMCS] = {
- -1, -1, RGB_GREEN, -1, -1, -1, 1, 1, 1, 1, 2, 2
+ -1, -1, RGB_GREEN, -1, -1, -1, EXT_RGB_GREEN, EXT_RGBX_GREEN,
+ EXT_BGR_GREEN, EXT_BGRX_GREEN, EXT_XBGR_GREEN, EXT_XRGB_GREEN
};
static const int rgb_blue[JPEG_NUMCS] = {
- -1, -1, RGB_BLUE, -1, -1, -1, 2, 2, 0, 0, 1, 3
+ -1, -1, RGB_BLUE, -1, -1, -1, EXT_RGB_BLUE, EXT_RGBX_BLUE,
+ EXT_BGR_BLUE, EXT_BGRX_BLUE, EXT_XBGR_BLUE, EXT_XRGB_BLUE
};
static const int rgb_pixelsize[JPEG_NUMCS] = {
- -1, -1, RGB_PIXELSIZE, -1, -1, -1, 3, 4, 3, 4, 4, 4
+ -1, -1, RGB_PIXELSIZE, -1, -1, -1, EXT_RGB_PIXELSIZE, EXT_RGBX_PIXELSIZE,
+ EXT_BGR_PIXELSIZE, EXT_BGRX_PIXELSIZE, EXT_XBGR_PIXELSIZE, EXT_XRGB_PIXELSIZE
};
/* Definitions for speed-related optimizations. */
diff --git a/jpegtran.c b/jpegtran.c
index 73dbe53..f861464 100644
--- a/jpegtran.c
+++ b/jpegtran.c
@@ -142,6 +142,7 @@
transformoption.trim = FALSE;
transformoption.force_grayscale = FALSE;
transformoption.crop = FALSE;
+ transformoption.slow_hflip = FALSE;
cinfo->err->trace_level = 0;
/* Scan command line options, adjust parameters */
diff --git a/jpegut.c b/jpegut.c
deleted file mode 100644
index e46e97a..0000000
--- a/jpegut.c
+++ /dev/null
@@ -1,605 +0,0 @@
-/* Copyright (C)2004 Landmark Graphics Corporation
- * Copyright (C)2005 Sun Microsystems, Inc.
- * Copyright (C)2009-2011 D. R. Commander
- *
- * This library is free software and may be redistributed and/or modified under
- * the terms of the wxWindows Library License, Version 3.1 or (at your option)
- * any later version. The full license is in the LICENSE.txt file included
- * with this distribution.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * wxWindows Library License for more details.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "./rrtimer.h"
-#include "./turbojpeg.h"
-#ifndef _WIN32
- #define stricmp strcasecmp
-#else
- #include <time.h>
- #define random() rand()
-#endif
-
-#define _catch(f) {if((f)==-1) {printf("TJPEG: %s\n", tjGetErrorStr()); bailout();}}
-
-const char *_subnamel[NUMSUBOPT]={"4:4:4", "4:2:2", "4:2:0", "GRAY"};
-const char *_subnames[NUMSUBOPT]={"444", "422", "420", "GRAY"};
-const int _hsf[NUMSUBOPT]={1, 2, 2, 1};
-const int _vsf[NUMSUBOPT]={1, 1, 2, 1};
-
-enum {YUVENCODE=1, YUVDECODE};
-int yuv=0;
-
-int exitstatus=0;
-#define bailout() {exitstatus=-1; goto finally;}
-
-void initbuf(unsigned char *buf, int w, int h, int ps, int flags)
-{
- int roffset=(flags&TJ_BGR)?2:0, goffset=1, boffset=(flags&TJ_BGR)?0:2, i,
- _i, j;
- if(flags&TJ_ALPHAFIRST) {roffset++; goffset++; boffset++;}
- memset(buf, 0, w*h*ps);
- if(ps==1)
- {
- for(_i=0; _i<16; _i++)
- {
- if(flags&TJ_BOTTOMUP) i=h-_i-1; else i=_i;
- for(j=0; j<w; j++)
- {
- if(((_i/8)+(j/8))%2==0) buf[w*i+j]=255;
- else buf[w*i+j]=76;
- }
- }
- for(_i=16; _i<h; _i++)
- {
- if(flags&TJ_BOTTOMUP) i=h-_i-1; else i=_i;
- for(j=0; j<w; j++)
- {
- if(((_i/8)+(j/8))%2==0) buf[w*i+j]=0;
- else buf[w*i+j]=226;
- }
- }
- return;
- }
- for(_i=0; _i<16; _i++)
- {
- if(flags&TJ_BOTTOMUP) i=h-_i-1; else i=_i;
- for(j=0; j<w; j++)
- {
- buf[(w*i+j)*ps+roffset]=255;
- if(((_i/8)+(j/8))%2==0)
- {
- buf[(w*i+j)*ps+goffset]=255;
- buf[(w*i+j)*ps+boffset]=255;
- }
- }
- }
- for(_i=16; _i<h; _i++)
- {
- if(flags&TJ_BOTTOMUP) i=h-_i-1; else i=_i;
- for(j=0; j<w; j++)
- {
- if(((_i/8)+(j/8))%2!=0)
- {
- buf[(w*i+j)*ps+roffset]=255;
- buf[(w*i+j)*ps+goffset]=255;
- }
- }
- }
-}
-
-void dumpbuf(unsigned char *buf, int w, int h, int ps, int flags)
-{
- int roffset=(flags&TJ_BGR)?2:0, goffset=1, boffset=(flags&TJ_BGR)?0:2, i,
- j;
- printf("\n");
- for(i=0; i<h; i++)
- {
- for(j=0; j<w; j++)
- {
- printf("%.3d/%.3d/%.3d ", buf[(w*i+j)*ps+roffset],
- buf[(w*i+j)*ps+goffset], buf[(w*i+j)*ps+boffset]);
- }
- printf("\n");
- }
-}
-
-int checkbuf(unsigned char *buf, int w, int h, int ps, int subsamp, int flags)
-{
- int roffset=(flags&TJ_BGR)?2:0, goffset=1, boffset=(flags&TJ_BGR)?0:2, i,
- _i, j;
- if(flags&TJ_ALPHAFIRST) {roffset++; goffset++; boffset++;}
- if(ps==1) roffset=goffset=boffset=0;
- if(subsamp==TJ_GRAYSCALE)
- {
- for(_i=0; _i<16; _i++)
- {
- if(flags&TJ_BOTTOMUP) i=h-_i-1; else i=_i;
- for(j=0; j<w; j++)
- {
- unsigned char r=buf[(w*i+j)*ps+roffset],
- g=buf[(w*i+j)*ps+goffset],
- b=buf[(w*i+j)*ps+boffset];
- if(((_i/8)+(j/8))%2==0)
- {
- if(r<253 || g<253 || b<253) return 0;
- }
- else
- {
- if(r<74 || r>78 || g<74 || g>78 || b<74 || b>78) return 0;
- }
- }
- }
- for(_i=16; _i<h; _i++)
- {
- if(flags&TJ_BOTTOMUP) i=h-_i-1; else i=_i;
- for(j=0; j<w; j++)
- {
- unsigned char r=buf[(w*i+j)*ps+roffset],
- g=buf[(w*i+j)*ps+goffset],
- b=buf[(w*i+j)*ps+boffset];
- if(((_i/8)+(j/8))%2==0)
- {
- if(r>2 || g>2 || b>2) return 0;
- }
- else
- {
- if(r<224 || r>228 || g<224 || g>228 || b<224 || b>228) return 0;
- }
- }
- }
- }
- else
- {
- for(_i=0; _i<16; _i++)
- {
- if(flags&TJ_BOTTOMUP) i=h-_i-1; else i=_i;
- for(j=0; j<w; j++)
- {
- if(buf[(w*i+j)*ps+roffset]<253) return 0;
- if(((_i/8)+(j/8))%2==0)
- {
- if(buf[(w*i+j)*ps+goffset]<253) return 0;
- if(buf[(w*i+j)*ps+boffset]<253) return 0;
- }
- else
- {
- if(buf[(w*i+j)*ps+goffset]>2) return 0;
- if(buf[(w*i+j)*ps+boffset]>2) return 0;
- }
- }
- }
- for(_i=16; _i<h; _i++)
- {
- if(flags&TJ_BOTTOMUP) i=h-_i-1; else i=_i;
- for(j=0; j<w; j++)
- {
- if(buf[(w*i+j)*ps+boffset]>2) return 0;
- if(((_i/8)+(j/8))%2==0)
- {
- if(buf[(w*i+j)*ps+roffset]>2) return 0;
- if(buf[(w*i+j)*ps+goffset]>2) return 0;
- }
- else
- {
- if(buf[(w*i+j)*ps+roffset]<253) return 0;
- if(buf[(w*i+j)*ps+goffset]<253) return 0;
- }
- }
- }
- }
- return 1;
-}
-
-#define checkval(v, cv) { \
- if(v<cv-1 || v>cv+1) { \
- printf("\nComp. %s at %d,%d should be %d, not %d\n", #v, i, j, cv, v); \
- retval=0; goto bailout; \
- }}
-
-#define checkval0(v) { \
- if(v>1) { \
- printf("\nComp. %s at %d,%d should be 0, not %d\n", #v, i, j, v); \
- retval=0; goto bailout; \
- }}
-
-#define checkval255(v) { \
- if(v<254) { \
- printf("\nComp. %s at %d,%d should be 255, not %d\n", #v, i, j, v); \
- retval=0; goto bailout; \
- }}
-
-#define PAD(v, p) ((v+(p)-1)&(~((p)-1)))
-
-int checkbufyuv(unsigned char *buf, int w, int h, int subsamp)
-{
- int i, j;
- int hsf=_hsf[subsamp], vsf=_vsf[subsamp];
- int pw=PAD(w, hsf), ph=PAD(h, vsf);
- int cw=pw/hsf, ch=ph/vsf;
- int ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4);
- int retval=1;
-
- for(i=0; i<16; i++)
- {
- for(j=0; j<pw; j++)
- {
- unsigned char y=buf[ypitch*i+j];
- if(((i/8)+(j/8))%2==0) checkval255(y)
- else checkval(y, 76)
- }
- }
- for(i=16; i<ph; i++)
- {
- for(j=0; j<pw; j++)
- {
- unsigned char y=buf[ypitch*i+j];
- if(((i/8)+(j/8))%2==0) checkval0(y)
- else checkval(y, 226)
- }
- }
- if(subsamp!=TJ_GRAYSCALE)
- {
- for(i=0; i<16/vsf; i++)
- {
- for(j=0; j<cw; j++)
- {
- unsigned char u=buf[ypitch*ph + (uvpitch*i+j)],
- v=buf[ypitch*ph + uvpitch*ch + (uvpitch*i+j)];
- if(((i*vsf/8)+(j*hsf/8))%2==0)
- {
- checkval(u, 128); checkval(v, 128);
- }
- else
- {
- checkval(u, 85); checkval255(v);
- }
- }
- }
- for(i=16/vsf; i<ch; i++)
- {
- for(j=0; j<cw; j++)
- {
- unsigned char u=buf[ypitch*ph + (uvpitch*i+j)],
- v=buf[ypitch*ph + uvpitch*ch + (uvpitch*i+j)];
- if(((i*vsf/8)+(j*hsf/8))%2==0)
- {
- checkval(u, 128); checkval(v, 128);
- }
- else
- {
- checkval0(u); checkval(v, 149);
- }
- }
- }
- }
-
- bailout:
- if(retval==0)
- {
- for(i=0; i<ph; i++)
- {
- for(j=0; j<pw; j++)
- printf("%.3d ", buf[ypitch*i+j]);
- printf("\n");
- }
- printf("\n");
- for(i=0; i<ch; i++)
- {
- for(j=0; j<cw; j++)
- printf("%.3d ", buf[ypitch*ph + (uvpitch*i+j)]);
- printf("\n");
- }
- printf("\n");
- for(i=0; i<ch; i++)
- {
- for(j=0; j<cw; j++)
- printf("%.3d ", buf[ypitch*ph + uvpitch*ch + (uvpitch*i+j)]);
- printf("\n");
- }
- printf("\n");
- }
-
- return retval;
-}
-
-void writejpeg(unsigned char *jpegbuf, unsigned long jpgbufsize, char *filename)
-{
- FILE *outfile=NULL;
- if((outfile=fopen(filename, "wb"))==NULL)
- {
- printf("ERROR: Could not open %s for writing.\n", filename);
- bailout();
- }
- if(fwrite(jpegbuf, jpgbufsize, 1, outfile)!=1)
- {
- printf("ERROR: Could not write to %s.\n", filename);
- bailout();
- }
-
- finally:
- if(outfile) fclose(outfile);
-}
-
-void gentestjpeg(tjhandle hnd, unsigned char *jpegbuf, unsigned long *size,
- int w, int h, int ps, char *basefilename, int subsamp, int qual, int flags)
-{
- char tempstr[1024]; unsigned char *bmpbuf=NULL;
- const char *pixformat; double t;
-
- if(flags&TJ_BGR)
- {
- if(ps==3) pixformat="BGR";
- else {if(flags&TJ_ALPHAFIRST) pixformat="XBGR"; else pixformat="BGRX";}
- }
- else
- {
- if(ps==3) pixformat="RGB";
- else {if(flags&TJ_ALPHAFIRST) pixformat="XRGB"; else pixformat="RGBX";}
- }
- if(ps==1) pixformat="Grayscale";
- if(yuv==YUVENCODE)
- printf("%s %s -> %s YUV ... ", pixformat,
- (flags&TJ_BOTTOMUP)?"Bottom-Up":"Top-Down ", _subnamel[subsamp]);
- else
- printf("%s %s -> %s Q%d ... ", pixformat,
- (flags&TJ_BOTTOMUP)?"Bottom-Up":"Top-Down ", _subnamel[subsamp], qual);
-
- if((bmpbuf=(unsigned char *)malloc(w*h*ps+1))==NULL)
- {
- printf("ERROR: Could not allocate buffer\n"); bailout();
- }
- initbuf(bmpbuf, w, h, ps, flags);
- memset(jpegbuf, 0,
- yuv==YUVENCODE? TJBUFSIZEYUV(w, h, subsamp):TJBUFSIZE(w, h));
-
- t=rrtime();
- if(yuv==YUVENCODE)
- {
- _catch(tjEncodeYUV(hnd, bmpbuf, w, 0, h, ps, jpegbuf, subsamp, flags));
- *size=TJBUFSIZEYUV(w, h, subsamp);
- }
- else
- {
- _catch(tjCompress(hnd, bmpbuf, w, 0, h, ps, jpegbuf, size, subsamp, qual,
- flags));
- }
- t=rrtime()-t;
-
- if(yuv==YUVENCODE)
- sprintf(tempstr, "%s_enc_%s_%s_%s.yuv", basefilename, pixformat,
- (flags&TJ_BOTTOMUP)? "BU":"TD", _subnames[subsamp]);
- else
- sprintf(tempstr, "%s_enc_%s_%s_%sQ%d.jpg", basefilename, pixformat,
- (flags&TJ_BOTTOMUP)? "BU":"TD", _subnames[subsamp], qual);
- writejpeg(jpegbuf, *size, tempstr);
- if(yuv==YUVENCODE)
- {
- if(checkbufyuv(jpegbuf, w, h, subsamp)) printf("Passed.");
- else {printf("FAILED!"); exitstatus=-1;}
- }
- else printf("Done.");
- printf(" %f ms\n Result in %s\n", t*1000., tempstr);
-
- finally:
- if(bmpbuf) free(bmpbuf);
-}
-
-void gentestbmp(tjhandle hnd, unsigned char *jpegbuf, unsigned long jpegsize,
- int w, int h, int ps, char *basefilename, int subsamp, int flags)
-{
- unsigned char *bmpbuf=NULL;
- const char *pixformat; int _w=0, _h=0; double t;
- unsigned long size=0;
-
- if(yuv==YUVENCODE) return;
-
- if(flags&TJ_BGR)
- {
- if(ps==3) pixformat="BGR";
- else {if(flags&TJ_ALPHAFIRST) pixformat="XBGR"; else pixformat="BGRX";}
- }
- else
- {
- if(ps==3) pixformat="RGB";
- else {if(flags&TJ_ALPHAFIRST) pixformat="XRGB"; else pixformat="RGBX";}
- }
- if(ps==1) pixformat="Grayscale";
- if(yuv==YUVDECODE)
- printf("JPEG -> YUV %s ... ", _subnames[subsamp]);
- else
- printf("JPEG -> %s %s ... ", pixformat,
- (flags&TJ_BOTTOMUP)?"Bottom-Up":"Top-Down ");
-
- _catch(tjDecompressHeader(hnd, jpegbuf, jpegsize, &_w, &_h));
- if(_w!=w || _h!=h)
- {
- printf("Incorrect JPEG header\n"); bailout();
- }
-
- if(yuv==YUVDECODE) size=TJBUFSIZEYUV(w, h, subsamp);
- else size=w*h*ps+1;
- if((bmpbuf=(unsigned char *)malloc(size))==NULL)
- {
- printf("ERROR: Could not allocate buffer\n"); bailout();
- }
- memset(bmpbuf, 0, size);
-
- t=rrtime();
- if(yuv==YUVDECODE)
- {
- _catch(tjDecompressToYUV(hnd, jpegbuf, jpegsize, bmpbuf, flags));
- }
- else
- {
- _catch(tjDecompress(hnd, jpegbuf, jpegsize, bmpbuf, w, w*ps, h, ps,
- flags));
- }
- t=rrtime()-t;
-
- if(yuv==YUVDECODE)
- {
- if(checkbufyuv(bmpbuf, w, h, subsamp)) printf("Passed.");
- else {printf("FAILED!"); exitstatus=-1;}
- }
- else
- {
- if(checkbuf(bmpbuf, w, h, ps, subsamp, flags)) printf("Passed.");
- else
- {
- printf("FAILED!"); exitstatus=-1;
- dumpbuf(bmpbuf, w, h, ps, flags);
- }
- }
- printf(" %f ms\n\n", t*1000.);
-
- finally:
- if(bmpbuf) free(bmpbuf);
-}
-
-void dotest(int w, int h, int ps, int subsamp, char *basefilename)
-{
- tjhandle hnd=NULL, dhnd=NULL; unsigned char *jpegbuf=NULL;
- unsigned long size;
-
- size=(yuv==YUVENCODE? TJBUFSIZEYUV(w, h, subsamp):TJBUFSIZE(w, h));
- if((jpegbuf=(unsigned char *)malloc(size)) == NULL)
- {
- puts("ERROR: Could not allocate buffer."); bailout();
- }
-
- if((hnd=tjInitCompress())==NULL)
- {printf("Error in tjInitCompress():\n%s\n", tjGetErrorStr()); bailout();}
- if((dhnd=tjInitDecompress())==NULL)
- {printf("Error in tjInitDecompress():\n%s\n", tjGetErrorStr()); bailout();}
-
- gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, 0);
- gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, 0);
-
- if(ps==1 || yuv==YUVDECODE) goto finally;
-
- gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_BGR);
- gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, TJ_BGR);
-
- gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_BOTTOMUP);
- gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, TJ_BOTTOMUP);
-
- gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_BGR|TJ_BOTTOMUP);
- gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, TJ_BGR|TJ_BOTTOMUP);
-
- if(ps==4)
- {
- gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_ALPHAFIRST);
- gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, TJ_ALPHAFIRST);
-
- gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_ALPHAFIRST|TJ_BGR);
- gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, TJ_ALPHAFIRST|TJ_BGR);
-
- gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_ALPHAFIRST|TJ_BOTTOMUP);
- gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, TJ_ALPHAFIRST|TJ_BOTTOMUP);
-
- gentestjpeg(hnd, jpegbuf, &size, w, h, ps, basefilename, subsamp, 100, TJ_ALPHAFIRST|TJ_BGR|TJ_BOTTOMUP);
- gentestbmp(dhnd, jpegbuf, size, w, h, ps, basefilename, subsamp, TJ_ALPHAFIRST|TJ_BGR|TJ_BOTTOMUP);
- }
-
- finally:
- if(hnd) tjDestroy(hnd);
- if(dhnd) tjDestroy(dhnd);
-
- if(jpegbuf) free(jpegbuf);
-}
-
-#define MAXLENGTH 2048
-
-void dotest1(void)
-{
- int i, j, i2; unsigned char *bmpbuf=NULL, *jpgbuf=NULL;
- tjhandle hnd=NULL; unsigned long size;
- if((hnd=tjInitCompress())==NULL)
- {printf("Error in tjInitCompress():\n%s\n", tjGetErrorStr()); bailout();}
- printf("Buffer size regression test\n");
- for(j=1; j<48; j++)
- {
- for(i=1; i<(j==1?MAXLENGTH:48); i++)
- {
- if(i%100==0) printf("%.4d x %.4d\b\b\b\b\b\b\b\b\b\b\b", i, j);
- if((bmpbuf=(unsigned char *)malloc(i*j*4))==NULL
- || (jpgbuf=(unsigned char *)malloc(TJBUFSIZE(i, j)))==NULL)
- {
- printf("Memory allocation failure\n"); bailout();
- }
- memset(bmpbuf, 0, i*j*4);
- for(i2=0; i2<i*j*4; i2++)
- {
- if(random()<RAND_MAX/2) bmpbuf[i2]=0;
- else bmpbuf[i2]=255;
- }
- _catch(tjCompress(hnd, bmpbuf, i, 0, j, 4,
- jpgbuf, &size, TJ_444, 100, TJ_BGR));
- free(bmpbuf); bmpbuf=NULL; free(jpgbuf); jpgbuf=NULL;
-
- if((bmpbuf=(unsigned char *)malloc(j*i*4))==NULL
- || (jpgbuf=(unsigned char *)malloc(TJBUFSIZE(j, i)))==NULL)
- {
- printf("Memory allocation failure\n"); bailout();
- }
- for(i2=0; i2<j*i*4; i2++)
- {
- if(random()<RAND_MAX/2) bmpbuf[i2]=0;
- else bmpbuf[i2]=255;
- }
- _catch(tjCompress(hnd, bmpbuf, j, 0, i, 4,
- jpgbuf, &size, TJ_444, 100, TJ_BGR));
- free(bmpbuf); bmpbuf=NULL; free(jpgbuf); jpgbuf=NULL;
- }
- }
- printf("Done. \n");
-
- finally:
- if(bmpbuf) free(bmpbuf); if(jpgbuf) free(jpgbuf);
- if(hnd) tjDestroy(hnd);
-}
-
-int main(int argc, char *argv[])
-{
- int doyuv=0;
- #ifdef _WIN32
- srand((unsigned int)time(NULL));
- #endif
- if(argc>1 && !stricmp(argv[1], "-yuv")) doyuv=1;
- if(doyuv) yuv=YUVENCODE;
- dotest(35, 39, 3, TJ_444, "test");
- dotest(39, 41, 4, TJ_444, "test");
- if(doyuv)
- {
- dotest(41, 35, 3, TJ_422, "test");
- dotest(35, 39, 4, TJ_422, "test");
- dotest(39, 41, 3, TJ_420, "test");
- dotest(41, 35, 4, TJ_420, "test");
- }
- dotest(35, 39, 1, TJ_GRAYSCALE, "test");
- dotest(39, 41, 3, TJ_GRAYSCALE, "test");
- dotest(41, 35, 4, TJ_GRAYSCALE, "test");
- if(!doyuv) dotest1();
- if(doyuv)
- {
- yuv=YUVDECODE;
- dotest(48, 48, 3, TJ_444, "test");
- dotest(35, 39, 3, TJ_444, "test");
- dotest(48, 48, 3, TJ_422, "test");
- dotest(39, 41, 3, TJ_422, "test");
- dotest(48, 48, 3, TJ_420, "test");
- dotest(41, 35, 3, TJ_420, "test");
- dotest(48, 48, 3, TJ_GRAYSCALE, "test");
- dotest(35, 39, 3, TJ_GRAYSCALE, "test");
- dotest(48, 48, 1, TJ_GRAYSCALE, "test");
- dotest(39, 41, 1, TJ_GRAYSCALE, "test");
- }
-
- return exitstatus;
-}
diff --git a/jpgtest.c b/jpgtest.c
deleted file mode 100644
index cac5ce3..0000000
--- a/jpgtest.c
+++ /dev/null
@@ -1,610 +0,0 @@
-/* Copyright (C)2004 Landmark Graphics Corporation
- * Copyright (C)2005, 2006 Sun Microsystems, Inc.
- * Copyright (C)2009-2011 D. R. Commander
- *
- * This library is free software and may be redistributed and/or modified under
- * the terms of the wxWindows Library License, Version 3.1 or (at your option)
- * any later version. The full license is in the LICENSE.txt file included
- * with this distribution.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * wxWindows Library License for more details.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include <errno.h>
-#include "./bmp.h"
-#include "./rrutil.h"
-#include "./rrtimer.h"
-#include "./turbojpeg.h"
-
-#define _throw(op, err) { \
- printf("ERROR in line %d while %s:\n%s\n", __LINE__, op, err); goto bailout;}
-#define _throwunix(m) _throw(m, strerror(errno))
-#define _throwtj(m) _throw(m, tjGetErrorStr())
-#define _throwbmp(m) _throw(m, bmpgeterr())
-
-#define PAD(v, p) ((v+(p)-1)&(~((p)-1)))
-
-enum {YUVENCODE=1, YUVDECODE};
-int forcemmx=0, forcesse=0, forcesse2=0, forcesse3=0, fastupsample=0,
- decomponly=0, yuv=0;
-const int _ps[BMPPIXELFORMATS]={3, 4, 3, 4, 4, 4};
-const int _flags[BMPPIXELFORMATS]={0, 0, TJ_BGR, TJ_BGR,
- TJ_BGR|TJ_ALPHAFIRST, TJ_ALPHAFIRST};
-const int _rindex[BMPPIXELFORMATS]={0, 0, 2, 2, 3, 1};
-const int _gindex[BMPPIXELFORMATS]={1, 1, 1, 1, 2, 2};
-const int _bindex[BMPPIXELFORMATS]={2, 2, 0, 0, 1, 3};
-const char *_pfname[]={"RGB", "RGBX", "BGR", "BGRX", "XBGR", "XRGB"};
-const char *_subnamel[NUMSUBOPT]={"4:4:4", "4:2:2", "4:2:0", "GRAY"};
-const char *_subnames[NUMSUBOPT]={"444", "422", "420", "GRAY"};
-
-void printsigfig(double val, int figs)
-{
- char format[80];
- double _l=log10(val); int l;
- if(_l<0.)
- {
- l=(int)fabs(_l);
- sprintf(format, "%%%d.%df", figs+l+2, figs+l);
- }
- else
- {
- l=(int)_l+1;
- if(figs<=l) sprintf(format, "%%.0f");
- else sprintf(format, "%%%d.%df", figs+1, figs-l);
- }
- printf(format, val);
-}
-
-void dotest(unsigned char *srcbuf, int w, int h, int pf, int bu,
- int jpegsub, int qual, char *filename, int dotile, int useppm, int quiet)
-{
- char tempstr[1024];
- FILE *outfile=NULL; tjhandle hnd=NULL;
- unsigned char **jpegbuf=NULL, *rgbbuf=NULL;
- double start, elapsed;
- int jpgbufsize=0, i, j, tilesizex=w, tilesizey=h, numtilesx=1, numtilesy=1,
- ITER;
- unsigned long *comptilesize=NULL;
- int flags=(forcemmx?TJ_FORCEMMX:0)|(forcesse?TJ_FORCESSE:0)
- |(forcesse2?TJ_FORCESSE2:0)|(forcesse3?TJ_FORCESSE3:0)
- |(fastupsample?TJ_FASTUPSAMPLE:0);
- int ps=_ps[pf], tilen;
- int pitch=w*ps, yuvsize=0;
-
- flags |= _flags[pf];
- if(bu) flags |= TJ_BOTTOMUP;
-
- if(yuv==YUVENCODE) yuvsize=TJBUFSIZEYUV(w, h, jpegsub);
- if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h+1))) == NULL)
- _throwunix("allocating image buffer");
-
- if(!quiet)
- {
- if(yuv==YUVENCODE)
- printf(">>>>> %s (%s) <--> YUV %s <<<<<\n", _pfname[pf],
- bu?"Bottom-up":"Top-down", _subnamel[jpegsub]);
- else
- printf(">>>>> %s (%s) <--> JPEG %s Q%d <<<<<\n", _pfname[pf],
- bu?"Bottom-up":"Top-down", _subnamel[jpegsub], qual);
- }
- if(yuv) dotile=0;
- if(dotile) {tilesizex=tilesizey=4;} else {tilesizex=w; tilesizey=h;}
-
- do
- {
- tilesizex*=2; if(tilesizex>w) tilesizex=w;
- tilesizey*=2; if(tilesizey>h) tilesizey=h;
- numtilesx=(w+tilesizex-1)/tilesizex;
- numtilesy=(h+tilesizey-1)/tilesizey;
- if((comptilesize=(unsigned long *)malloc(sizeof(unsigned long)*numtilesx*numtilesy)) == NULL
- || (jpegbuf=(unsigned char **)malloc(sizeof(unsigned char *)*numtilesx*numtilesy)) == NULL)
- _throwunix("allocating image buffers");
- memset(jpegbuf, 0, sizeof(unsigned char *)*numtilesx*numtilesy);
- for(i=0; i<numtilesx*numtilesy; i++)
- {
- if((jpegbuf[i]=(unsigned char *)malloc(
- yuv==YUVENCODE? TJBUFSIZEYUV(tilesizex, tilesizey, jpegsub)
- : TJBUFSIZE(tilesizex, tilesizey))) == NULL)
- _throwunix("allocating image buffers");
- }
-
- // Compression test
- if(quiet==1) printf("%s\t%s\t%s\t%d\t", _pfname[pf], bu?"BU":"TD",
- _subnamel[jpegsub], qual);
- for(i=0; i<h; i++) memcpy(&rgbbuf[pitch*i], &srcbuf[w*ps*i], w*ps);
- if((hnd=tjInitCompress())==NULL)
- _throwtj("executing tjInitCompress()");
- if(yuv==YUVENCODE)
- {
- if(tjEncodeYUV(hnd, rgbbuf, tilesizex, pitch, tilesizey, ps,
- jpegbuf[0], jpegsub, flags)==-1)
- _throwtj("executing tjEncodeYUV()");
- comptilesize[0]=TJBUFSIZEYUV(tilesizex, tilesizey, jpegsub);
- }
- else if(tjCompress(hnd, rgbbuf, tilesizex, pitch, tilesizey, ps,
- jpegbuf[0], &comptilesize[0], jpegsub, qual, flags)==-1)
- _throwtj("executing tjCompress()");
- ITER=0;
- start=rrtime();
- do
- {
- jpgbufsize=0; tilen=0;
- for(i=0; i<h; i+=tilesizey)
- {
- for(j=0; j<w; j+=tilesizex)
- {
- int tempw=min(tilesizex, w-j), temph=min(tilesizey, h-i);
- if(yuv==YUVENCODE)
- {
- if(tjEncodeYUV(hnd, &rgbbuf[pitch*i+j*ps], tempw, pitch,
- temph, ps, jpegbuf[tilen], jpegsub, flags)==-1)
- _throwtj("executing tjEncodeYUV()");
- comptilesize[tilen]=TJBUFSIZEYUV(tempw, temph, jpegsub);
- }
- else if(tjCompress(hnd, &rgbbuf[pitch*i+j*ps], tempw, pitch,
- temph, ps, jpegbuf[tilen], &comptilesize[tilen], jpegsub, qual,
- flags)==-1)
- _throwtj("executing tjCompress()");
- jpgbufsize+=comptilesize[tilen];
- tilen++;
- }
- }
- ITER++;
- } while((elapsed=rrtime()-start)<5.);
- if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
- hnd=NULL;
- if(quiet==1)
- {
- if(tilesizex==w && tilesizey==h) printf("Full \t");
- else printf("%-4d %-4d\t", tilesizex, tilesizey);
- }
- if(quiet)
- {
- printsigfig((double)(w*h)/1000000.*(double)ITER/elapsed, 4);
- printf("%c", quiet==2? '\n':'\t');
- printsigfig((double)(w*h*ps)/(double)jpgbufsize, 4);
- printf("%c", quiet==2? '\n':'\t');
- }
- else
- {
- if(tilesizex==w && tilesizey==h) printf("\nFull image\n");
- else printf("\nTile size: %d x %d\n", tilesizex, tilesizey);
- printf("C--> Frame rate: %f fps\n", (double)ITER/elapsed);
- printf(" Output image size: %d bytes\n", jpgbufsize);
- printf(" Compression ratio: %f:1\n",
- (double)(w*h*ps)/(double)jpgbufsize);
- printf(" Source throughput: %f Megapixels/sec\n",
- (double)(w*h)/1000000.*(double)ITER/elapsed);
- printf(" Output bit stream: %f Megabits/sec\n",
- (double)jpgbufsize*8./1000000.*(double)ITER/elapsed);
- }
- if(tilesizex==w && tilesizey==h)
- {
- if(yuv==YUVENCODE)
- sprintf(tempstr, "%s_%s.yuv", filename, _subnames[jpegsub]);
- else
- sprintf(tempstr, "%s_%sQ%d.jpg", filename, _subnames[jpegsub], qual);
- if((outfile=fopen(tempstr, "wb"))==NULL)
- _throwunix("opening reference image");
- if(fwrite(jpegbuf[0], jpgbufsize, 1, outfile)!=1)
- _throwunix("writing reference image");
- fclose(outfile); outfile=NULL;
- if(!quiet) printf("Reference image written to %s\n", tempstr);
- }
- if(yuv==YUVENCODE)
- {
- if(quiet==1) printf("\n"); goto bailout;
- }
-
- // Decompression test
- memset(rgbbuf, 127, max(yuvsize, pitch*h)); // Grey image means decompressor did nothing
- if((hnd=tjInitDecompress())==NULL)
- _throwtj("executing tjInitDecompress()");
- if(yuv==YUVDECODE)
- {
- if(tjDecompressToYUV(hnd, jpegbuf[0], jpgbufsize, rgbbuf, flags)==-1)
- _throwtj("executing tjDecompressToYUV()");
- }
- else if(tjDecompress(hnd, jpegbuf[0], jpgbufsize, rgbbuf, tilesizex, pitch,
- tilesizey, ps, flags)==-1)
- _throwtj("executing tjDecompress()");
- ITER=0;
- start=rrtime();
- do
- {
- int tilen=0;
- for(i=0; i<h; i+=tilesizey)
- {
- for(j=0; j<w; j+=tilesizex)
- {
- int tempw=min(tilesizex, w-j), temph=min(tilesizey, h-i);
- if(yuv==YUVDECODE)
- {
- if(tjDecompressToYUV(hnd, jpegbuf[tilen], comptilesize[tilen],
- &rgbbuf[pitch*i+ps*j], flags)==-1)
- _throwtj("executing tjDecompressToYUV()");
- }
- else if(tjDecompress(hnd, jpegbuf[tilen], comptilesize[tilen],
- &rgbbuf[pitch*i+ps*j], tempw, pitch, temph, ps, flags)==-1)
- _throwtj("executing tjDecompress()");
- tilen++;
- }
- }
- ITER++;
- } while((elapsed=rrtime()-start)<5.);
- if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
- hnd=NULL;
- if(quiet)
- {
- printsigfig((double)(w*h)/1000000.*(double)ITER/elapsed, 4);
- printf("\n");
- }
- else
- {
- printf("D--> Frame rate: %f fps\n", (double)ITER/elapsed);
- printf(" Dest. throughput: %f Megapixels/sec\n",
- (double)(w*h)/1000000.*(double)ITER/elapsed);
- }
- if(yuv==YUVDECODE)
- {
- sprintf(tempstr, "%s_%sQ%d.yuv", filename, _subnames[jpegsub], qual);
- if((outfile=fopen(tempstr, "wb"))==NULL)
- _throwunix("opening YUV image for output");
- if(fwrite(rgbbuf, yuvsize, 1, outfile)!=1)
- _throwunix("writing YUV image");
- fclose(outfile); outfile=NULL;
- }
- else
- {
- if(tilesizex==w && tilesizey==h)
- sprintf(tempstr, "%s_%sQ%d_full.%s", filename, _subnames[jpegsub], qual,
- useppm?"ppm":"bmp");
- else sprintf(tempstr, "%s_%sQ%d_%dx%d.%s", filename, _subnames[jpegsub],
- qual, tilesizex, tilesizey, useppm?"ppm":"bmp");
- if(savebmp(tempstr, rgbbuf, w, h, pf, pitch, bu)==-1)
- _throwbmp("saving bitmap");
- sprintf(strrchr(tempstr, '.'), "-err.%s", useppm?"ppm":"bmp");
- if(!quiet)
- printf("Computing compression error and saving to %s.\n", tempstr);
- if(jpegsub==TJ_GRAYSCALE)
- {
- for(j=0; j<h; j++)
- {
- for(i=0; i<w*ps; i+=ps)
- {
- int y=(int)((double)srcbuf[w*ps*j+i+_rindex[pf]]*0.299
- + (double)srcbuf[w*ps*j+i+_gindex[pf]]*0.587
- + (double)srcbuf[w*ps*j+i+_bindex[pf]]*0.114 + 0.5);
- if(y>255) y=255; if(y<0) y=0;
- rgbbuf[pitch*j+i+_rindex[pf]]=abs(rgbbuf[pitch*j+i+_rindex[pf]]-y);
- rgbbuf[pitch*j+i+_gindex[pf]]=abs(rgbbuf[pitch*j+i+_gindex[pf]]-y);
- rgbbuf[pitch*j+i+_bindex[pf]]=abs(rgbbuf[pitch*j+i+_bindex[pf]]-y);
- }
- }
- }
- else
- {
- for(j=0; j<h; j++) for(i=0; i<w*ps; i++)
- rgbbuf[pitch*j+i]=abs(rgbbuf[pitch*j+i]-srcbuf[w*ps*j+i]);
- }
- if(savebmp(tempstr, rgbbuf, w, h, pf, pitch, bu)==-1)
- _throwbmp("saving bitmap");
- }
-
- // Cleanup
- if(outfile) {fclose(outfile); outfile=NULL;}
- if(jpegbuf)
- {
- for(i=0; i<numtilesx*numtilesy; i++)
- {if(jpegbuf[i]) free(jpegbuf[i]); jpegbuf[i]=NULL;}
- free(jpegbuf); jpegbuf=NULL;
- }
- if(comptilesize) {free(comptilesize); comptilesize=NULL;}
- } while(tilesizex<w || tilesizey<h);
-
- if(rgbbuf) {free(rgbbuf); rgbbuf=NULL;}
- return;
-
- bailout:
- if(outfile) {fclose(outfile); outfile=NULL;}
- if(jpegbuf)
- {
- for(i=0; i<numtilesx*numtilesy; i++)
- {if(jpegbuf[i]) free(jpegbuf[i]); jpegbuf[i]=NULL;}
- free(jpegbuf); jpegbuf=NULL;
- }
- if(comptilesize) {free(comptilesize); comptilesize=NULL;}
- if(rgbbuf) {free(rgbbuf); rgbbuf=NULL;}
- if(hnd) {tjDestroy(hnd); hnd=NULL;}
- return;
-}
-
-
-void dodecomptest(char *filename, int pf, int bu, int useppm,
- int quiet)
-{
- char tempstr[1024];
- FILE *file=NULL; tjhandle hnd=NULL;
- unsigned char *jpegbuf=NULL, *rgbbuf=NULL;
- double start, elapsed;
- int w, h, ITER;
- unsigned long jpgbufsize=0;
- int flags=(forcemmx?TJ_FORCEMMX:0)|(forcesse?TJ_FORCESSE:0)
- |(forcesse2?TJ_FORCESSE2:0)|(forcesse3?TJ_FORCESSE3:0)
- |(fastupsample?TJ_FASTUPSAMPLE:0);
- int ps=_ps[pf], pitch, jpegsub=-1;
- char *temp=NULL;
- int yuvsize, bufsize;
-
- flags |= _flags[pf];
- if(bu) flags |= TJ_BOTTOMUP;
-
- if((file=fopen(filename, "rb"))==NULL)
- _throwunix("opening file");
- if(fseek(file, 0, SEEK_END)<0 || (jpgbufsize=ftell(file))<0)
- _throwunix("determining file size");
- if((jpegbuf=(unsigned char *)malloc(jpgbufsize))==NULL)
- _throwunix("allocating memory");
- if(fseek(file, 0, SEEK_SET)<0)
- _throwunix("setting file position");
- if(fread(jpegbuf, jpgbufsize, 1, file)<1)
- _throwunix("reading JPEG data");
- fclose(file); file=NULL;
-
- temp=strrchr(filename, '.');
- if(temp!=NULL) *temp='\0';
-
- if((hnd=tjInitDecompress())==NULL) _throwtj("executing tjInitDecompress()");
- if(tjDecompressHeader2(hnd, jpegbuf, jpgbufsize, &w, &h, &jpegsub)==-1)
- _throwtj("executing tjDecompressHeader2()");
-
- yuvsize=TJBUFSIZEYUV(w, h, jpegsub);
-
- pitch=w*ps;
-
- if(quiet==1)
- {
- printf("All performance values in Mpixels/sec\n\n");
- printf("Bitmap\tBitmap\tImage Size\tDecomp\n"),
- printf("Format\tOrder\t X Y \tPerf\n\n");
- printf("%s\t%s\t%-4d %-4d\t", _pfname[pf], bu?"BU":"TD", w, h);
- }
-
- bufsize=(yuv==YUVDECODE? yuvsize:pitch*h);
- if((rgbbuf=(unsigned char *)malloc(bufsize))==NULL)
- _throwunix("allocating image buffer");
-
- if(!quiet)
- {
- if(yuv==YUVDECODE)
- printf(">>>>> JPEG --> YUV %s <<<<<\n", _subnamel[jpegsub]);
- else
- printf(">>>>> JPEG --> %s (%s) <<<<<\n", _pfname[pf],
- bu?"Bottom-up":"Top-down");
- printf("\nImage size: %d x %d\n", w, h);
- }
-
- memset(rgbbuf, 127, bufsize); // Grey image means decompressor did nothing
- if(yuv==YUVDECODE)
- {
- if(tjDecompressToYUV(hnd, jpegbuf, jpgbufsize, rgbbuf, flags)==-1)
- _throwtj("executing tjDecompressToYUV()");
- }
- else if(tjDecompress(hnd, jpegbuf, jpgbufsize, rgbbuf, w, pitch, h, ps,
- flags)==-1)
- _throwtj("executing tjDecompress()");
- ITER=0;
- start=rrtime();
- do
- {
- if(yuv==YUVDECODE)
- {
- if(tjDecompressToYUV(hnd, jpegbuf, jpgbufsize, rgbbuf, flags)==-1)
- _throwtj("executing tjDecompressToYUV()");
- }
- else if(tjDecompress(hnd, jpegbuf, jpgbufsize, rgbbuf, w, pitch, h, ps,
- flags)==-1)
- _throwtj("executing tjDecompress()");
- ITER++;
- } while((elapsed=rrtime()-start)<5.);
- if(tjDestroy(hnd)==-1) _throwtj("executing tjDestroy()");
- hnd=NULL;
- if(quiet)
- {
- printsigfig((double)(w*h)/1000000.*(double)ITER/elapsed, 4);
- printf("\n");
- }
- else
- {
- printf("D--> Frame rate: %f fps\n", (double)ITER/elapsed);
- printf(" Dest. throughput: %f Megapixels/sec\n",
- (double)(w*h)/1000000.*(double)ITER/elapsed);
- }
- sprintf(tempstr, "%s_full.%s", filename, useppm?"ppm":"bmp");
- if(yuv==YUVDECODE)
- {
- sprintf(tempstr, "%s_%s.yuv", filename, _subnames[jpegsub]);
- if((file=fopen(tempstr, "wb"))==NULL)
- _throwunix("opening YUV image for output");
- if(fwrite(rgbbuf, yuvsize, 1, file)!=1)
- _throwunix("writing YUV image");
- fclose(file); file=NULL;
- }
- else
- {
- if(savebmp(tempstr, rgbbuf, w, h, pf, pitch, bu)==-1)
- _throwbmp("saving bitmap");
- }
-
- bailout:
- if(file) {fclose(file); file=NULL;}
- if(jpegbuf) {free(jpegbuf); jpegbuf=NULL;}
- if(rgbbuf) {free(rgbbuf); rgbbuf=NULL;}
- if(hnd) {tjDestroy(hnd); hnd=NULL;}
- return;
-}
-
-
-void usage(char *progname)
-{
- printf("USAGE: %s <Inputfile (BMP|PPM))> <%% Quality>\n", progname);
- printf(" %s <Inputfile (JPG))>\n\n", progname);
- printf(" [-tile]\n");
- printf(" Test performance of the codec when the image is encoded\n");
- printf(" as separate tiles of varying sizes.\n\n");
- printf(" [-forcemmx] [-forcesse] [-forcesse2] [-forcesse3]\n");
- printf(" Force MMX, SSE, SSE2, or SSE3 code paths in the underlying codec\n\n");
- printf(" [-rgb | -bgr | -rgbx | -bgrx | -xbgr | -xrgb]\n");
- printf(" Test the specified color conversion path in the codec (default: BGR)\n\n");
- printf(" [-fastupsample]\n");
- printf(" Use fast, inaccurate upsampling code to perform 4:2:2 and 4:2:0\n");
- printf(" YUV decoding in libjpeg decompressor\n\n");
- printf(" [-quiet]\n");
- printf(" Output in tabular rather than verbose format\n\n");
- printf(" [-yuvencode]\n");
- printf(" Encode RGB input as planar YUV rather than compressing as JPEG\n\n");
- printf(" [-yuvdecode]\n");
- printf(" Decode JPEG image to planar YUV rather than RGB\n\n");
- printf(" NOTE: If the quality is specified as a range, i.e. 90-100, a separate\n");
- printf(" test will be performed for all quality values in the range.\n");
- exit(1);
-}
-
-
-int main(int argc, char *argv[])
-{
- unsigned char *bmpbuf=NULL; int w, h, i, useppm=0;
- int qual=-1, dotile=0, quiet=0, hiqual=-1; char *temp;
- int pf=BMP_BGR;
- int bu=0, minarg=2;
-
- if(argc<minarg) usage(argv[0]);
-
- temp=strrchr(argv[1], '.');
- if(temp!=NULL)
- {
- if(!stricmp(temp, ".ppm")) useppm=1;
- if(!stricmp(temp, ".jpg") || !stricmp(temp, ".jpeg")) decomponly=1;
- }
-
- printf("\n");
-
- if(argc>minarg)
- {
- for(i=minarg; i<argc; i++)
- {
- if(!stricmp(argv[i], "-yuvencode"))
- {
- printf("Testing YUV planar encoding\n\n");
- yuv=YUVENCODE; hiqual=qual=100;
- }
- if(!stricmp(argv[i], "-yuvdecode"))
- {
- printf("Testing YUV planar decoding\n\n");
- yuv=YUVDECODE;
- }
- }
- }
-
- if(!decomponly && yuv!=YUVENCODE)
- {
- minarg=3;
- if(argc<minarg) usage(argv[0]);
- if((qual=atoi(argv[2]))<1 || qual>100)
- {
- puts("ERROR: Quality must be between 1 and 100.");
- exit(1);
- }
- if((temp=strchr(argv[2], '-'))!=NULL && strlen(temp)>1
- && sscanf(&temp[1], "%d", &hiqual)==1 && hiqual>qual && hiqual>=1
- && hiqual<=100) {}
- else hiqual=qual;
- }
-
- if(argc>minarg)
- {
- for(i=minarg; i<argc; i++)
- {
- if(!stricmp(argv[i], "-tile")) dotile=1;
- if(!stricmp(argv[i], "-forcesse3"))
- {
- printf("Using SSE3 code\n\n");
- forcesse3=1;
- }
- if(!stricmp(argv[i], "-forcesse2"))
- {
- printf("Using SSE2 code\n\n");
- forcesse2=1;
- }
- if(!stricmp(argv[i], "-forcesse"))
- {
- printf("Using SSE code\n\n");
- forcesse=1;
- }
- if(!stricmp(argv[i], "-forcemmx"))
- {
- printf("Using MMX code\n\n");
- forcemmx=1;
- }
- if(!stricmp(argv[i], "-fastupsample"))
- {
- printf("Using fast upsampling code\n\n");
- fastupsample=1;
- }
- if(!stricmp(argv[i], "-rgb")) pf=BMP_RGB;
- if(!stricmp(argv[i], "-rgbx")) pf=BMP_RGBX;
- if(!stricmp(argv[i], "-bgr")) pf=BMP_BGR;
- if(!stricmp(argv[i], "-bgrx")) pf=BMP_BGRX;
- if(!stricmp(argv[i], "-xbgr")) pf=BMP_XBGR;
- if(!stricmp(argv[i], "-xrgb")) pf=BMP_XRGB;
- if(!stricmp(argv[i], "-bottomup")) bu=1;
- if(!stricmp(argv[i], "-quiet")) quiet=1;
- if(!stricmp(argv[i], "-qq")) quiet=2;
- }
- }
-
- if(!decomponly)
- {
- if(loadbmp(argv[1], &bmpbuf, &w, &h, pf, 1, bu)==-1)
- _throwbmp("loading bitmap");
- temp=strrchr(argv[1], '.');
- if(temp!=NULL) *temp='\0';
- }
-
- if(quiet==1 && !decomponly)
- {
- printf("All performance values in Mpixels/sec\n\n");
- printf("Bitmap\tBitmap\tJPEG\tJPEG\tTile Size\tCompr\tCompr\tDecomp\n");
- printf("Format\tOrder\tFormat\tQual\t X Y \tPerf \tRatio\tPerf\n\n");
- }
-
- if(decomponly)
- {
- dodecomptest(argv[1], pf, bu, 1, quiet);
- printf("\n");
- goto bailout;
- }
- for(i=hiqual; i>=qual; i--)
- dotest(bmpbuf, w, h, pf, bu, TJ_GRAYSCALE, i, argv[1], dotile, useppm, quiet);
- printf("\n");
- for(i=hiqual; i>=qual; i--)
- dotest(bmpbuf, w, h, pf, bu, TJ_420, i, argv[1], dotile, useppm, quiet);
- printf("\n");
- for(i=hiqual; i>=qual; i--)
- dotest(bmpbuf, w, h, pf, bu, TJ_422, i, argv[1], dotile, useppm, quiet);
- printf("\n");
- for(i=hiqual; i>=qual; i--)
- dotest(bmpbuf, w, h, pf, bu, TJ_444, i, argv[1], dotile, useppm, quiet);
- printf("\n");
-
- bailout:
- if(bmpbuf) free(bmpbuf);
- return 0;
-}
diff --git a/jsimd.h b/jsimd.h
index b663791..3fa2c43 100644
--- a/jsimd.h
+++ b/jsimd.h
@@ -2,6 +2,7 @@
* jsimd.h
*
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
+ * Copyright 2011 D. R. Commander
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
@@ -13,8 +14,10 @@
#ifdef NEED_SHORT_EXTERNAL_NAMES
#define jsimd_can_rgb_ycc jSCanRgbYcc
+#define jsimd_can_rgb_gray jSCanRgbGry
#define jsimd_can_ycc_rgb jSCanYccRgb
#define jsimd_rgb_ycc_convert jSRgbYccConv
+#define jsimd_rgb_gray_convert jSRgbGryConv
#define jsimd_ycc_rgb_convert jSYccRgbConv
#define jsimd_can_h2v2_downsample jSCanH2V2Down
#define jsimd_can_h2v1_downsample jSCanH2V1Down
@@ -35,12 +38,17 @@
#endif /* NEED_SHORT_EXTERNAL_NAMES */
EXTERN(int) jsimd_can_rgb_ycc JPP((void));
+EXTERN(int) jsimd_can_rgb_gray JPP((void));
EXTERN(int) jsimd_can_ycc_rgb JPP((void));
EXTERN(void) jsimd_rgb_ycc_convert
JPP((j_compress_ptr cinfo,
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_rgb_gray_convert
+ JPP((j_compress_ptr cinfo,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
EXTERN(void) jsimd_ycc_rgb_convert
JPP((j_decompress_ptr cinfo,
JSAMPIMAGE input_buf, JDIMENSION input_row,
diff --git a/jsimd_none.c b/jsimd_none.c
index 7ff3074..9787902 100644
--- a/jsimd_none.c
+++ b/jsimd_none.c
@@ -2,7 +2,7 @@
* jsimd_none.c
*
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
- * Copyright 2009 D. R. Commander
+ * Copyright 2009-2011 D. R. Commander
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
@@ -25,6 +25,12 @@
}
GLOBAL(int)
+jsimd_can_rgb_gray (void)
+{
+ return 0;
+}
+
+GLOBAL(int)
jsimd_can_ycc_rgb (void)
{
return 0;
@@ -38,6 +44,13 @@
}
GLOBAL(void)
+jsimd_rgb_gray_convert (j_compress_ptr cinfo,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows)
+{
+}
+
+GLOBAL(void)
jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
JSAMPIMAGE input_buf, JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows)
diff --git a/jversion.h b/jversion.h
index 119c481..a045405 100644
--- a/jversion.h
+++ b/jversion.h
@@ -31,7 +31,6 @@
#endif
#define LJTCOPYRIGHT "Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
- "Copyright (C) 2004 Landmark Graphics Corporation\n" \
- "Copyright (C) 2005-2007 Sun Microsystems, Inc.\n" \
"Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
- "Copyright (C) 2009-2011 D. R. Commander"
+ "Copyright (C) 2009-2011 D. R. Commander\n" \
+ "Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)"
diff --git a/release/License.rtf b/release/License.rtf
index 30d15a5..5073a27 100755
--- a/release/License.rtf
+++ b/release/License.rtf
@@ -1,465 +1,20 @@
-{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf470
-{\fonttbl\f0\fswiss\fcharset77 Helvetica;\f1\fnil\fcharset77 AndaleMono;\f2\froman\fcharset77 TimesNewRomanPSMT;
-}
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
-\margl1440\margr1440\vieww9000\viewh8400\viewkind0
+{\*\listtable{\list\listtemplateid1\listhybrid{\listlevel\levelnfc23\levelnfcn23\leveljc0\leveljcn0\levelfollow0\levelstartat1\levelspace360\levelindent0{\*\levelmarker \{disc\}}{\leveltext\leveltemplateid1\'01\uc0\u8226 ;}{\levelnumbers;}\fi-360\li720\lin720 }{\listname ;}\listid1}}
+{\*\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}}
+\margl1440\margr1440\vieww9820\viewh8480\viewkind0
\deftab720
+\pard\pardeftab720
+
+\f0\fs24 \cf0 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\
+\
+\pard\tx220\tx720\pardeftab720\li720\fi-720
+\ls1\ilvl0\cf0 {\listtext \'95 }Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\
+{\listtext \'95 }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.\
+{\listtext \'95 }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.\
\pard\pardeftab720\qc
-
-\f0\fs24 \cf0 wxWindows Library Licence, Version 3.1\
-\pard\pardeftab720\ql\qnatural
\cf0 \
-\pard\pardeftab720\qc
-\cf0 Copyright (C) 1998-2005 Julian Smart, Robert Roebling et al\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\qc
-\cf0 Everyone is permitted to copy and distribute verbatim copies of this licence document, but changing it is not allowed.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\qc
-\cf0 WXWINDOWS LIBRARY LICENCE\uc0\u8232 TERMS AND CONDITIONS FOR COPYING,\u8232 DISTRIBUTION AND MODIFICATION\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public Licence as published by the Free Software Foundation; either version 2 of the Licence, or (at your option) any later version.\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public Licence for more details.
-\f2 \
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 You should have received a copy of the GNU Library General Public Licence along with this software, usually in a file named COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-\f1 \
-\
-
-\f0 EXCEPTION NOTICE
-\f1 \
-\
-
-\f0 1. As a special exception, the copyright holders of this library give permission for additional uses of the text contained in this release of the library as licenced under the wxWindows Library Licence, applying either version 3.1 of the Licence, or (at your option) any later version of the Licence as published by the copyright holders of version 3.1 of the Licence document.\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 2. The exception is that you may use, copy, link, modify and distribute under your own terms, binary object code versions of works based on the Library.
-\f1 \
-\
-
-\f0 3. If you copy code from files distributed under the terms of the GNU General Public Licence or the GNU Library General Public Licence into a copy of this library, as this licence permits, the exception does not apply to the code that you add in this way. To avoid misleading anyone as to the status of such modified files, you must delete this exception notice from such code and/or adjust the licensing conditions notice accordingly.
-\f1 \
-\
-
-\f0 4. If you write modifications of your own for this library, it is your choice whether to permit this exception to apply to your modifications. If you do not wish that, you must delete the exception notice from such code and/or adjust the licensing conditions notice accordingly.
-\f1 \
-\
-\
-\
-\
-\
-\pard\pardeftab720\qc
-
-\f0 \cf0 GNU LESSER GENERAL PUBLIC LICENSE\uc0\u8232 Version 2.1, February 1999\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\qc
-\cf0 Copyright (C) 1991, 1999 Free Software Foundation, Inc.\uc0\u8232 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\
-\
-[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.]
-\f1 \
-\
-\pard\pardeftab720\qc
-
-\f0 \cf0 Preamble\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below.
-\f1 \
-\
-
-\f0 When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things.
-\f1 \
-\
-
-\f0 To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it.
-\f1 \
-\
-
-\f0 For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights.
-\f1 \
-\
-
-\f0 We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library.
-\f1 \
-\
-
-\f0 To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others.
-\f1 \
-\page
-\f0 \
-Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license.\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs.
-\f1 \
-\
-
-\f0 When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library.
-\f1 \
-\
-
-\f0 We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances.
-\f1 \
-\
-
-\f0 For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License.
-\f1 \
-\
-
-\f0 In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system.
-\f1 \
-\
-
-\f0 Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library.
-\f1 \
-\
-
-\f0 The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run.
-\f1 \
-\page
-\f0 \
-\pard\pardeftab720\qc
-\cf0 GNU LESSER GENERAL PUBLIC LICENSE\uc0\u8232 TERMS AND CONDITIONS FOR COPYING,\u8232 DISTRIBUTION AND MODIFICATION\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you".\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables.
-\f1 \
-\
-
-\f0 The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".)
-\f1 \
-\
-
-\f0 "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library.
-\f1 \
-\
-
-\f0 Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does.
-\f1 \
- \
-
-\f0 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library.
-\f2 \
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
-\f1 \
-\page
-\f0 \
-2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-
-\f0 \cf0 a) The modified work must itself be a software library.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-\cf0 b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-\cf0 c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-\cf0 d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful.\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.)
-\f1 \
-\
-
-\f0 These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library.
-\f1 \
-\
-
-\f0 In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
-\f1 \
-\
-
-\f0 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices.
-\f1 \
-\page
-\f0 \
-Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy.\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 This option is useful when you wish to copy part of the code of the Library into a program that is not a library.
-\f1 \
-\
-
-\f0 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a
-\f1 \
-
-\f0 medium customarily used for software interchange.
-\f1 \
-\
-
-\f0 If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not
-\f1 \
-
-\f0 compelled to copy the source along with the object code.
-\f1 \
-\
-
-\f0 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
-\f1 \
-\
-
-\f0 However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables.
-\f1 \
-\
-
-\f0 When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law.
-\f1 \
-\
-
-\f0 If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative
-\f1 \
-
-\f0 work. (Executables containing this object code plus portions of the Library will still fall under Section 6.)
-\f1 \
-\
-
-\f0 Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself.
-\f1 \
-\page
-\f0 \
-6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications.\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things:
-\f1 \
-\
-\pard\pardeftab720\li720\ri0\ql\qnatural
-
-\f0 \cf0 a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.)\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-\cf0 b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-\cf0 c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-\cf0 d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-\cf0 e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
-\f1 \
-\
-
-\f0 It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute.
-\f1 \
-\page
-\f0 \
-7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things:\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-
-\f0 \cf0 a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-\cf0 b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
-\f1 \
-\
-
-\f0 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it.
-\f1 \
-\
-
-\f0 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License.
-\f1 \
-\page
-\f0 \
-11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library.\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances.
-\f1 \
-\
-
-\f0 It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is
-\f1 \
-
-\f0 implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
-\f1 \
-\
-
-\f0 This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
-\f1 \
-\
-
-\f0 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
-\f1 \
-\
-
-\f0 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
-\f1 \
-\
-
-\f0 Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation.
-\f1 \
-\page
-\f0 \
-14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\qc
-
-\f0 \cf0 NO WARRANTY\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-\f1 \
-\
-\pard\pardeftab720\qc
-
-\f0 \cf0 END OF TERMS AND CONDITIONS\
-\page \
-How to Apply These Terms to Your New Libraries\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License).\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
-\f1 \
-\
-\pard\pardeftab720\li720\ri0\ql\qnatural
-
-\f0 \cf0 <one line to give the library's name and a brief idea of what it does.>\uc0\u8232 Copyright (C) <year> <name of author>\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-\cf0 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-\cf0 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-\cf0 You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 Also add information on how to contact you by electronic and paper mail.\
-\pard\pardeftab720\ql\qnatural
-
-\f1 \cf0 \
-\pard\pardeftab720\ql\qnatural
-
-\f0 \cf0 You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names:
-\f1 \
-\
-\pard\pardeftab720\li720\ri0\ql\qnatural
-
-\f0 \cf0 Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker.\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-\pard\pardeftab720\li720\ri0\ql\qnatural
-\cf0 <signature of Ty Coon>, 1 April 1990\uc0\u8232 Ty Coon, President of Vice\
-\pard\pardeftab720\ql\qnatural
-\cf0 \
-That's all there is to it!
-\f1 \
-\
+\pard\pardeftab720
+\cf0 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.\
}
\ No newline at end of file
diff --git a/release/Welcome.rtf b/release/Welcome.rtf
index c047f1c..9082f65 100755
--- a/release/Welcome.rtf
+++ b/release/Welcome.rtf
@@ -1,16 +1,18 @@
-{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
+{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fmodern\fcharset0 CourierNewPSMT;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\deftab720
\pard\pardeftab720\ql\qnatural
-\f0\fs24 \cf0 This installer will install the libjpeg-turbo SDK and run-time libraries onto your computer so that you can use libjpeg-turbo to build new applications or accelerate existing ones. To remove the libjpeg-turbo package, you can either use the "Uninstall libjpeg-turbo" application, which can be found in the same archive as this package, or you can run\
+\f0\fs24 \cf0 This installer will install the libjpeg-turbo SDK and run-time libraries onto your computer so that you can use libjpeg-turbo to build new applications or accelerate existing ones. To remove the libjpeg-turbo package, run\
\
+\pard\pardeftab720\ql\qnatural
-\f1 /opt/libjpeg-turbo/bin/uninstall\
+\f1 \cf0 /opt/libjpeg-turbo/bin/uninstall\
+\pard\pardeftab720\ql\qnatural
-\f0 \
+\f0 \cf0 \
from the command line.\
\
If TurboJPEG/IPP is currently installed, then it must be removed prior to installing libjpeg-turbo.\
diff --git a/release/copyright b/release/copyright
index 13db231..125388d 100755
--- a/release/copyright
+++ b/release/copyright
@@ -1 +1 @@
-Use is subject to the terms of the wxWindows Library License, version 3.1
+libjpeg-turbo is released under a BSD-style license (see README and README-turbo.txt)
diff --git a/release/libjpeg-turbo.nsi.in b/release/libjpeg-turbo.nsi.in
index 6eb4bae..39773f6 100755
--- a/release/libjpeg-turbo.nsi.in
+++ b/release/libjpeg-turbo.nsi.in
@@ -48,7 +48,7 @@
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}cjpeg.exe"
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}djpeg.exe"
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpegtran.exe"
- File "@CMAKE_BINARY_DIR@\${BUILDDIR}jpgtest.exe"
+ File "@CMAKE_BINARY_DIR@\${BUILDDIR}tjbench.exe"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}rdjpgcom.exe"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}wrjpgcom.exe"
SetOutPath $INSTDIR\lib
@@ -63,6 +63,10 @@
File "@CMAKE_BINARY_DIR@\sharedlib\${BUILDDIR}jpeg.lib"
File "@CMAKE_BINARY_DIR@\${BUILDDIR}jpeg-static.lib"
!endif
+!ifdef JAVA
+ SetOutPath $INSTDIR\classes
+ File "@CMAKE_BINARY_DIR@\java\${BUILDDIR}turbojpeg.jar"
+!endif
SetOutPath $INSTDIR\include
File "@CMAKE_BINARY_DIR@\jconfig.h"
File "@CMAKE_SOURCE_DIR@\jerror.h"
@@ -73,8 +77,6 @@
File "@CMAKE_SOURCE_DIR@\README"
File "@CMAKE_SOURCE_DIR@\README-turbo.txt"
File "@CMAKE_SOURCE_DIR@\libjpeg.txt"
- File "@CMAKE_SOURCE_DIR@\LGPL.txt"
- File "@CMAKE_SOURCE_DIR@\LICENSE.txt"
File "@CMAKE_SOURCE_DIR@\usage.txt"
WriteRegStr HKLM "SOFTWARE\@INST_DIR@ @VERSION@" "Install_Dir" "$INSTDIR"
@@ -113,10 +115,13 @@
Delete $INSTDIR\lib\turbojpeg.lib
Delete $INSTDIR\lib\turbojpeg-static.lib
!endif
+!ifdef JAVA
+ Delete $INSTDIR\classes\turbojpeg.jar
+!endif
Delete $INSTDIR\bin\cjpeg.exe
Delete $INSTDIR\bin\djpeg.exe
Delete $INSTDIR\bin\jpegtran.exe
- Delete $INSTDIR\bin\jpgtest.exe
+ Delete $INSTDIR\bin\tjbench.exe
Delete $INSTDIR\bin\rdjpgcom.exe
Delete $INSTDIR\bin\wrjpgcom.exe
Delete $INSTDIR\include\jconfig.h"
@@ -128,13 +133,14 @@
Delete $INSTDIR\doc\README
Delete $INSTDIR\doc\README-turbo.txt
Delete $INSTDIR\doc\libjpeg.txt
- Delete $INSTDIR\doc\LGPL.txt
- Delete $INSTDIR\doc\LICENSE.txt
Delete $INSTDIR\doc\usage.txt
RMDir "$INSTDIR\include"
RMDir "$INSTDIR\lib"
RMDir "$INSTDIR\doc"
+!ifdef JAVA
+ RMDir "$INSTDIR\classes"
+!endif
RMDir "$INSTDIR\bin"
RMDir "$INSTDIR"
diff --git a/release/libjpeg-turbo.spec.in b/release/libjpeg-turbo.spec.in
index 645be70..68a67b5 100644
--- a/release/libjpeg-turbo.spec.in
+++ b/release/libjpeg-turbo.spec.in
@@ -12,7 +12,7 @@
Group: System Environment/Libraries
#-->Source0: http://prdownloads.sourceforge.net/libjpeg-turbo/libjpeg-turbo-%{version}.tar.gz
Release: @BUILD@
-License: wxWindows Library License, v3.1
+License: BSD-style
BuildRoot: %{_blddir}/%{name}-buildroot-%{version}-%{release}
Prereq: /sbin/ldconfig
Provides: %{name} = %{version}-%{release}, turbojpeg = 2.00
@@ -43,7 +43,7 @@
#-->%setup -q
#-->%build
-#-->./configure libdir=/opt/%{name}/%{__lib} mandir=/opt/%{name}/man JPEG_LIB_VERSION=@JPEG_LIB_VERSION@ SO_MAJOR_VERSION=@SO_MAJOR_VERSION@ SO_MINOR_VERSION=@SO_MINOR_VERSION@ --with-pic
+#-->./configure libdir=/opt/%{name}/%{__lib} mandir=/opt/%{name}/man JPEG_LIB_VERSION=@JPEG_LIB_VERSION@ SO_MAJOR_VERSION=@SO_MAJOR_VERSION@ SO_MINOR_VERSION=@SO_MINOR_VERSION@ --with-pic @RPM_CONFIG_ARGS@
#-->make DESTDIR=$RPM_BUILD_ROOT libdir=/opt/%{name}/%{__lib} mandir=/opt/%{name}/man
%install
@@ -69,13 +69,13 @@
%files
%defattr(-,root,root)
-%doc %{_srcdir}/README-turbo.txt %{_srcdir}/README %{_srcdir}/libjpeg.txt %{_srcdir}/usage.txt %{_srcdir}/LICENSE.txt %{_srcdir}/LGPL.txt
+%doc %{_srcdir}/README-turbo.txt %{_srcdir}/README %{_srcdir}/libjpeg.txt %{_srcdir}/usage.txt
%dir /opt/%{name}
%dir /opt/%{name}/bin
/opt/%{name}/bin/cjpeg
/opt/%{name}/bin/djpeg
/opt/%{name}/bin/jpegtran
-/opt/%{name}/bin/jpgtest
+/opt/%{name}/bin/tjbench
/opt/%{name}/bin/rdjpgcom
/opt/%{name}/bin/wrjpgcom
%dir /opt/%{name}/%{__lib}
@@ -104,5 +104,7 @@
/opt/%{name}/man/man1/jpegtran.1*
/opt/%{name}/man/man1/rdjpgcom.1*
/opt/%{name}/man/man1/wrjpgcom.1*
+@JAVA_RPM_CONTENTS_1@
+@JAVA_RPM_CONTENTS_2@
%changelog
diff --git a/release/makecygwinpkg.in b/release/makecygwinpkg.in
index 51d5852..2dbd650 100755
--- a/release/makecygwinpkg.in
+++ b/release/makecygwinpkg.in
@@ -31,8 +31,6 @@
install -m 644 $SRCDIR/README $DOCDIR
install -m 644 $SRCDIR/libjpeg.txt $DOCDIR
install -m 644 $SRCDIR/usage.txt $DOCDIR
-install -m 644 $SRCDIR/LICENSE.txt $DOCDIR
-install -m 644 $SRCDIR/LGPL.txt $DOCDIR
ln -fs lib $TMPDIR/pkg/opt/$PACKAGE_NAME/lib32
cd $TMPDIR/pkg
tar cfj ../$PACKAGE_NAME-$VERSION-cygwin.tar.bz2 *
diff --git a/release/makedpkg.in b/release/makedpkg.in
index aaaeacb..7a15518 100644
--- a/release/makedpkg.in
+++ b/release/makedpkg.in
@@ -43,6 +43,7 @@
rm -rf $TMPDIR/opt/$DIRNAME/include
rm -rf $TMPDIR/opt/$DIRNAME/man
rm -rf $TMPDIR/opt/$DIRNAME/bin
+ rm -rf $TMPDIR/opt/$DIRNAME/classes
fi
mkdir -p $TMPDIR/usr/$__LIB
@@ -63,8 +64,6 @@
mv $TMPDIR/opt/$DIRNAME/include/turbojpeg.h $TMPDIR/usr/include
ln -fs /usr/include/turbojpeg.h $TMPDIR/opt/$DIRNAME/include/
mkdir -p $TMPDIR/usr/share/doc/$DIRNAME-$VERSION
- install -m 644 $SRCDIR/LICENSE.txt $TMPDIR/usr/share/doc/$DIRNAME-$VERSION
- install -m 644 $SRCDIR/LGPL.txt $TMPDIR/usr/share/doc/$DIRNAME-$VERSION
install -m 644 $SRCDIR/README-turbo.txt $TMPDIR/usr/share/doc/$DIRNAME-$VERSION
install -m 644 $SRCDIR/README $TMPDIR/usr/share/doc/$DIRNAME-$VERSION
install -m 644 $SRCDIR/libjpeg.txt $TMPDIR/usr/share/doc/$DIRNAME-$VERSION
diff --git a/release/makemacpkg.in b/release/makemacpkg.in
index 4fee6c1..2ee0805 100644
--- a/release/makemacpkg.in
+++ b/release/makemacpkg.in
@@ -28,6 +28,7 @@
BUILD=@BUILD@
SRCDIR=@abs_top_srcdir@
BUILDDIR32=@abs_top_srcdir@/osxx86
+WITH_JAVA=@WITH_JAVA@
if [ $# -gt 0 ]; then
if [ "$1" = "universal" ]; then
UNIVERSAL=1
@@ -103,9 +104,9 @@
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/jpegtran \
-output $PKGROOT/opt/$PACKAGE_NAME/bin/jpegtran
lipo -create \
- -arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/jpgtest \
- -arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/jpgtest \
- -output $PKGROOT/opt/$PACKAGE_NAME/bin/jpgtest
+ -arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/tjbench \
+ -arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/tjbench \
+ -output $PKGROOT/opt/$PACKAGE_NAME/bin/tjbench
lipo -create \
-arch i386 $TMPDIR/dist.x86/opt/$PACKAGE_NAME/bin/rdjpgcom \
-arch x86_64 $PKGROOT/opt/$PACKAGE_NAME/bin/rdjpgcom \
@@ -122,6 +123,9 @@
ln -fs /usr/include/turbojpeg.h $PKGROOT/opt/$PACKAGE_NAME/include/
ln -fs /usr/lib/libturbojpeg.a $PKGROOT/opt/$PACKAGE_NAME/lib/
+if [ $WITH_JAVA = 1 ]; then
+ ln -fs libturbojpeg.dylib $PKGROOT/usr/lib/libturbojpeg.jnilib
+fi
if [ ! -h $PKGROOT/opt/$PACKAGE_NAME/lib32 ]; then
ln -fs lib $PKGROOT/opt/$PACKAGE_NAME/lib32
fi
@@ -138,8 +142,6 @@
cp pkgscripts/Info.plist $TMPDIR/pkg/
install -m 755 pkgscripts/uninstall $PKGROOT/opt/$PACKAGE_NAME/bin/
-install -m 644 $SRCDIR/LICENSE.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/LICENSE.txt
-install -m 644 $SRCDIR/LGPL.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/LGPL.txt
install -m 644 $SRCDIR/README-turbo.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/README-turbo.txt
install -m 644 $SRCDIR/README $PKGROOT/Library/Documentation/$PACKAGE_NAME/README
install -m 644 $SRCDIR/libjpeg.txt $PKGROOT/Library/Documentation/$PACKAGE_NAME/libjpeg.txt
@@ -153,9 +155,6 @@
$PACKAGEMAKER -build -v -p $TMPDIR/dmg/$PACKAGE_NAME.pkg \
-f $PKGROOT -r $TMPDIR/pkg/Resources \
-i $TMPDIR/pkg/Info.plist -d $TMPDIR/pkg/Description.plist
-install -m 644 $SRCDIR/release/uninstall.applescript $TMPDIR
-sudo osacompile -t APPL -o "$TMPDIR/dmg/Uninstall $PACKAGE_NAME.app" $TMPDIR/uninstall.applescript
-sudo chown -R $USER "$TMPDIR/dmg/Uninstall $PACKAGE_NAME.app"
hdiutil create -fs HFS+ -volname $PACKAGE_NAME-$VERSION \
-srcfolder "$TMPDIR/dmg" $TMPDIR/$PACKAGE_NAME-$VERSION.dmg
cp $TMPDIR/$PACKAGE_NAME-$VERSION.dmg .
diff --git a/release/makesunpkg.in b/release/makesunpkg.in
index aa2e735..3331dab 100644
--- a/release/makesunpkg.in
+++ b/release/makesunpkg.in
@@ -29,6 +29,7 @@
PKGARCH=@DEBARCH@
SRCDIR=@abs_top_srcdir@
BUILDDIR32=@abs_top_srcdir@/solx86
+WITH_JAVA=@WITH_JAVA@
if [ $# -gt 0 ]; then
if [ "$1" = "combined" ]; then
COMBINED=1
@@ -67,7 +68,7 @@
make install DESTDIR=$TMPDIR libdir=/opt/$PACKAGE_NAME/$__LIB mandir=/opt/$PACKAGE_NAME/man AM_MAKEFLAGS="libdir=/opt/$PACKAGE_NAME/$__LIB mandir=/opt/$PACKAGE_NAME/man"
rm -f $TMPDIR/opt/$PACKAGE_NAME/$__LIB/*.la
mkdir -p $TMPDIR/opt/$PACKAGE_NAME/doc
-cp $SRCDIR/LICENSE.txt $SRCDIR/LGPL.txt $SRCDIR/README-turbo.txt $SRCDIR/README $SRCDIR/libjpeg.txt $SRCDIR/usage.txt $TMPDIR/opt/$PACKAGE_NAME/doc
+cp $SRCDIR/README-turbo.txt $SRCDIR/README $SRCDIR/libjpeg.txt $SRCDIR/usage.txt $TMPDIR/opt/$PACKAGE_NAME/doc
chmod 644 $TMPDIR/opt/$PACKAGE_NAME/doc/*
cat >$TMPDIR/proto <<EOF
@@ -79,7 +80,7 @@
f none $PACKAGE_NAME/bin/cjpeg 0755 root bin
f none $PACKAGE_NAME/bin/djpeg 0755 root bin
f none $PACKAGE_NAME/bin/jpegtran 0755 root bin
-f none $PACKAGE_NAME/bin/jpgtest 0755 root bin
+f none $PACKAGE_NAME/bin/tjbench 0755 root bin
f none $PACKAGE_NAME/bin/rdjpgcom 0755 root bin
f none $PACKAGE_NAME/bin/wrjpgcom 0755 root bin
d none $PACKAGE_NAME/lib 0755 root bin
@@ -121,13 +122,15 @@
f none $PACKAGE_NAME/include/jpeglib.h 0644 root bin
f none $PACKAGE_NAME/include/turbojpeg.h 0644 root bin
d none $PACKAGE_NAME/doc 0755 root bin
-f none $PACKAGE_NAME/doc/LGPL.txt 0644 root bin
f none $PACKAGE_NAME/doc/libjpeg.txt 0644 root bin
-f none $PACKAGE_NAME/doc/LICENSE.txt 0644 root bin
f none $PACKAGE_NAME/doc/README 0644 root bin
f none $PACKAGE_NAME/doc/README-turbo.txt 0644 root bin
f none $PACKAGE_NAME/doc/usage.txt 0644 root bin
EOF
+if [ $WITH_JAVA = 1 ]; then
+echo d none $PACKAGE_NAME/classes 0755 root bin >>$TMPDIR/proto
+echo f none $PACKAGE_NAME/classes/turbojpeg.jar 0644 root bin >>$TMPDIR/proto
+fi
pkgmk -o -r $TMPDIR/opt -d $TMPDIR -a i386 -f $TMPDIR/proto
pkgtrans -s $TMPDIR $TMPDIR/$PACKAGE_NAME-$VERSION.pkg $PACKAGE_NAME
diff --git a/release/uninstall.applescript b/release/uninstall.applescript
deleted file mode 100644
index 002f681..0000000
--- a/release/uninstall.applescript
+++ /dev/null
@@ -1,45 +0,0 @@
--- Copyright (C)2010 D. R. Commander
--- Copyright (C)2009 Sun Microsystems, Inc.
---
--- This library is free software and may be redistributed and/or modified under
--- the terms of the wxWindows Library License, Version 3.1 or (at your option)
--- any later version. The full license is in the LICENSE.txt file included
--- with this distribution.
---
--- This library is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- wxWindows Library License for more details.
-
-set disk to (path to startup disk) as string
-set tmpfile to path to temporary items from user domain
-set tmpfile to POSIX path of tmpfile & "libjpeg-turbo_uninstall.log"
-set uninstaller to disk & "opt:libjpeg-turbo:bin:uninstall"
-set uninstaller to "sh " & POSIX path of uninstaller & " 2>&1 >" & tmpfile
-set success to 0
-
-display dialog "You are about to uninstall libjpeg-turbo. Proceed?" buttons {"Yes", "No"} default button "No"
-
-if button returned of result is "Yes" then
- try
- do shell script (uninstaller) with administrator privileges
- set success to 1
- on error errstr number errnum
- if errnum is -128 then
- display dialog "Uninstall aborted." buttons {"OK"}
- else if errnum is 255 then
- set errmsg to "The uninstall script could not remove some of the files or directories installed by the libjpeg-turbo package. Consult:" & return & return & tmpfile & return & return & "for more details."
- display dialog errmsg buttons {"OK"} default button "OK" with icon caution
- else if errnum is 127 then
- display dialog "Could not find the libjpeg-turbo uninstall script. The libjpeg-turbo package may have already been uninstalled." buttons {"OK"} default button "OK" with icon stop
- else
- set errmsg to "ERROR " & errnum & ": " & errstr
- display dialog errmsg buttons {"OK"} default button "OK" with icon stop
- end if
- end try
- if success is 1 then
- display dialog "libjpeg-turbo has been successfully uninstalled." buttons {"OK"}
- end if
-else
- display dialog "Uninstall aborted." buttons {"OK"}
-end if
diff --git a/release/uninstall.in b/release/uninstall.in
index 94fc4f1..2e4598c 100644
--- a/release/uninstall.in
+++ b/release/uninstall.in
@@ -1,77 +1,90 @@
-# Copyright (C)2009-2011 D. R. Commander
-# Copyright (C)2009 Sun Microsystems, Inc.
+# Copyright (C)2009-2011 D. R. Commander. All Rights Reserved.
#
-# This library is free software and may be redistributed and/or modified under
-# the terms of the wxWindows Library License, Version 3.1 or (at your option)
-# any later version. The full license is in the LICENSE.txt file included
-# with this distribution.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# wxWindows Library License for more details.
+# - 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.
#!/bin/sh
-error()
-{
- echo $1
- exit -1
-}
-
if [ ! "`id -u`" = "0" ]; then
- error "This command must be run as root"
+ echo "ERROR: This script must be executed as root"
+ exit -1
fi
-PKGNAME=@PACKAGE_NAME@
-MACPKGNAME=com.$PKGNAME.$PKGNAME
-RCPT=/Library/Receipts/$PKGNAME.pkg
+PACKAGE=@PACKAGE_NAME@
+MACPACKAGE=com.$PACKAGE.$PACKAGE
+RECEIPT=/Library/Receipts/$PACKAGE.pkg
LSBOM=
-if [ -d $RCPT ]; then
- LSBOM='lsbom -s -f -l '$RCPT'/Contents/Archive.bom'
+if [ -d $RECEIPT ]; then
+ LSBOM='lsbom -s -f -l '$RECEIPT'/Contents/Archive.bom'
else
- LSBOM='pkgutil --files '$MACPKGNAME
+ LSBOM='pkgutil --files '$MACPACKAGE
fi
-echo Removing files ...
-$LSBOM >/dev/null || error "Could not list package contents"
-RETCODE=0
-PWD=`pwd`
-cd /
-$LSBOM | while read line; do
- if [ ! -d "$line" ]; then rm "$line" 2>&1 || RETCODE=-1; fi
+mylsbom()
+{
+ $LSBOM || (echo "ERROR: Could not list package contents"; exit -1)
+}
+
+echo Removing package files ...
+EXITSTATUS=0
+pushd /
+mylsbom | while read file; do
+ if [ ! -d "$file" ]; then rm "$file" 2>&1 || EXITSTATUS=-1; fi
done
-cd $PWD
+popd
-echo Removing directories ...
-rmdir /opt/$PKGNAME/bin 2>&1 || RETCODE=-1
-if [ -d /opt/$PKGNAME/bin ]; then
- rmdir /opt/$PKGNAME/bin 2>&1 || RETCODE=-1
+echo Removing package directories ...
+if [ -d /opt/$PACKAGE/bin ]; then
+ rmdir /opt/$PACKAGE/bin 2>&1 || EXITSTATUS=-1
fi
-if [ -d /opt/$PKGNAME/lib ]; then
- rmdir /opt/$PKGNAME/lib 2>&1 || RETCODE=-1
+if [ -d /opt/$PACKAGE/lib ]; then
+ rmdir /opt/$PACKAGE/lib 2>&1 || EXITSTATUS=-1
fi
-if [ -d /opt/$PKGNAME/include ]; then
- rmdir /opt/$PKGNAME/include 2>&1 || RETCODE=-1
+if [ -d /opt/$PACKAGE/include ]; then
+ rmdir /opt/$PACKAGE/include 2>&1 || EXITSTATUS=-1
fi
-rm /opt/$PKGNAME/lib32 2>&1 || RETCODE=-1
-rm /opt/$PKGNAME/lib64 2>&1 || RETCODE=-1
-if [ -d /opt/$PKGNAME/man/man1 ]; then
- rmdir /opt/$PKGNAME/man/man1 2>&1 || RETCODE=-1
+rm /opt/$PACKAGE/lib32 2>&1 || EXITSTATUS=-1
+rm /opt/$PACKAGE/lib64 2>&1 || EXITSTATUS=-1
+if [ -d /opt/$PACKAGE/man/man1 ]; then
+ rmdir /opt/$PACKAGE/man/man1 2>&1 || EXITSTATUS=-1
fi
-if [ -d /opt/$PKGNAME/man ]; then
- rmdir /opt/$PKGNAME/man 2>&1 || RETCODE=-1
+if [ -d /opt/$PACKAGE/man ]; then
+ rmdir /opt/$PACKAGE/man 2>&1 || EXITSTATUS=-1
fi
-rmdir /opt/$PKGNAME 2>&1 || RETCODE=-1
-rmdir /Library/Documentation/$PKGNAME 2>&1 || RETCODE=-1
+if [ -d /opt/$PACKAGE/classes ]; then
+ rmdir /opt/$PACKAGE/classes 2>&1 || EXITSTATUS=-1
+fi
+rmdir /opt/$PACKAGE 2>&1 || EXITSTATUS=-1
+rmdir /Library/Documentation/$PACKAGE 2>&1 || EXITSTATUS=-1
-if [ -d $RCPT ]; then
- echo Removing package receipt $RCPT ...
- rm -r $RCPT 2>&1 || RETCODE=-1
+if [ -d $RECEIPT ]; then
+ echo Removing package receipt ...
+ rm -r $RECEIPT 2>&1 || EXITSTATUS=-1
else
- echo Forgetting package $MACPKGNAME
- pkgutil --forget $MACPKGNAME
+ echo Forgetting package $MACPACKAGE ...
+ pkgutil --forget $MACPACKAGE
fi
-exit $RETCODE
+exit $EXITSTATUS
diff --git a/rrtimer.h b/rrtimer.h
deleted file mode 100644
index 3031ef5..0000000
--- a/rrtimer.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C)2004 Landmark Graphics Corporation
- * Copyright (C)2005 Sun Microsystems, Inc.
- *
- * This library is free software and may be redistributed and/or modified under
- * the terms of the wxWindows Library License, Version 3.1 or (at your option)
- * any later version. The full license is in the LICENSE.txt file included
- * with this distribution.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * wxWindows Library License for more details.
- */
-
-#ifndef __RRTIMER_H__
-#define __RRTIMER_H__
-
-#ifdef _WIN32
-
-#include <windows.h>
-
-__inline double rrtime(void)
-{
- LARGE_INTEGER Frequency, Time;
- if(QueryPerformanceFrequency(&Frequency)!=0)
- {
- QueryPerformanceCounter(&Time);
- return (double)Time.QuadPart/(double)Frequency.QuadPart;
- }
- else return (double)GetTickCount()*0.001;
-}
-
-#else
-
-#include <sys/time.h>
-
-#ifdef sun
-#define __inline inline
-#endif
-
-static __inline double rrtime(void)
-{
- struct timeval __tv;
- gettimeofday(&__tv, (struct timezone *)NULL);
- return((double)__tv.tv_sec+(double)__tv.tv_usec*0.000001);
-}
-
-#endif
-
-#endif
diff --git a/rrutil.h b/rrutil.h
deleted file mode 100644
index 4b61dbf..0000000
--- a/rrutil.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Copyright (C)2004 Landmark Graphics Corporation
- * Copyright (C)2005 Sun Microsystems, Inc.
- * Copyright (C)2010 D. R. Commander
- *
- * This library is free software and may be redistributed and/or modified under
- * the terms of the wxWindows Library License, Version 3.1 or (at your option)
- * any later version. The full license is in the LICENSE.txt file included
- * with this distribution.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * wxWindows Library License for more details.
- */
-
-#ifndef __RRUTIL_H__
-#define __RRUTIL_H__
-
-#ifdef _WIN32
- #include <windows.h>
- #define sleep(t) Sleep((t)*1000)
- #define usleep(t) Sleep((t)/1000)
-#else
- #include <unistd.h>
- #define stricmp strcasecmp
- #define strnicmp strncasecmp
-#endif
-
-#ifndef min
- #define min(a,b) ((a)<(b)?(a):(b))
-#endif
-
-#ifndef max
- #define max(a,b) ((a)>(b)?(a):(b))
-#endif
-
-#define pow2(i) (1<<(i))
-#define isPow2(x) (((x)&(x-1))==0)
-
-#ifdef sgi
-#define _SC_NPROCESSORS_CONF _SC_NPROC_CONF
-#endif
-
-#ifdef sun
-#define __inline inline
-#endif
-
-static __inline int numprocs(void)
-{
- #ifdef _WIN32
- DWORD_PTR ProcAff, SysAff, i; int count=0;
- if(!GetProcessAffinityMask(GetCurrentProcess(), &ProcAff, &SysAff)) return(1);
- for(i=0; i<sizeof(long*)*8; i++) if(ProcAff&(1LL<<i)) count++;
- return(count);
- #elif defined (__APPLE__)
- return(1);
- #else
- long count=1;
- if((count=sysconf(_SC_NPROCESSORS_CONF))!=-1) return((int)count);
- else return(1);
- #endif
-}
-
-#define byteswap(i) ( \
- (((i) & 0xff000000) >> 24) | \
- (((i) & 0x00ff0000) >> 8) | \
- (((i) & 0x0000ff00) << 8) | \
- (((i) & 0x000000ff) << 24) )
-
-#define byteswap16(i) ( \
- (((i) & 0xff00) >> 8) | \
- (((i) & 0x00ff) << 8) )
-
-static __inline int littleendian(void)
-{
- unsigned int value=1;
- unsigned char *ptr=(unsigned char *)(&value);
- if(ptr[0]==1 && ptr[3]==0) return 1;
- else return 0;
-}
-
-#endif
diff --git a/simd/CMakeLists.txt b/simd/CMakeLists.txt
index d956dac..0eacebe 100755
--- a/simd/CMakeLists.txt
+++ b/simd/CMakeLists.txt
@@ -18,16 +18,16 @@
endif()
if(SIMD_X86_64)
- set(SIMD_BASENAMES jfsseflt-64 jccolss2-64 jdcolss2-64 jcsamss2-64
- jdsamss2-64 jdmerss2-64 jcqnts2i-64 jfss2fst-64 jfss2int-64 jiss2red-64
- jiss2int-64 jiss2fst-64 jcqnts2f-64 jiss2flt-64)
+ set(SIMD_BASENAMES jfsseflt-64 jccolss2-64 jdcolss2-64 jcgrass2-64
+ jcsamss2-64 jdsamss2-64 jdmerss2-64 jcqnts2i-64 jfss2fst-64 jfss2int-64
+ jiss2red-64 jiss2int-64 jiss2fst-64 jcqnts2f-64 jiss2flt-64)
message(STATUS "Building x86_64 SIMD extensions")
else()
- set(SIMD_BASENAMES jsimdcpu jccolmmx jdcolmmx jcsammmx jdsammmx jdmermmx
- jcqntmmx jfmmxfst jfmmxint jimmxred jimmxint jimmxfst jcqnt3dn jf3dnflt
- ji3dnflt jcqntsse jfsseflt jisseflt jccolss2 jdcolss2 jcsamss2 jdsamss2
- jdmerss2 jcqnts2i jfss2fst jfss2int jiss2red jiss2int jiss2fst jcqnts2f
- jiss2flt)
+ set(SIMD_BASENAMES jsimdcpu jccolmmx jcgrammx jdcolmmx jcsammmx jdsammmx
+ jdmermmx jcqntmmx jfmmxfst jfmmxint jimmxred jimmxint jimmxfst jcqnt3dn
+ jf3dnflt ji3dnflt jcqntsse jfsseflt jisseflt jccolss2 jcgrass2 jdcolss2
+ jcsamss2 jdsamss2 jdmerss2 jcqnts2i jfss2fst jfss2int jiss2red jiss2int
+ jiss2fst jcqnts2f jiss2flt)
message(STATUS "Building i386 SIMD extensions")
endif()
@@ -48,6 +48,10 @@
set(DEPFILE ${SIMD_SRC})
string(REGEX REPLACE "mer" "mrg" DEPFILE ${DEPFILE})
endif()
+ if(${file} MATCHES gra)
+ set(DEPFILE ${SIMD_SRC})
+ string(REGEX REPLACE "gra" "gry" DEPFILE ${DEPFILE})
+ endif()
set(SIMD_OBJ ${OBJDIR}/${file}.obj)
add_custom_command(OUTPUT ${SIMD_OBJ} DEPENDS ${SIMD_SRC} ${DEPFILE} *.inc
COMMAND ${NASM} ${NAFLAGS} ${SIMD_SRC} -o${SIMD_OBJ})
diff --git a/simd/Makefile.am b/simd/Makefile.am
index 81c23af..a12ff6e 100644
--- a/simd/Makefile.am
+++ b/simd/Makefile.am
@@ -4,14 +4,14 @@
EXTRA_DIST = nasm_lt.sh jcclrmmx.asm jcclrss2.asm jdclrmmx.asm jdclrss2.asm \
jdmrgmmx.asm jdmrgss2.asm jcclrss2-64.asm jdclrss2-64.asm \
- jdmrgss2-64.asm CMakeLists.txt
+ jdmrgss2-64.asm jcgryss2-64.asm jcgrymmx.asm jcgryss2.asm CMakeLists.txt
if SIMD_X86_64
libsimd_la_SOURCES = jsimd_x86_64.c \
jsimd.h jsimdcfg.inc.h \
jsimdext.inc jcolsamp.inc jdct.inc \
- jfsseflt-64.asm \
+ jfsseflt-64.asm jcgrass2-64.asm \
jccolss2-64.asm jdcolss2-64.asm \
jcsamss2-64.asm jdsamss2-64.asm jdmerss2-64.asm \
jcqnts2i-64.asm jfss2fst-64.asm jfss2int-64.asm \
@@ -20,6 +20,7 @@
jccolss2-64.lo: jcclrss2-64.asm
jdcolss2-64.lo: jdclrss2-64.asm
+jcgrass2-64.lo: jcgryss2-64.asm
jdmerss2-64.lo: jdmrgss2-64.asm
endif
@@ -29,30 +30,38 @@
jsimd.h jsimdcfg.inc.h \
jsimdext.inc jcolsamp.inc jdct.inc \
jsimdcpu.asm \
- jccolmmx.asm jdcolmmx.asm \
+ jccolmmx.asm jdcolmmx.asm jcgrammx.asm \
jcsammmx.asm jdsammmx.asm jdmermmx.asm \
jcqntmmx.asm jfmmxfst.asm jfmmxint.asm \
jimmxred.asm jimmxint.asm jimmxfst.asm \
jcqnt3dn.asm jf3dnflt.asm ji3dnflt.asm \
jcqntsse.asm jfsseflt.asm jisseflt.asm \
- jccolss2.asm jdcolss2.asm \
+ jccolss2.asm jdcolss2.asm jcgrass2.asm \
jcsamss2.asm jdsamss2.asm jdmerss2.asm \
jcqnts2i.asm jfss2fst.asm jfss2int.asm \
jiss2red.asm jiss2int.asm jiss2fst.asm \
jcqnts2f.asm jiss2flt.asm
jccolmmx.lo: jcclrmmx.asm
+jcgrammx.lo: jcgrymmx.asm
jccolss2.lo: jcclrss2.asm
+jcgrass2.lo: jcgryss2.asm
jdcolmmx.lo: jdclrmmx.asm
jdcolss2.lo: jdclrss2.asm
jdmermmx.lo: jdmrgmmx.asm
jdmerss2.lo: jdmrgss2.asm
endif
+if SIMD_ARM
+
+libsimd_la_SOURCES = jsimd_arm.c jsimd_arm_neon.S
+
+endif
+
AM_CPPFLAGS = -I$(top_srcdir)
.asm.lo:
- $(LIBTOOL) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(NASM) $(NAFLAGS) -I$(srcdir) $< -o $@
+ $(LIBTOOL) --mode=compile --tag NASM $(srcdir)/nasm_lt.sh $(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' > $@
diff --git a/simd/jcclrmmx.asm b/simd/jcclrmmx.asm
index b6b8912..e095253 100644
--- a/simd/jcclrmmx.asm
+++ b/simd/jcclrmmx.asm
@@ -19,8 +19,6 @@
%include "jcolsamp.inc"
; --------------------------------------------------------------------------
- SECTION SEG_TEXT
- BITS 32
;
; Convert some rows of samples to the output colorspace.
;
diff --git a/simd/jcclrss2-64.asm b/simd/jcclrss2-64.asm
index 8ca47aa..f5d6bed 100644
--- a/simd/jcclrss2-64.asm
+++ b/simd/jcclrss2-64.asm
@@ -17,8 +17,6 @@
%include "jcolsamp.inc"
; --------------------------------------------------------------------------
- SECTION SEG_TEXT
- BITS 64
;
; Convert some rows of samples to the output colorspace.
;
diff --git a/simd/jcclrss2.asm b/simd/jcclrss2.asm
index 8def718..517b705 100644
--- a/simd/jcclrss2.asm
+++ b/simd/jcclrss2.asm
@@ -16,8 +16,6 @@
%include "jcolsamp.inc"
; --------------------------------------------------------------------------
- SECTION SEG_TEXT
- BITS 32
;
; Convert some rows of samples to the output colorspace.
;
diff --git a/simd/jccolmmx.asm b/simd/jccolmmx.asm
index 5e7f3be..9650e47 100644
--- a/simd/jccolmmx.asm
+++ b/simd/jccolmmx.asm
@@ -51,16 +51,19 @@
alignz 16
; --------------------------------------------------------------------------
+ SECTION SEG_TEXT
+ BITS 32
+
%include "jcclrmmx.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_RGB_RED
+%define RGB_GREEN EXT_RGB_GREEN
+%define RGB_BLUE EXT_RGB_BLUE
+%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_rgb_ycc_convert_mmx jsimd_extrgb_ycc_convert_mmx
%include "jcclrmmx.asm"
@@ -68,10 +71,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_RGBX_RED
+%define RGB_GREEN EXT_RGBX_GREEN
+%define RGB_BLUE EXT_RGBX_BLUE
+%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_rgb_ycc_convert_mmx jsimd_extrgbx_ycc_convert_mmx
%include "jcclrmmx.asm"
@@ -79,10 +82,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_BGR_RED
+%define RGB_GREEN EXT_BGR_GREEN
+%define RGB_BLUE EXT_BGR_BLUE
+%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_rgb_ycc_convert_mmx jsimd_extbgr_ycc_convert_mmx
%include "jcclrmmx.asm"
@@ -90,10 +93,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_BGRX_RED
+%define RGB_GREEN EXT_BGRX_GREEN
+%define RGB_BLUE EXT_BGRX_BLUE
+%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_rgb_ycc_convert_mmx jsimd_extbgrx_ycc_convert_mmx
%include "jcclrmmx.asm"
@@ -101,10 +104,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 3
-%define RGB_GREEN 2
-%define RGB_BLUE 1
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XBGR_RED
+%define RGB_GREEN EXT_XBGR_GREEN
+%define RGB_BLUE EXT_XBGR_BLUE
+%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_rgb_ycc_convert_mmx jsimd_extxbgr_ycc_convert_mmx
%include "jcclrmmx.asm"
@@ -112,9 +115,9 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 1
-%define RGB_GREEN 2
-%define RGB_BLUE 3
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XRGB_RED
+%define RGB_GREEN EXT_XRGB_GREEN
+%define RGB_BLUE EXT_XRGB_BLUE
+%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_rgb_ycc_convert_mmx jsimd_extxrgb_ycc_convert_mmx
%include "jcclrmmx.asm"
diff --git a/simd/jccolss2-64.asm b/simd/jccolss2-64.asm
index 64ee0ba..ae60148 100644
--- a/simd/jccolss2-64.asm
+++ b/simd/jccolss2-64.asm
@@ -48,16 +48,19 @@
alignz 16
; --------------------------------------------------------------------------
+ SECTION SEG_TEXT
+ BITS 64
+
%include "jcclrss2-64.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_RGB_RED
+%define RGB_GREEN EXT_RGB_GREEN
+%define RGB_BLUE EXT_RGB_BLUE
+%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extrgb_ycc_convert_sse2
%include "jcclrss2-64.asm"
@@ -65,10 +68,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_RGBX_RED
+%define RGB_GREEN EXT_RGBX_GREEN
+%define RGB_BLUE EXT_RGBX_BLUE
+%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extrgbx_ycc_convert_sse2
%include "jcclrss2-64.asm"
@@ -76,10 +79,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_BGR_RED
+%define RGB_GREEN EXT_BGR_GREEN
+%define RGB_BLUE EXT_BGR_BLUE
+%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extbgr_ycc_convert_sse2
%include "jcclrss2-64.asm"
@@ -87,10 +90,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_BGRX_RED
+%define RGB_GREEN EXT_BGRX_GREEN
+%define RGB_BLUE EXT_BGRX_BLUE
+%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extbgrx_ycc_convert_sse2
%include "jcclrss2-64.asm"
@@ -98,10 +101,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 3
-%define RGB_GREEN 2
-%define RGB_BLUE 1
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XBGR_RED
+%define RGB_GREEN EXT_XBGR_GREEN
+%define RGB_BLUE EXT_XBGR_BLUE
+%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extxbgr_ycc_convert_sse2
%include "jcclrss2-64.asm"
@@ -109,9 +112,9 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 1
-%define RGB_GREEN 2
-%define RGB_BLUE 3
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XRGB_RED
+%define RGB_GREEN EXT_XRGB_GREEN
+%define RGB_BLUE EXT_XRGB_BLUE
+%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extxrgb_ycc_convert_sse2
%include "jcclrss2-64.asm"
diff --git a/simd/jccolss2.asm b/simd/jccolss2.asm
index 8d1f734..ac001d1 100644
--- a/simd/jccolss2.asm
+++ b/simd/jccolss2.asm
@@ -48,16 +48,19 @@
alignz 16
; --------------------------------------------------------------------------
+ SECTION SEG_TEXT
+ BITS 32
+
%include "jcclrss2.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_RGB_RED
+%define RGB_GREEN EXT_RGB_GREEN
+%define RGB_BLUE EXT_RGB_BLUE
+%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extrgb_ycc_convert_sse2
%include "jcclrss2.asm"
@@ -65,10 +68,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_RGBX_RED
+%define RGB_GREEN EXT_RGBX_GREEN
+%define RGB_BLUE EXT_RGBX_BLUE
+%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extrgbx_ycc_convert_sse2
%include "jcclrss2.asm"
@@ -76,10 +79,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_BGR_RED
+%define RGB_GREEN EXT_BGR_GREEN
+%define RGB_BLUE EXT_BGR_BLUE
+%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extbgr_ycc_convert_sse2
%include "jcclrss2.asm"
@@ -87,10 +90,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_BGRX_RED
+%define RGB_GREEN EXT_BGRX_GREEN
+%define RGB_BLUE EXT_BGRX_BLUE
+%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extbgrx_ycc_convert_sse2
%include "jcclrss2.asm"
@@ -98,10 +101,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 3
-%define RGB_GREEN 2
-%define RGB_BLUE 1
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XBGR_RED
+%define RGB_GREEN EXT_XBGR_GREEN
+%define RGB_BLUE EXT_XBGR_BLUE
+%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extxbgr_ycc_convert_sse2
%include "jcclrss2.asm"
@@ -109,9 +112,9 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 1
-%define RGB_GREEN 2
-%define RGB_BLUE 3
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XRGB_RED
+%define RGB_GREEN EXT_XRGB_GREEN
+%define RGB_BLUE EXT_XRGB_BLUE
+%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_rgb_ycc_convert_sse2 jsimd_extxrgb_ycc_convert_sse2
%include "jcclrss2.asm"
diff --git a/simd/jcgrammx.asm b/simd/jcgrammx.asm
new file mode 100644
index 0000000..b8b8dd3
--- /dev/null
+++ b/simd/jcgrammx.asm
@@ -0,0 +1,116 @@
+;
+; jcgrammx.asm - grayscale colorspace conversion (MMX)
+;
+; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
+; Copyright 2011 D. R. Commander
+;
+; Based on
+; x86 SIMD extension for IJG JPEG library
+; Copyright (C) 1999-2006, MIYASAKA Masaru.
+; For conditions of distribution and use, see copyright notice in jsimdext.inc
+;
+; This file should be assembled with NASM (Netwide Assembler),
+; 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/project/showfiles.php?group_id=6208
+;
+; [TAB8]
+
+%include "jsimdext.inc"
+
+; --------------------------------------------------------------------------
+
+%define SCALEBITS 16
+
+F_0_114 equ 7471 ; FIX(0.11400)
+F_0_250 equ 16384 ; FIX(0.25000)
+F_0_299 equ 19595 ; FIX(0.29900)
+F_0_587 equ 38470 ; FIX(0.58700)
+F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000)
+
+; --------------------------------------------------------------------------
+ SECTION SEG_CONST
+
+ alignz 16
+ global EXTN(jconst_rgb_gray_convert_mmx)
+
+EXTN(jconst_rgb_gray_convert_mmx):
+
+PW_F0299_F0337 times 2 dw F_0_299, F_0_337
+PW_F0114_F0250 times 2 dw F_0_114, F_0_250
+PD_ONEHALF times 2 dd (1 << (SCALEBITS-1))
+
+ alignz 16
+
+; --------------------------------------------------------------------------
+ SECTION SEG_TEXT
+ BITS 32
+
+%include "jcgrymmx.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_RGB_RED
+%define RGB_GREEN EXT_RGB_GREEN
+%define RGB_BLUE EXT_RGB_BLUE
+%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
+%define jsimd_rgb_gray_convert_mmx jsimd_extrgb_gray_convert_mmx
+%include "jcgrymmx.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_RGBX_RED
+%define RGB_GREEN EXT_RGBX_GREEN
+%define RGB_BLUE EXT_RGBX_BLUE
+%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
+%define jsimd_rgb_gray_convert_mmx jsimd_extrgbx_gray_convert_mmx
+%include "jcgrymmx.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_BGR_RED
+%define RGB_GREEN EXT_BGR_GREEN
+%define RGB_BLUE EXT_BGR_BLUE
+%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
+%define jsimd_rgb_gray_convert_mmx jsimd_extbgr_gray_convert_mmx
+%include "jcgrymmx.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_BGRX_RED
+%define RGB_GREEN EXT_BGRX_GREEN
+%define RGB_BLUE EXT_BGRX_BLUE
+%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
+%define jsimd_rgb_gray_convert_mmx jsimd_extbgrx_gray_convert_mmx
+%include "jcgrymmx.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_XBGR_RED
+%define RGB_GREEN EXT_XBGR_GREEN
+%define RGB_BLUE EXT_XBGR_BLUE
+%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
+%define jsimd_rgb_gray_convert_mmx jsimd_extxbgr_gray_convert_mmx
+%include "jcgrymmx.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_XRGB_RED
+%define RGB_GREEN EXT_XRGB_GREEN
+%define RGB_BLUE EXT_XRGB_BLUE
+%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
+%define jsimd_rgb_gray_convert_mmx jsimd_extxrgb_gray_convert_mmx
+%include "jcgrymmx.asm"
diff --git a/simd/jcgrass2-64.asm b/simd/jcgrass2-64.asm
new file mode 100644
index 0000000..ba28cc3
--- /dev/null
+++ b/simd/jcgrass2-64.asm
@@ -0,0 +1,113 @@
+;
+; jcgrass2-64.asm - grayscale colorspace conversion (64-bit SSE2)
+;
+; x86 SIMD extension for IJG JPEG library
+; Copyright (C) 1999-2006, MIYASAKA Masaru.
+; Copyright (C) 2011, D. R. Commander.
+; For conditions of distribution and use, see copyright notice in jsimdext.inc
+;
+; This file should be assembled with NASM (Netwide Assembler),
+; 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/project/showfiles.php?group_id=6208
+;
+; [TAB8]
+
+%include "jsimdext.inc"
+
+; --------------------------------------------------------------------------
+
+%define SCALEBITS 16
+
+F_0_114 equ 7471 ; FIX(0.11400)
+F_0_250 equ 16384 ; FIX(0.25000)
+F_0_299 equ 19595 ; FIX(0.29900)
+F_0_587 equ 38470 ; FIX(0.58700)
+F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000)
+
+; --------------------------------------------------------------------------
+ SECTION SEG_CONST
+
+ alignz 16
+ global EXTN(jconst_rgb_gray_convert_sse2)
+
+EXTN(jconst_rgb_gray_convert_sse2):
+
+PW_F0299_F0337 times 4 dw F_0_299, F_0_337
+PW_F0114_F0250 times 4 dw F_0_114, F_0_250
+PD_ONEHALF times 4 dd (1 << (SCALEBITS-1))
+
+ alignz 16
+
+; --------------------------------------------------------------------------
+ SECTION SEG_TEXT
+ BITS 64
+
+%include "jcgryss2-64.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_RGB_RED
+%define RGB_GREEN EXT_RGB_GREEN
+%define RGB_BLUE EXT_RGB_BLUE
+%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
+%define jsimd_rgb_gray_convert_sse2 jsimd_extrgb_gray_convert_sse2
+%include "jcgryss2-64.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_RGBX_RED
+%define RGB_GREEN EXT_RGBX_GREEN
+%define RGB_BLUE EXT_RGBX_BLUE
+%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
+%define jsimd_rgb_gray_convert_sse2 jsimd_extrgbx_gray_convert_sse2
+%include "jcgryss2-64.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_BGR_RED
+%define RGB_GREEN EXT_BGR_GREEN
+%define RGB_BLUE EXT_BGR_BLUE
+%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
+%define jsimd_rgb_gray_convert_sse2 jsimd_extbgr_gray_convert_sse2
+%include "jcgryss2-64.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_BGRX_RED
+%define RGB_GREEN EXT_BGRX_GREEN
+%define RGB_BLUE EXT_BGRX_BLUE
+%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
+%define jsimd_rgb_gray_convert_sse2 jsimd_extbgrx_gray_convert_sse2
+%include "jcgryss2-64.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_XBGR_RED
+%define RGB_GREEN EXT_XBGR_GREEN
+%define RGB_BLUE EXT_XBGR_BLUE
+%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
+%define jsimd_rgb_gray_convert_sse2 jsimd_extxbgr_gray_convert_sse2
+%include "jcgryss2-64.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_XRGB_RED
+%define RGB_GREEN EXT_XRGB_GREEN
+%define RGB_BLUE EXT_XRGB_BLUE
+%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
+%define jsimd_rgb_gray_convert_sse2 jsimd_extxrgb_gray_convert_sse2
+%include "jcgryss2-64.asm"
diff --git a/simd/jcgrass2.asm b/simd/jcgrass2.asm
new file mode 100644
index 0000000..998968e
--- /dev/null
+++ b/simd/jcgrass2.asm
@@ -0,0 +1,113 @@
+;
+; jcgrass2.asm - grayscale colorspace conversion (SSE2)
+;
+; x86 SIMD extension for IJG JPEG library
+; Copyright (C) 1999-2006, MIYASAKA Masaru.
+; Copyright (C) 2011, D. R. Commander.
+; For conditions of distribution and use, see copyright notice in jsimdext.inc
+;
+; This file should be assembled with NASM (Netwide Assembler),
+; 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/project/showfiles.php?group_id=6208
+;
+; [TAB8]
+
+%include "jsimdext.inc"
+
+; --------------------------------------------------------------------------
+
+%define SCALEBITS 16
+
+F_0_114 equ 7471 ; FIX(0.11400)
+F_0_250 equ 16384 ; FIX(0.25000)
+F_0_299 equ 19595 ; FIX(0.29900)
+F_0_587 equ 38470 ; FIX(0.58700)
+F_0_337 equ (F_0_587 - F_0_250) ; FIX(0.58700) - FIX(0.25000)
+
+; --------------------------------------------------------------------------
+ SECTION SEG_CONST
+
+ alignz 16
+ global EXTN(jconst_rgb_gray_convert_sse2)
+
+EXTN(jconst_rgb_gray_convert_sse2):
+
+PW_F0299_F0337 times 4 dw F_0_299, F_0_337
+PW_F0114_F0250 times 4 dw F_0_114, F_0_250
+PD_ONEHALF times 4 dd (1 << (SCALEBITS-1))
+
+ alignz 16
+
+; --------------------------------------------------------------------------
+ SECTION SEG_TEXT
+ BITS 32
+
+%include "jcgryss2.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_RGB_RED
+%define RGB_GREEN EXT_RGB_GREEN
+%define RGB_BLUE EXT_RGB_BLUE
+%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
+%define jsimd_rgb_gray_convert_sse2 jsimd_extrgb_gray_convert_sse2
+%include "jcgryss2.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_RGBX_RED
+%define RGB_GREEN EXT_RGBX_GREEN
+%define RGB_BLUE EXT_RGBX_BLUE
+%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
+%define jsimd_rgb_gray_convert_sse2 jsimd_extrgbx_gray_convert_sse2
+%include "jcgryss2.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_BGR_RED
+%define RGB_GREEN EXT_BGR_GREEN
+%define RGB_BLUE EXT_BGR_BLUE
+%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
+%define jsimd_rgb_gray_convert_sse2 jsimd_extbgr_gray_convert_sse2
+%include "jcgryss2.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_BGRX_RED
+%define RGB_GREEN EXT_BGRX_GREEN
+%define RGB_BLUE EXT_BGRX_BLUE
+%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
+%define jsimd_rgb_gray_convert_sse2 jsimd_extbgrx_gray_convert_sse2
+%include "jcgryss2.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_XBGR_RED
+%define RGB_GREEN EXT_XBGR_GREEN
+%define RGB_BLUE EXT_XBGR_BLUE
+%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
+%define jsimd_rgb_gray_convert_sse2 jsimd_extxbgr_gray_convert_sse2
+%include "jcgryss2.asm"
+
+%undef RGB_RED
+%undef RGB_GREEN
+%undef RGB_BLUE
+%undef RGB_PIXELSIZE
+%define RGB_RED EXT_XRGB_RED
+%define RGB_GREEN EXT_XRGB_GREEN
+%define RGB_BLUE EXT_XRGB_BLUE
+%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
+%define jsimd_rgb_gray_convert_sse2 jsimd_extxrgb_gray_convert_sse2
+%include "jcgryss2.asm"
diff --git a/simd/jcgrymmx.asm b/simd/jcgrymmx.asm
new file mode 100644
index 0000000..bbeea09
--- /dev/null
+++ b/simd/jcgrymmx.asm
@@ -0,0 +1,357 @@
+;
+; jcgrymmx.asm - grayscale colorspace conversion (MMX)
+;
+; Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
+; Copyright 2011 D. R. Commander
+;
+; Based on
+; x86 SIMD extension for IJG JPEG library
+; Copyright (C) 1999-2006, MIYASAKA Masaru.
+; For conditions of distribution and use, see copyright notice in jsimdext.inc
+;
+; This file should be assembled with NASM (Netwide Assembler),
+; 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/project/showfiles.php?group_id=6208
+;
+; [TAB8]
+
+%include "jcolsamp.inc"
+
+; --------------------------------------------------------------------------
+;
+; Convert some rows of samples to the output colorspace.
+;
+; GLOBAL(void)
+; jsimd_rgb_gray_convert_mmx (JDIMENSION img_width,
+; JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+; JDIMENSION output_row, int num_rows);
+;
+
+%define img_width(b) (b)+8 ; JDIMENSION img_width
+%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf
+%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf
+%define output_row(b) (b)+20 ; JDIMENSION output_row
+%define num_rows(b) (b)+24 ; int num_rows
+
+%define original_ebp ebp+0
+%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_MMWORD ; mmword wk[WK_NUM]
+%define WK_NUM 2
+%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr
+
+ align 16
+ global EXTN(jsimd_rgb_gray_convert_mmx)
+
+EXTN(jsimd_rgb_gray_convert_mmx):
+ push ebp
+ mov eax,esp ; eax = original ebp
+ sub esp, byte 4
+ and esp, byte (-SIZEOF_MMWORD) ; align to 64 bits
+ mov [esp],eax
+ mov ebp,esp ; ebp = aligned ebp
+ lea esp, [wk(0)]
+ pushpic eax ; make a room for GOT address
+ push ebx
+; push ecx ; need not be preserved
+; push edx ; need not be preserved
+ push esi
+ push edi
+
+ get_GOT ebx ; get GOT address
+ movpic POINTER [gotptr], ebx ; save GOT address
+
+ mov ecx, JDIMENSION [img_width(eax)] ; num_cols
+ test ecx,ecx
+ jz near .return
+
+ push ecx
+
+ mov esi, JSAMPIMAGE [output_buf(eax)]
+ mov ecx, JDIMENSION [output_row(eax)]
+ mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY]
+ lea edi, [edi+ecx*SIZEOF_JSAMPROW]
+
+ pop ecx
+
+ mov esi, JSAMPARRAY [input_buf(eax)]
+ mov eax, INT [num_rows(eax)]
+ test eax,eax
+ jle near .return
+ alignx 16,7
+.rowloop:
+ pushpic eax
+ push edi
+ push esi
+ push ecx ; col
+
+ mov esi, JSAMPROW [esi] ; inptr
+ mov edi, JSAMPROW [edi] ; outptr0
+ movpic eax, POINTER [gotptr] ; load GOT address (eax)
+
+ cmp ecx, byte SIZEOF_MMWORD
+ jae short .columnloop
+ alignx 16,7
+
+%if RGB_PIXELSIZE == 3 ; ---------------
+
+.column_ld1:
+ push eax
+ push edx
+ lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE
+ test cl, SIZEOF_BYTE
+ jz short .column_ld2
+ sub ecx, byte SIZEOF_BYTE
+ xor eax,eax
+ mov al, BYTE [esi+ecx]
+.column_ld2:
+ test cl, SIZEOF_WORD
+ jz short .column_ld4
+ sub ecx, byte SIZEOF_WORD
+ xor edx,edx
+ mov dx, WORD [esi+ecx]
+ shl eax, WORD_BIT
+ or eax,edx
+.column_ld4:
+ movd mmA,eax
+ pop edx
+ pop eax
+ test cl, SIZEOF_DWORD
+ jz short .column_ld8
+ sub ecx, byte SIZEOF_DWORD
+ movd mmG, DWORD [esi+ecx]
+ psllq mmA, DWORD_BIT
+ por mmA,mmG
+.column_ld8:
+ test cl, SIZEOF_MMWORD
+ jz short .column_ld16
+ movq mmG,mmA
+ movq mmA, MMWORD [esi+0*SIZEOF_MMWORD]
+ mov ecx, SIZEOF_MMWORD
+ jmp short .rgb_gray_cnv
+.column_ld16:
+ test cl, 2*SIZEOF_MMWORD
+ mov ecx, SIZEOF_MMWORD
+ jz short .rgb_gray_cnv
+ movq mmF,mmA
+ movq mmA, MMWORD [esi+0*SIZEOF_MMWORD]
+ movq mmG, MMWORD [esi+1*SIZEOF_MMWORD]
+ jmp short .rgb_gray_cnv
+ alignx 16,7
+
+.columnloop:
+ movq mmA, MMWORD [esi+0*SIZEOF_MMWORD]
+ movq mmG, MMWORD [esi+1*SIZEOF_MMWORD]
+ movq mmF, MMWORD [esi+2*SIZEOF_MMWORD]
+
+.rgb_gray_cnv:
+ ; mmA=(00 10 20 01 11 21 02 12)
+ ; mmG=(22 03 13 23 04 14 24 05)
+ ; mmF=(15 25 06 16 26 07 17 27)
+
+ movq mmD,mmA
+ psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 10 20 01)
+ psrlq mmD,4*BYTE_BIT ; mmD=(11 21 02 12 -- -- -- --)
+
+ punpckhbw mmA,mmG ; mmA=(00 04 10 14 20 24 01 05)
+ psllq mmG,4*BYTE_BIT ; mmG=(-- -- -- -- 22 03 13 23)
+
+ punpcklbw mmD,mmF ; mmD=(11 15 21 25 02 06 12 16)
+ punpckhbw mmG,mmF ; mmG=(22 26 03 07 13 17 23 27)
+
+ movq mmE,mmA
+ psllq mmA,4*BYTE_BIT ; mmA=(-- -- -- -- 00 04 10 14)
+ psrlq mmE,4*BYTE_BIT ; mmE=(20 24 01 05 -- -- -- --)
+
+ punpckhbw mmA,mmD ; mmA=(00 02 04 06 10 12 14 16)
+ psllq mmD,4*BYTE_BIT ; mmD=(-- -- -- -- 11 15 21 25)
+
+ punpcklbw mmE,mmG ; mmE=(20 22 24 26 01 03 05 07)
+ punpckhbw mmD,mmG ; mmD=(11 13 15 17 21 23 25 27)
+
+ pxor mmH,mmH
+
+ movq mmC,mmA
+ punpcklbw mmA,mmH ; mmA=(00 02 04 06)
+ punpckhbw mmC,mmH ; mmC=(10 12 14 16)
+
+ movq mmB,mmE
+ punpcklbw mmE,mmH ; mmE=(20 22 24 26)
+ punpckhbw mmB,mmH ; mmB=(01 03 05 07)
+
+ movq mmF,mmD
+ punpcklbw mmD,mmH ; mmD=(11 13 15 17)
+ punpckhbw mmF,mmH ; mmF=(21 23 25 27)
+
+%else ; RGB_PIXELSIZE == 4 ; -----------
+
+.column_ld1:
+ test cl, SIZEOF_MMWORD/8
+ jz short .column_ld2
+ sub ecx, byte SIZEOF_MMWORD/8
+ movd mmA, DWORD [esi+ecx*RGB_PIXELSIZE]
+.column_ld2:
+ test cl, SIZEOF_MMWORD/4
+ jz short .column_ld4
+ sub ecx, byte SIZEOF_MMWORD/4
+ movq mmF,mmA
+ movq mmA, MMWORD [esi+ecx*RGB_PIXELSIZE]
+.column_ld4:
+ test cl, SIZEOF_MMWORD/2
+ mov ecx, SIZEOF_MMWORD
+ jz short .rgb_gray_cnv
+ movq mmD,mmA
+ movq mmC,mmF
+ movq mmA, MMWORD [esi+0*SIZEOF_MMWORD]
+ movq mmF, MMWORD [esi+1*SIZEOF_MMWORD]
+ jmp short .rgb_gray_cnv
+ alignx 16,7
+
+.columnloop:
+ movq mmA, MMWORD [esi+0*SIZEOF_MMWORD]
+ movq mmF, MMWORD [esi+1*SIZEOF_MMWORD]
+ movq mmD, MMWORD [esi+2*SIZEOF_MMWORD]
+ movq mmC, MMWORD [esi+3*SIZEOF_MMWORD]
+
+.rgb_gray_cnv:
+ ; mmA=(00 10 20 30 01 11 21 31)
+ ; mmF=(02 12 22 32 03 13 23 33)
+ ; mmD=(04 14 24 34 05 15 25 35)
+ ; mmC=(06 16 26 36 07 17 27 37)
+
+ movq mmB,mmA
+ punpcklbw mmA,mmF ; mmA=(00 02 10 12 20 22 30 32)
+ punpckhbw mmB,mmF ; mmB=(01 03 11 13 21 23 31 33)
+
+ movq mmG,mmD
+ punpcklbw mmD,mmC ; mmD=(04 06 14 16 24 26 34 36)
+ punpckhbw mmG,mmC ; mmG=(05 07 15 17 25 27 35 37)
+
+ movq mmE,mmA
+ punpcklwd mmA,mmD ; mmA=(00 02 04 06 10 12 14 16)
+ punpckhwd mmE,mmD ; mmE=(20 22 24 26 30 32 34 36)
+
+ movq mmH,mmB
+ punpcklwd mmB,mmG ; mmB=(01 03 05 07 11 13 15 17)
+ punpckhwd mmH,mmG ; mmH=(21 23 25 27 31 33 35 37)
+
+ pxor mmF,mmF
+
+ movq mmC,mmA
+ punpcklbw mmA,mmF ; mmA=(00 02 04 06)
+ punpckhbw mmC,mmF ; mmC=(10 12 14 16)
+
+ movq mmD,mmB
+ punpcklbw mmB,mmF ; mmB=(01 03 05 07)
+ punpckhbw mmD,mmF ; mmD=(11 13 15 17)
+
+ movq mmG,mmE
+ punpcklbw mmE,mmF ; mmE=(20 22 24 26)
+ punpckhbw mmG,mmF ; mmG=(30 32 34 36)
+
+ punpcklbw mmF,mmH
+ punpckhbw mmH,mmH
+ psrlw mmF,BYTE_BIT ; mmF=(21 23 25 27)
+ psrlw mmH,BYTE_BIT ; mmH=(31 33 35 37)
+
+%endif ; RGB_PIXELSIZE ; ---------------
+
+ ; mm0=(R0 R2 R4 R6)=RE, mm2=(G0 G2 G4 G6)=GE, mm4=(B0 B2 B4 B6)=BE
+ ; mm1=(R1 R3 R5 R7)=RO, mm3=(G1 G3 G5 G7)=GO, mm5=(B1 B3 B5 B7)=BO
+
+ ; (Original)
+ ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B
+ ;
+ ; (This implementation)
+ ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G
+
+ movq mm6,mm1
+ punpcklwd mm1,mm3
+ punpckhwd mm6,mm3
+ pmaddwd mm1,[GOTOFF(eax,PW_F0299_F0337)] ; mm1=ROL*FIX(0.299)+GOL*FIX(0.337)
+ pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=ROH*FIX(0.299)+GOH*FIX(0.337)
+
+ movq mm7, mm6 ; mm7=ROH*FIX(0.299)+GOH*FIX(0.337)
+
+ movq mm6,mm0
+ punpcklwd mm0,mm2
+ punpckhwd mm6,mm2
+ pmaddwd mm0,[GOTOFF(eax,PW_F0299_F0337)] ; mm0=REL*FIX(0.299)+GEL*FIX(0.337)
+ pmaddwd mm6,[GOTOFF(eax,PW_F0299_F0337)] ; mm6=REH*FIX(0.299)+GEH*FIX(0.337)
+
+ movq MMWORD [wk(0)], mm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337)
+ movq MMWORD [wk(1)], mm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337)
+
+ movq mm0, mm5 ; mm0=BO
+ movq mm6, mm4 ; mm6=BE
+
+ movq mm4,mm0
+ punpcklwd mm0,mm3
+ punpckhwd mm4,mm3
+ pmaddwd mm0,[GOTOFF(eax,PW_F0114_F0250)] ; mm0=BOL*FIX(0.114)+GOL*FIX(0.250)
+ pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BOH*FIX(0.114)+GOH*FIX(0.250)
+
+ movq mm3,[GOTOFF(eax,PD_ONEHALF)] ; mm3=[PD_ONEHALF]
+
+ paddd mm0, mm1
+ paddd mm4, mm7
+ paddd mm0,mm3
+ paddd mm4,mm3
+ psrld mm0,SCALEBITS ; mm0=YOL
+ psrld mm4,SCALEBITS ; mm4=YOH
+ packssdw mm0,mm4 ; mm0=YO
+
+ movq mm4,mm6
+ punpcklwd mm6,mm2
+ punpckhwd mm4,mm2
+ pmaddwd mm6,[GOTOFF(eax,PW_F0114_F0250)] ; mm6=BEL*FIX(0.114)+GEL*FIX(0.250)
+ pmaddwd mm4,[GOTOFF(eax,PW_F0114_F0250)] ; mm4=BEH*FIX(0.114)+GEH*FIX(0.250)
+
+ movq mm2,[GOTOFF(eax,PD_ONEHALF)] ; mm2=[PD_ONEHALF]
+
+ paddd mm6, MMWORD [wk(0)]
+ paddd mm4, MMWORD [wk(1)]
+ paddd mm6,mm2
+ paddd mm4,mm2
+ psrld mm6,SCALEBITS ; mm6=YEL
+ psrld mm4,SCALEBITS ; mm4=YEH
+ packssdw mm6,mm4 ; mm6=YE
+
+ psllw mm0,BYTE_BIT
+ por mm6,mm0 ; mm6=Y
+ movq MMWORD [edi], mm6 ; Save Y
+
+ sub ecx, byte SIZEOF_MMWORD
+ add esi, byte RGB_PIXELSIZE*SIZEOF_MMWORD ; inptr
+ add edi, byte SIZEOF_MMWORD ; outptr0
+ cmp ecx, byte SIZEOF_MMWORD
+ jae near .columnloop
+ test ecx,ecx
+ jnz near .column_ld1
+
+ pop ecx ; col
+ pop esi
+ pop edi
+ poppic eax
+
+ add esi, byte SIZEOF_JSAMPROW ; input_buf
+ add edi, byte SIZEOF_JSAMPROW
+ dec eax ; num_rows
+ jg near .rowloop
+
+ emms ; empty MMX state
+
+.return:
+ pop edi
+ pop esi
+; pop edx ; need not be preserved
+; pop ecx ; need not be preserved
+ pop ebx
+ mov esp,ebp ; esp <- aligned ebp
+ pop esp ; esp <- original ebp
+ pop ebp
+ ret
+
+; For some reason, the OS X linker does not honor the request to align the
+; segment unless we do this.
+ align 16
diff --git a/simd/jcgryss2-64.asm b/simd/jcgryss2-64.asm
new file mode 100644
index 0000000..23ae8af
--- /dev/null
+++ b/simd/jcgryss2-64.asm
@@ -0,0 +1,364 @@
+;
+; jcgryss2-64.asm - grayscale colorspace conversion (64-bit SSE2)
+;
+; x86 SIMD extension for IJG JPEG library
+; Copyright (C) 1999-2006, MIYASAKA Masaru.
+; Copyright (C) 2011, D. R. Commander.
+; For conditions of distribution and use, see copyright notice in jsimdext.inc
+;
+; This file should be assembled with NASM (Netwide Assembler),
+; 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/project/showfiles.php?group_id=6208
+;
+; [TAB8]
+
+%include "jcolsamp.inc"
+
+; --------------------------------------------------------------------------
+;
+; Convert some rows of samples to the output colorspace.
+;
+; GLOBAL(void)
+; jsimd_rgb_gray_convert_sse2 (JDIMENSION img_width,
+; JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+; JDIMENSION output_row, int num_rows);
+;
+
+; r10 = JDIMENSION img_width
+; r11 = JSAMPARRAY input_buf
+; r12 = JSAMPIMAGE output_buf
+; r13 = JDIMENSION output_row
+; r14 = int num_rows
+
+%define wk(i) rbp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM]
+%define WK_NUM 2
+
+ align 16
+
+ global EXTN(jsimd_rgb_gray_convert_sse2)
+
+EXTN(jsimd_rgb_gray_convert_sse2):
+ push rbp
+ mov rax,rsp ; rax = original rbp
+ sub rsp, byte 4
+ and rsp, byte (-SIZEOF_XMMWORD) ; align to 128 bits
+ mov [rsp],rax
+ mov rbp,rsp ; rbp = aligned rbp
+ lea rsp, [wk(0)]
+ collect_args
+ push rbx
+
+ mov rcx, r10
+ test rcx,rcx
+ jz near .return
+
+ push rcx
+
+ mov rsi, r12
+ mov rcx, r13
+ mov rdi, JSAMPARRAY [rsi+0*SIZEOF_JSAMPARRAY]
+ lea rdi, [rdi+rcx*SIZEOF_JSAMPROW]
+
+ pop rcx
+
+ mov rsi, r11
+ mov eax, r14d
+ test rax,rax
+ jle near .return
+.rowloop:
+ push rdi
+ push rsi
+ push rcx ; col
+
+ mov rsi, JSAMPROW [rsi] ; inptr
+ mov rdi, JSAMPROW [rdi] ; outptr0
+
+ cmp rcx, byte SIZEOF_XMMWORD
+ jae near .columnloop
+
+%if RGB_PIXELSIZE == 3 ; ---------------
+
+.column_ld1:
+ push rax
+ push rdx
+ lea rcx,[rcx+rcx*2] ; imul ecx,RGB_PIXELSIZE
+ test cl, SIZEOF_BYTE
+ jz short .column_ld2
+ sub rcx, byte SIZEOF_BYTE
+ movzx rax, BYTE [rsi+rcx]
+.column_ld2:
+ test cl, SIZEOF_WORD
+ jz short .column_ld4
+ sub rcx, byte SIZEOF_WORD
+ movzx rdx, WORD [rsi+rcx]
+ shl rax, WORD_BIT
+ or rax,rdx
+.column_ld4:
+ movd xmmA,eax
+ pop rdx
+ pop rax
+ test cl, SIZEOF_DWORD
+ jz short .column_ld8
+ sub rcx, byte SIZEOF_DWORD
+ movd xmmF, XMM_DWORD [rsi+rcx]
+ pslldq xmmA, SIZEOF_DWORD
+ por xmmA,xmmF
+.column_ld8:
+ test cl, SIZEOF_MMWORD
+ jz short .column_ld16
+ sub rcx, byte SIZEOF_MMWORD
+ movq xmmB, XMM_MMWORD [rsi+rcx]
+ pslldq xmmA, SIZEOF_MMWORD
+ por xmmA,xmmB
+.column_ld16:
+ test cl, SIZEOF_XMMWORD
+ jz short .column_ld32
+ movdqa xmmF,xmmA
+ movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD]
+ mov rcx, SIZEOF_XMMWORD
+ jmp short .rgb_gray_cnv
+.column_ld32:
+ test cl, 2*SIZEOF_XMMWORD
+ mov rcx, SIZEOF_XMMWORD
+ jz short .rgb_gray_cnv
+ movdqa xmmB,xmmA
+ movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD]
+ movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD]
+ jmp short .rgb_gray_cnv
+
+.columnloop:
+ movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD]
+ movdqu xmmF, XMMWORD [rsi+1*SIZEOF_XMMWORD]
+ movdqu xmmB, XMMWORD [rsi+2*SIZEOF_XMMWORD]
+
+.rgb_gray_cnv:
+ ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05)
+ ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A)
+ ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F)
+
+ movdqa xmmG,xmmA
+ pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12)
+ psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --)
+
+ punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A)
+ pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27)
+
+ punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D)
+ punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F)
+
+ movdqa xmmD,xmmA
+ pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09)
+ psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --)
+
+ punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D)
+ pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B)
+
+ punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E)
+ punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F)
+
+ movdqa xmmE,xmmA
+ pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C)
+ psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --)
+
+ punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E)
+ pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D)
+
+ punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F)
+ punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F)
+
+ pxor xmmH,xmmH
+
+ movdqa xmmC,xmmA
+ punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E)
+ punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E)
+
+ movdqa xmmB,xmmE
+ punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E)
+ punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F)
+
+ movdqa xmmF,xmmD
+ punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F)
+ punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F)
+
+%else ; RGB_PIXELSIZE == 4 ; -----------
+
+.column_ld1:
+ test cl, SIZEOF_XMMWORD/16
+ jz short .column_ld2
+ sub rcx, byte SIZEOF_XMMWORD/16
+ movd xmmA, XMM_DWORD [rsi+rcx*RGB_PIXELSIZE]
+.column_ld2:
+ test cl, SIZEOF_XMMWORD/8
+ jz short .column_ld4
+ sub rcx, byte SIZEOF_XMMWORD/8
+ movq xmmE, XMM_MMWORD [rsi+rcx*RGB_PIXELSIZE]
+ pslldq xmmA, SIZEOF_MMWORD
+ por xmmA,xmmE
+.column_ld4:
+ test cl, SIZEOF_XMMWORD/4
+ jz short .column_ld8
+ sub rcx, byte SIZEOF_XMMWORD/4
+ movdqa xmmE,xmmA
+ movdqu xmmA, XMMWORD [rsi+rcx*RGB_PIXELSIZE]
+.column_ld8:
+ test cl, SIZEOF_XMMWORD/2
+ mov rcx, SIZEOF_XMMWORD
+ jz short .rgb_gray_cnv
+ movdqa xmmF,xmmA
+ movdqa xmmH,xmmE
+ movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD]
+ movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD]
+ jmp short .rgb_gray_cnv
+
+.columnloop:
+ movdqu xmmA, XMMWORD [rsi+0*SIZEOF_XMMWORD]
+ movdqu xmmE, XMMWORD [rsi+1*SIZEOF_XMMWORD]
+ movdqu xmmF, XMMWORD [rsi+2*SIZEOF_XMMWORD]
+ movdqu xmmH, XMMWORD [rsi+3*SIZEOF_XMMWORD]
+
+.rgb_gray_cnv:
+ ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33)
+ ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37)
+ ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B)
+ ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F)
+
+ movdqa xmmD,xmmA
+ punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35)
+ punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37)
+
+ movdqa xmmC,xmmF
+ punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D)
+ punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F)
+
+ movdqa xmmB,xmmA
+ punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C)
+ punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D)
+
+ movdqa xmmG,xmmD
+ punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E)
+ punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F)
+
+ movdqa xmmE,xmmA
+ punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E)
+ punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E)
+
+ movdqa xmmH,xmmB
+ punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F)
+ punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F)
+
+ pxor xmmF,xmmF
+
+ movdqa xmmC,xmmA
+ punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E)
+ punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E)
+
+ movdqa xmmD,xmmB
+ punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F)
+ punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F)
+
+ movdqa xmmG,xmmE
+ punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E)
+ punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E)
+
+ punpcklbw xmmF,xmmH
+ punpckhbw xmmH,xmmH
+ psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F)
+ psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F)
+
+%endif ; RGB_PIXELSIZE ; ---------------
+
+ ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE
+ ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO
+
+ ; (Original)
+ ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B
+ ;
+ ; (This implementation)
+ ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G
+
+ movdqa xmm6,xmm1
+ punpcklwd xmm1,xmm3
+ punpckhwd xmm6,xmm3
+ pmaddwd xmm1,[rel PW_F0299_F0337] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337)
+ pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337)
+
+ movdqa xmm7, xmm6 ; xmm7=ROH*FIX(0.299)+GOH*FIX(0.337)
+
+ movdqa xmm6,xmm0
+ punpcklwd xmm0,xmm2
+ punpckhwd xmm6,xmm2
+ pmaddwd xmm0,[rel PW_F0299_F0337] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337)
+ pmaddwd xmm6,[rel PW_F0299_F0337] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337)
+
+ movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337)
+ movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337)
+
+ movdqa xmm0, xmm5 ; xmm0=BO
+ movdqa xmm6, xmm4 ; xmm6=BE
+
+ movdqa xmm4,xmm0
+ punpcklwd xmm0,xmm3
+ punpckhwd xmm4,xmm3
+ pmaddwd xmm0,[rel PW_F0114_F0250] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250)
+ pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250)
+
+ movdqa xmm3,[rel PD_ONEHALF] ; xmm3=[PD_ONEHALF]
+
+ paddd xmm0, xmm1
+ paddd xmm4, xmm7
+ paddd xmm0,xmm3
+ paddd xmm4,xmm3
+ psrld xmm0,SCALEBITS ; xmm0=YOL
+ psrld xmm4,SCALEBITS ; xmm4=YOH
+ packssdw xmm0,xmm4 ; xmm0=YO
+
+ movdqa xmm4,xmm6
+ punpcklwd xmm6,xmm2
+ punpckhwd xmm4,xmm2
+ pmaddwd xmm6,[rel PW_F0114_F0250] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250)
+ pmaddwd xmm4,[rel PW_F0114_F0250] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250)
+
+ movdqa xmm2,[rel PD_ONEHALF] ; xmm2=[PD_ONEHALF]
+
+ paddd xmm6, XMMWORD [wk(0)]
+ paddd xmm4, XMMWORD [wk(1)]
+ paddd xmm6,xmm2
+ paddd xmm4,xmm2
+ psrld xmm6,SCALEBITS ; xmm6=YEL
+ psrld xmm4,SCALEBITS ; xmm4=YEH
+ packssdw xmm6,xmm4 ; xmm6=YE
+
+ psllw xmm0,BYTE_BIT
+ por xmm6,xmm0 ; xmm6=Y
+ movdqa XMMWORD [rdi], xmm6 ; Save Y
+
+ sub rcx, byte SIZEOF_XMMWORD
+ add rsi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr
+ add rdi, byte SIZEOF_XMMWORD ; outptr0
+ cmp rcx, byte SIZEOF_XMMWORD
+ jae near .columnloop
+ test rcx,rcx
+ jnz near .column_ld1
+
+ pop rcx ; col
+ pop rsi
+ pop rdi
+
+ add rsi, byte SIZEOF_JSAMPROW ; input_buf
+ add rdi, byte SIZEOF_JSAMPROW
+ dec rax ; num_rows
+ jg near .rowloop
+
+.return:
+ pop rbx
+ uncollect_args
+ mov rsp,rbp ; rsp <- aligned rbp
+ pop rsp ; rsp <- original rbp
+ pop rbp
+ ret
+
+; For some reason, the OS X linker does not honor the request to align the
+; segment unless we do this.
+ align 16
diff --git a/simd/jcgryss2.asm b/simd/jcgryss2.asm
new file mode 100644
index 0000000..c294287
--- /dev/null
+++ b/simd/jcgryss2.asm
@@ -0,0 +1,383 @@
+;
+; jcgryss2.asm - grayscale colorspace conversion (SSE2)
+;
+; x86 SIMD extension for IJG JPEG library
+; Copyright (C) 1999-2006, MIYASAKA Masaru.
+; Copyright (C) 2011, D. R. Commander.
+; For conditions of distribution and use, see copyright notice in jsimdext.inc
+;
+; This file should be assembled with NASM (Netwide Assembler),
+; 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/project/showfiles.php?group_id=6208
+;
+; [TAB8]
+
+%include "jcolsamp.inc"
+
+; --------------------------------------------------------------------------
+;
+; Convert some rows of samples to the output colorspace.
+;
+; GLOBAL(void)
+; jsimd_rgb_gray_convert_sse2 (JDIMENSION img_width,
+; JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+; JDIMENSION output_row, int num_rows);
+;
+
+%define img_width(b) (b)+8 ; JDIMENSION img_width
+%define input_buf(b) (b)+12 ; JSAMPARRAY input_buf
+%define output_buf(b) (b)+16 ; JSAMPIMAGE output_buf
+%define output_row(b) (b)+20 ; JDIMENSION output_row
+%define num_rows(b) (b)+24 ; int num_rows
+
+%define original_ebp ebp+0
+%define wk(i) ebp-(WK_NUM-(i))*SIZEOF_XMMWORD ; xmmword wk[WK_NUM]
+%define WK_NUM 2
+%define gotptr wk(0)-SIZEOF_POINTER ; void * gotptr
+
+ align 16
+
+ global EXTN(jsimd_rgb_gray_convert_sse2)
+
+EXTN(jsimd_rgb_gray_convert_sse2):
+ push ebp
+ mov eax,esp ; eax = original ebp
+ sub esp, byte 4
+ and esp, byte (-SIZEOF_XMMWORD) ; align to 128 bits
+ mov [esp],eax
+ mov ebp,esp ; ebp = aligned ebp
+ lea esp, [wk(0)]
+ pushpic eax ; make a room for GOT address
+ push ebx
+; push ecx ; need not be preserved
+; push edx ; need not be preserved
+ push esi
+ push edi
+
+ get_GOT ebx ; get GOT address
+ movpic POINTER [gotptr], ebx ; save GOT address
+
+ mov ecx, JDIMENSION [img_width(eax)]
+ test ecx,ecx
+ jz near .return
+
+ push ecx
+
+ mov esi, JSAMPIMAGE [output_buf(eax)]
+ mov ecx, JDIMENSION [output_row(eax)]
+ mov edi, JSAMPARRAY [esi+0*SIZEOF_JSAMPARRAY]
+ lea edi, [edi+ecx*SIZEOF_JSAMPROW]
+
+ pop ecx
+
+ mov esi, JSAMPARRAY [input_buf(eax)]
+ mov eax, INT [num_rows(eax)]
+ test eax,eax
+ jle near .return
+ alignx 16,7
+.rowloop:
+ pushpic eax
+ push edi
+ push esi
+ push ecx ; col
+
+ mov esi, JSAMPROW [esi] ; inptr
+ mov edi, JSAMPROW [edi] ; outptr0
+ movpic eax, POINTER [gotptr] ; load GOT address (eax)
+
+ cmp ecx, byte SIZEOF_XMMWORD
+ jae near .columnloop
+ alignx 16,7
+
+%if RGB_PIXELSIZE == 3 ; ---------------
+
+.column_ld1:
+ push eax
+ push edx
+ lea ecx,[ecx+ecx*2] ; imul ecx,RGB_PIXELSIZE
+ test cl, SIZEOF_BYTE
+ jz short .column_ld2
+ sub ecx, byte SIZEOF_BYTE
+ movzx eax, BYTE [esi+ecx]
+.column_ld2:
+ test cl, SIZEOF_WORD
+ jz short .column_ld4
+ sub ecx, byte SIZEOF_WORD
+ movzx edx, WORD [esi+ecx]
+ shl eax, WORD_BIT
+ or eax,edx
+.column_ld4:
+ movd xmmA,eax
+ pop edx
+ pop eax
+ test cl, SIZEOF_DWORD
+ jz short .column_ld8
+ sub ecx, byte SIZEOF_DWORD
+ movd xmmF, XMM_DWORD [esi+ecx]
+ pslldq xmmA, SIZEOF_DWORD
+ por xmmA,xmmF
+.column_ld8:
+ test cl, SIZEOF_MMWORD
+ jz short .column_ld16
+ sub ecx, byte SIZEOF_MMWORD
+ movq xmmB, XMM_MMWORD [esi+ecx]
+ pslldq xmmA, SIZEOF_MMWORD
+ por xmmA,xmmB
+.column_ld16:
+ test cl, SIZEOF_XMMWORD
+ jz short .column_ld32
+ movdqa xmmF,xmmA
+ movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD]
+ mov ecx, SIZEOF_XMMWORD
+ jmp short .rgb_gray_cnv
+.column_ld32:
+ test cl, 2*SIZEOF_XMMWORD
+ mov ecx, SIZEOF_XMMWORD
+ jz short .rgb_gray_cnv
+ movdqa xmmB,xmmA
+ movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD]
+ movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD]
+ jmp short .rgb_gray_cnv
+ alignx 16,7
+
+.columnloop:
+ movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD]
+ movdqu xmmF, XMMWORD [esi+1*SIZEOF_XMMWORD]
+ movdqu xmmB, XMMWORD [esi+2*SIZEOF_XMMWORD]
+
+.rgb_gray_cnv:
+ ; xmmA=(00 10 20 01 11 21 02 12 22 03 13 23 04 14 24 05)
+ ; xmmF=(15 25 06 16 26 07 17 27 08 18 28 09 19 29 0A 1A)
+ ; xmmB=(2A 0B 1B 2B 0C 1C 2C 0D 1D 2D 0E 1E 2E 0F 1F 2F)
+
+ movdqa xmmG,xmmA
+ pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 10 20 01 11 21 02 12)
+ psrldq xmmG,8 ; xmmG=(22 03 13 23 04 14 24 05 -- -- -- -- -- -- -- --)
+
+ punpckhbw xmmA,xmmF ; xmmA=(00 08 10 18 20 28 01 09 11 19 21 29 02 0A 12 1A)
+ pslldq xmmF,8 ; xmmF=(-- -- -- -- -- -- -- -- 15 25 06 16 26 07 17 27)
+
+ punpcklbw xmmG,xmmB ; xmmG=(22 2A 03 0B 13 1B 23 2B 04 0C 14 1C 24 2C 05 0D)
+ punpckhbw xmmF,xmmB ; xmmF=(15 1D 25 2D 06 0E 16 1E 26 2E 07 0F 17 1F 27 2F)
+
+ movdqa xmmD,xmmA
+ pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 08 10 18 20 28 01 09)
+ psrldq xmmD,8 ; xmmD=(11 19 21 29 02 0A 12 1A -- -- -- -- -- -- -- --)
+
+ punpckhbw xmmA,xmmG ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 01 05 09 0D)
+ pslldq xmmG,8 ; xmmG=(-- -- -- -- -- -- -- -- 22 2A 03 0B 13 1B 23 2B)
+
+ punpcklbw xmmD,xmmF ; xmmD=(11 15 19 1D 21 25 29 2D 02 06 0A 0E 12 16 1A 1E)
+ punpckhbw xmmG,xmmF ; xmmG=(22 26 2A 2E 03 07 0B 0F 13 17 1B 1F 23 27 2B 2F)
+
+ movdqa xmmE,xmmA
+ pslldq xmmA,8 ; xmmA=(-- -- -- -- -- -- -- -- 00 04 08 0C 10 14 18 1C)
+ psrldq xmmE,8 ; xmmE=(20 24 28 2C 01 05 09 0D -- -- -- -- -- -- -- --)
+
+ punpckhbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E)
+ pslldq xmmD,8 ; xmmD=(-- -- -- -- -- -- -- -- 11 15 19 1D 21 25 29 2D)
+
+ punpcklbw xmmE,xmmG ; xmmE=(20 22 24 26 28 2A 2C 2E 01 03 05 07 09 0B 0D 0F)
+ punpckhbw xmmD,xmmG ; xmmD=(11 13 15 17 19 1B 1D 1F 21 23 25 27 29 2B 2D 2F)
+
+ pxor xmmH,xmmH
+
+ movdqa xmmC,xmmA
+ punpcklbw xmmA,xmmH ; xmmA=(00 02 04 06 08 0A 0C 0E)
+ punpckhbw xmmC,xmmH ; xmmC=(10 12 14 16 18 1A 1C 1E)
+
+ movdqa xmmB,xmmE
+ punpcklbw xmmE,xmmH ; xmmE=(20 22 24 26 28 2A 2C 2E)
+ punpckhbw xmmB,xmmH ; xmmB=(01 03 05 07 09 0B 0D 0F)
+
+ movdqa xmmF,xmmD
+ punpcklbw xmmD,xmmH ; xmmD=(11 13 15 17 19 1B 1D 1F)
+ punpckhbw xmmF,xmmH ; xmmF=(21 23 25 27 29 2B 2D 2F)
+
+%else ; RGB_PIXELSIZE == 4 ; -----------
+
+.column_ld1:
+ test cl, SIZEOF_XMMWORD/16
+ jz short .column_ld2
+ sub ecx, byte SIZEOF_XMMWORD/16
+ movd xmmA, XMM_DWORD [esi+ecx*RGB_PIXELSIZE]
+.column_ld2:
+ test cl, SIZEOF_XMMWORD/8
+ jz short .column_ld4
+ sub ecx, byte SIZEOF_XMMWORD/8
+ movq xmmE, XMM_MMWORD [esi+ecx*RGB_PIXELSIZE]
+ pslldq xmmA, SIZEOF_MMWORD
+ por xmmA,xmmE
+.column_ld4:
+ test cl, SIZEOF_XMMWORD/4
+ jz short .column_ld8
+ sub ecx, byte SIZEOF_XMMWORD/4
+ movdqa xmmE,xmmA
+ movdqu xmmA, XMMWORD [esi+ecx*RGB_PIXELSIZE]
+.column_ld8:
+ test cl, SIZEOF_XMMWORD/2
+ mov ecx, SIZEOF_XMMWORD
+ jz short .rgb_gray_cnv
+ movdqa xmmF,xmmA
+ movdqa xmmH,xmmE
+ movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD]
+ movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD]
+ jmp short .rgb_gray_cnv
+ alignx 16,7
+
+.columnloop:
+ movdqu xmmA, XMMWORD [esi+0*SIZEOF_XMMWORD]
+ movdqu xmmE, XMMWORD [esi+1*SIZEOF_XMMWORD]
+ movdqu xmmF, XMMWORD [esi+2*SIZEOF_XMMWORD]
+ movdqu xmmH, XMMWORD [esi+3*SIZEOF_XMMWORD]
+
+.rgb_gray_cnv:
+ ; xmmA=(00 10 20 30 01 11 21 31 02 12 22 32 03 13 23 33)
+ ; xmmE=(04 14 24 34 05 15 25 35 06 16 26 36 07 17 27 37)
+ ; xmmF=(08 18 28 38 09 19 29 39 0A 1A 2A 3A 0B 1B 2B 3B)
+ ; xmmH=(0C 1C 2C 3C 0D 1D 2D 3D 0E 1E 2E 3E 0F 1F 2F 3F)
+
+ movdqa xmmD,xmmA
+ punpcklbw xmmA,xmmE ; xmmA=(00 04 10 14 20 24 30 34 01 05 11 15 21 25 31 35)
+ punpckhbw xmmD,xmmE ; xmmD=(02 06 12 16 22 26 32 36 03 07 13 17 23 27 33 37)
+
+ movdqa xmmC,xmmF
+ punpcklbw xmmF,xmmH ; xmmF=(08 0C 18 1C 28 2C 38 3C 09 0D 19 1D 29 2D 39 3D)
+ punpckhbw xmmC,xmmH ; xmmC=(0A 0E 1A 1E 2A 2E 3A 3E 0B 0F 1B 1F 2B 2F 3B 3F)
+
+ movdqa xmmB,xmmA
+ punpcklwd xmmA,xmmF ; xmmA=(00 04 08 0C 10 14 18 1C 20 24 28 2C 30 34 38 3C)
+ punpckhwd xmmB,xmmF ; xmmB=(01 05 09 0D 11 15 19 1D 21 25 29 2D 31 35 39 3D)
+
+ movdqa xmmG,xmmD
+ punpcklwd xmmD,xmmC ; xmmD=(02 06 0A 0E 12 16 1A 1E 22 26 2A 2E 32 36 3A 3E)
+ punpckhwd xmmG,xmmC ; xmmG=(03 07 0B 0F 13 17 1B 1F 23 27 2B 2F 33 37 3B 3F)
+
+ movdqa xmmE,xmmA
+ punpcklbw xmmA,xmmD ; xmmA=(00 02 04 06 08 0A 0C 0E 10 12 14 16 18 1A 1C 1E)
+ punpckhbw xmmE,xmmD ; xmmE=(20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C 3E)
+
+ movdqa xmmH,xmmB
+ punpcklbw xmmB,xmmG ; xmmB=(01 03 05 07 09 0B 0D 0F 11 13 15 17 19 1B 1D 1F)
+ punpckhbw xmmH,xmmG ; xmmH=(21 23 25 27 29 2B 2D 2F 31 33 35 37 39 3B 3D 3F)
+
+ pxor xmmF,xmmF
+
+ movdqa xmmC,xmmA
+ punpcklbw xmmA,xmmF ; xmmA=(00 02 04 06 08 0A 0C 0E)
+ punpckhbw xmmC,xmmF ; xmmC=(10 12 14 16 18 1A 1C 1E)
+
+ movdqa xmmD,xmmB
+ punpcklbw xmmB,xmmF ; xmmB=(01 03 05 07 09 0B 0D 0F)
+ punpckhbw xmmD,xmmF ; xmmD=(11 13 15 17 19 1B 1D 1F)
+
+ movdqa xmmG,xmmE
+ punpcklbw xmmE,xmmF ; xmmE=(20 22 24 26 28 2A 2C 2E)
+ punpckhbw xmmG,xmmF ; xmmG=(30 32 34 36 38 3A 3C 3E)
+
+ punpcklbw xmmF,xmmH
+ punpckhbw xmmH,xmmH
+ psrlw xmmF,BYTE_BIT ; xmmF=(21 23 25 27 29 2B 2D 2F)
+ psrlw xmmH,BYTE_BIT ; xmmH=(31 33 35 37 39 3B 3D 3F)
+
+%endif ; RGB_PIXELSIZE ; ---------------
+
+ ; xmm0=R(02468ACE)=RE, xmm2=G(02468ACE)=GE, xmm4=B(02468ACE)=BE
+ ; xmm1=R(13579BDF)=RO, xmm3=G(13579BDF)=GO, xmm5=B(13579BDF)=BO
+
+ ; (Original)
+ ; Y = 0.29900 * R + 0.58700 * G + 0.11400 * B
+ ;
+ ; (This implementation)
+ ; Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G
+
+ movdqa xmm6,xmm1
+ punpcklwd xmm1,xmm3
+ punpckhwd xmm6,xmm3
+ pmaddwd xmm1,[GOTOFF(eax,PW_F0299_F0337)] ; xmm1=ROL*FIX(0.299)+GOL*FIX(0.337)
+ pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=ROH*FIX(0.299)+GOH*FIX(0.337)
+
+ movdqa xmm7, xmm6 ; xmm7=ROH*FIX(0.299)+GOH*FIX(0.337)
+
+ movdqa xmm6,xmm0
+ punpcklwd xmm0,xmm2
+ punpckhwd xmm6,xmm2
+ pmaddwd xmm0,[GOTOFF(eax,PW_F0299_F0337)] ; xmm0=REL*FIX(0.299)+GEL*FIX(0.337)
+ pmaddwd xmm6,[GOTOFF(eax,PW_F0299_F0337)] ; xmm6=REH*FIX(0.299)+GEH*FIX(0.337)
+
+ movdqa XMMWORD [wk(0)], xmm0 ; wk(0)=REL*FIX(0.299)+GEL*FIX(0.337)
+ movdqa XMMWORD [wk(1)], xmm6 ; wk(1)=REH*FIX(0.299)+GEH*FIX(0.337)
+
+ movdqa xmm0, xmm5 ; xmm0=BO
+ movdqa xmm6, xmm4 ; xmm6=BE
+
+ movdqa xmm4,xmm0
+ punpcklwd xmm0,xmm3
+ punpckhwd xmm4,xmm3
+ pmaddwd xmm0,[GOTOFF(eax,PW_F0114_F0250)] ; xmm0=BOL*FIX(0.114)+GOL*FIX(0.250)
+ pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BOH*FIX(0.114)+GOH*FIX(0.250)
+
+ movdqa xmm3,[GOTOFF(eax,PD_ONEHALF)] ; xmm3=[PD_ONEHALF]
+
+ paddd xmm0, xmm1
+ paddd xmm4, xmm7
+ paddd xmm0,xmm3
+ paddd xmm4,xmm3
+ psrld xmm0,SCALEBITS ; xmm0=YOL
+ psrld xmm4,SCALEBITS ; xmm4=YOH
+ packssdw xmm0,xmm4 ; xmm0=YO
+
+ movdqa xmm4,xmm6
+ punpcklwd xmm6,xmm2
+ punpckhwd xmm4,xmm2
+ pmaddwd xmm6,[GOTOFF(eax,PW_F0114_F0250)] ; xmm6=BEL*FIX(0.114)+GEL*FIX(0.250)
+ pmaddwd xmm4,[GOTOFF(eax,PW_F0114_F0250)] ; xmm4=BEH*FIX(0.114)+GEH*FIX(0.250)
+
+ movdqa xmm2,[GOTOFF(eax,PD_ONEHALF)] ; xmm2=[PD_ONEHALF]
+
+ paddd xmm6, XMMWORD [wk(0)]
+ paddd xmm4, XMMWORD [wk(1)]
+ paddd xmm6,xmm2
+ paddd xmm4,xmm2
+ psrld xmm6,SCALEBITS ; xmm6=YEL
+ psrld xmm4,SCALEBITS ; xmm4=YEH
+ packssdw xmm6,xmm4 ; xmm6=YE
+
+ psllw xmm0,BYTE_BIT
+ por xmm6,xmm0 ; xmm6=Y
+ movdqa XMMWORD [edi], xmm6 ; Save Y
+
+ sub ecx, byte SIZEOF_XMMWORD
+ add esi, byte RGB_PIXELSIZE*SIZEOF_XMMWORD ; inptr
+ add edi, byte SIZEOF_XMMWORD ; outptr0
+ cmp ecx, byte SIZEOF_XMMWORD
+ jae near .columnloop
+ test ecx,ecx
+ jnz near .column_ld1
+
+ pop ecx ; col
+ pop esi
+ pop edi
+ poppic eax
+
+ add esi, byte SIZEOF_JSAMPROW ; input_buf
+ add edi, byte SIZEOF_JSAMPROW
+ dec eax ; num_rows
+ jg near .rowloop
+
+.return:
+ pop edi
+ pop esi
+; pop edx ; need not be preserved
+; pop ecx ; need not be preserved
+ pop ebx
+ mov esp,ebp ; esp <- aligned ebp
+ pop esp ; esp <- original ebp
+ pop ebp
+ ret
+
+; For some reason, the OS X linker does not honor the request to align the
+; segment unless we do this.
+ align 16
diff --git a/simd/jdclrmmx.asm b/simd/jdclrmmx.asm
index 79772e0..1c255e8 100644
--- a/simd/jdclrmmx.asm
+++ b/simd/jdclrmmx.asm
@@ -19,8 +19,6 @@
%include "jcolsamp.inc"
; --------------------------------------------------------------------------
- SECTION SEG_TEXT
- BITS 32
;
; Convert some rows of samples to the output colorspace.
;
diff --git a/simd/jdclrss2-64.asm b/simd/jdclrss2-64.asm
index 0acf188..696a383 100644
--- a/simd/jdclrss2-64.asm
+++ b/simd/jdclrss2-64.asm
@@ -20,8 +20,6 @@
%include "jcolsamp.inc"
; --------------------------------------------------------------------------
- SECTION SEG_TEXT
- BITS 64
;
; Convert some rows of samples to the output colorspace.
;
diff --git a/simd/jdclrss2.asm b/simd/jdclrss2.asm
index 71547ba..7f519e6 100644
--- a/simd/jdclrss2.asm
+++ b/simd/jdclrss2.asm
@@ -19,8 +19,6 @@
%include "jcolsamp.inc"
; --------------------------------------------------------------------------
- SECTION SEG_TEXT
- BITS 32
;
; Convert some rows of samples to the output colorspace.
;
diff --git a/simd/jdcolmmx.asm b/simd/jdcolmmx.asm
index 58775e8..5e4e47d 100644
--- a/simd/jdcolmmx.asm
+++ b/simd/jdcolmmx.asm
@@ -48,16 +48,19 @@
alignz 16
; --------------------------------------------------------------------------
+ SECTION SEG_TEXT
+ BITS 32
+
%include "jdclrmmx.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_RGB_RED
+%define RGB_GREEN EXT_RGB_GREEN
+%define RGB_BLUE EXT_RGB_BLUE
+%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extrgb_convert_mmx
%include "jdclrmmx.asm"
@@ -65,10 +68,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_RGBX_RED
+%define RGB_GREEN EXT_RGBX_GREEN
+%define RGB_BLUE EXT_RGBX_BLUE
+%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extrgbx_convert_mmx
%include "jdclrmmx.asm"
@@ -76,10 +79,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_BGR_RED
+%define RGB_GREEN EXT_BGR_GREEN
+%define RGB_BLUE EXT_BGR_BLUE
+%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extbgr_convert_mmx
%include "jdclrmmx.asm"
@@ -87,10 +90,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_BGRX_RED
+%define RGB_GREEN EXT_BGRX_GREEN
+%define RGB_BLUE EXT_BGRX_BLUE
+%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extbgrx_convert_mmx
%include "jdclrmmx.asm"
@@ -98,10 +101,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 3
-%define RGB_GREEN 2
-%define RGB_BLUE 1
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XBGR_RED
+%define RGB_GREEN EXT_XBGR_GREEN
+%define RGB_BLUE EXT_XBGR_BLUE
+%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extxbgr_convert_mmx
%include "jdclrmmx.asm"
@@ -109,9 +112,9 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 1
-%define RGB_GREEN 2
-%define RGB_BLUE 3
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XRGB_RED
+%define RGB_GREEN EXT_XRGB_GREEN
+%define RGB_BLUE EXT_XRGB_BLUE
+%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_ycc_rgb_convert_mmx jsimd_ycc_extxrgb_convert_mmx
%include "jdclrmmx.asm"
diff --git a/simd/jdcolss2-64.asm b/simd/jdcolss2-64.asm
index 2e97d59..01b3dce 100644
--- a/simd/jdcolss2-64.asm
+++ b/simd/jdcolss2-64.asm
@@ -48,16 +48,19 @@
alignz 16
; --------------------------------------------------------------------------
+ SECTION SEG_TEXT
+ BITS 64
+
%include "jdclrss2-64.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_RGB_RED
+%define RGB_GREEN EXT_RGB_GREEN
+%define RGB_BLUE EXT_RGB_BLUE
+%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgb_convert_sse2
%include "jdclrss2-64.asm"
@@ -65,10 +68,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_RGBX_RED
+%define RGB_GREEN EXT_RGBX_GREEN
+%define RGB_BLUE EXT_RGBX_BLUE
+%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgbx_convert_sse2
%include "jdclrss2-64.asm"
@@ -76,10 +79,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_BGR_RED
+%define RGB_GREEN EXT_BGR_GREEN
+%define RGB_BLUE EXT_BGR_BLUE
+%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgr_convert_sse2
%include "jdclrss2-64.asm"
@@ -87,10 +90,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_BGRX_RED
+%define RGB_GREEN EXT_BGRX_GREEN
+%define RGB_BLUE EXT_BGRX_BLUE
+%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgrx_convert_sse2
%include "jdclrss2-64.asm"
@@ -98,10 +101,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 3
-%define RGB_GREEN 2
-%define RGB_BLUE 1
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XBGR_RED
+%define RGB_GREEN EXT_XBGR_GREEN
+%define RGB_BLUE EXT_XBGR_BLUE
+%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxbgr_convert_sse2
%include "jdclrss2-64.asm"
@@ -109,9 +112,9 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 1
-%define RGB_GREEN 2
-%define RGB_BLUE 3
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XRGB_RED
+%define RGB_GREEN EXT_XRGB_GREEN
+%define RGB_BLUE EXT_XRGB_BLUE
+%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxrgb_convert_sse2
%include "jdclrss2-64.asm"
diff --git a/simd/jdcolss2.asm b/simd/jdcolss2.asm
index 7ae985d..1912d92 100644
--- a/simd/jdcolss2.asm
+++ b/simd/jdcolss2.asm
@@ -48,16 +48,19 @@
alignz 16
; --------------------------------------------------------------------------
+ SECTION SEG_TEXT
+ BITS 32
+
%include "jdclrss2.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_RGB_RED
+%define RGB_GREEN EXT_RGB_GREEN
+%define RGB_BLUE EXT_RGB_BLUE
+%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgb_convert_sse2
%include "jdclrss2.asm"
@@ -65,10 +68,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_RGBX_RED
+%define RGB_GREEN EXT_RGBX_GREEN
+%define RGB_BLUE EXT_RGBX_BLUE
+%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extrgbx_convert_sse2
%include "jdclrss2.asm"
@@ -76,10 +79,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_BGR_RED
+%define RGB_GREEN EXT_BGR_GREEN
+%define RGB_BLUE EXT_BGR_BLUE
+%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgr_convert_sse2
%include "jdclrss2.asm"
@@ -87,10 +90,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_BGRX_RED
+%define RGB_GREEN EXT_BGRX_GREEN
+%define RGB_BLUE EXT_BGRX_BLUE
+%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extbgrx_convert_sse2
%include "jdclrss2.asm"
@@ -98,10 +101,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 3
-%define RGB_GREEN 2
-%define RGB_BLUE 1
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XBGR_RED
+%define RGB_GREEN EXT_XBGR_GREEN
+%define RGB_BLUE EXT_XBGR_BLUE
+%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxbgr_convert_sse2
%include "jdclrss2.asm"
@@ -109,9 +112,9 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 1
-%define RGB_GREEN 2
-%define RGB_BLUE 3
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XRGB_RED
+%define RGB_GREEN EXT_XRGB_GREEN
+%define RGB_BLUE EXT_XRGB_BLUE
+%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_ycc_rgb_convert_sse2 jsimd_ycc_extxrgb_convert_sse2
%include "jdclrss2.asm"
diff --git a/simd/jdmermmx.asm b/simd/jdmermmx.asm
index fd587fb..7b86c74 100644
--- a/simd/jdmermmx.asm
+++ b/simd/jdmermmx.asm
@@ -48,16 +48,19 @@
alignz 16
; --------------------------------------------------------------------------
+ SECTION SEG_TEXT
+ BITS 32
+
%include "jdmrgmmx.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_RGB_RED
+%define RGB_GREEN EXT_RGB_GREEN
+%define RGB_BLUE EXT_RGB_BLUE
+%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extrgb_merged_upsample_mmx
%define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extrgb_merged_upsample_mmx
%include "jdmrgmmx.asm"
@@ -66,10 +69,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_RGBX_RED
+%define RGB_GREEN EXT_RGBX_GREEN
+%define RGB_BLUE EXT_RGBX_BLUE
+%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extrgbx_merged_upsample_mmx
%define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extrgbx_merged_upsample_mmx
%include "jdmrgmmx.asm"
@@ -78,10 +81,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_BGR_RED
+%define RGB_GREEN EXT_BGR_GREEN
+%define RGB_BLUE EXT_BGR_BLUE
+%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extbgr_merged_upsample_mmx
%define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extbgr_merged_upsample_mmx
%include "jdmrgmmx.asm"
@@ -90,10 +93,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_BGRX_RED
+%define RGB_GREEN EXT_BGRX_GREEN
+%define RGB_BLUE EXT_BGRX_BLUE
+%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extbgrx_merged_upsample_mmx
%define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extbgrx_merged_upsample_mmx
%include "jdmrgmmx.asm"
@@ -102,10 +105,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 3
-%define RGB_GREEN 2
-%define RGB_BLUE 1
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XBGR_RED
+%define RGB_GREEN EXT_XBGR_GREEN
+%define RGB_BLUE EXT_XBGR_BLUE
+%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extxbgr_merged_upsample_mmx
%define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extxbgr_merged_upsample_mmx
%include "jdmrgmmx.asm"
@@ -114,10 +117,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 1
-%define RGB_GREEN 2
-%define RGB_BLUE 3
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XRGB_RED
+%define RGB_GREEN EXT_XRGB_GREEN
+%define RGB_BLUE EXT_XRGB_BLUE
+%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_h2v1_merged_upsample_mmx jsimd_h2v1_extxrgb_merged_upsample_mmx
%define jsimd_h2v2_merged_upsample_mmx jsimd_h2v2_extxrgb_merged_upsample_mmx
%include "jdmrgmmx.asm"
diff --git a/simd/jdmerss2-64.asm b/simd/jdmerss2-64.asm
index 1f0b10f..a184ea6 100644
--- a/simd/jdmerss2-64.asm
+++ b/simd/jdmerss2-64.asm
@@ -48,16 +48,19 @@
alignz 16
; --------------------------------------------------------------------------
+ SECTION SEG_TEXT
+ BITS 64
+
%include "jdmrgss2-64.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_RGB_RED
+%define RGB_GREEN EXT_RGB_GREEN
+%define RGB_BLUE EXT_RGB_BLUE
+%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgb_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgb_merged_upsample_sse2
%include "jdmrgss2-64.asm"
@@ -66,10 +69,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_RGBX_RED
+%define RGB_GREEN EXT_RGBX_GREEN
+%define RGB_BLUE EXT_RGBX_BLUE
+%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgbx_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgbx_merged_upsample_sse2
%include "jdmrgss2-64.asm"
@@ -78,10 +81,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_BGR_RED
+%define RGB_GREEN EXT_BGR_GREEN
+%define RGB_BLUE EXT_BGR_BLUE
+%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgr_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgr_merged_upsample_sse2
%include "jdmrgss2-64.asm"
@@ -90,10 +93,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_BGRX_RED
+%define RGB_GREEN EXT_BGRX_GREEN
+%define RGB_BLUE EXT_BGRX_BLUE
+%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgrx_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgrx_merged_upsample_sse2
%include "jdmrgss2-64.asm"
@@ -102,10 +105,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 3
-%define RGB_GREEN 2
-%define RGB_BLUE 1
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XBGR_RED
+%define RGB_GREEN EXT_XBGR_GREEN
+%define RGB_BLUE EXT_XBGR_BLUE
+%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxbgr_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxbgr_merged_upsample_sse2
%include "jdmrgss2-64.asm"
@@ -114,10 +117,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 1
-%define RGB_GREEN 2
-%define RGB_BLUE 3
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XRGB_RED
+%define RGB_GREEN EXT_XRGB_GREEN
+%define RGB_BLUE EXT_XRGB_BLUE
+%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxrgb_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxrgb_merged_upsample_sse2
%include "jdmrgss2-64.asm"
diff --git a/simd/jdmerss2.asm b/simd/jdmerss2.asm
index 2294e0d..e536c80 100644
--- a/simd/jdmerss2.asm
+++ b/simd/jdmerss2.asm
@@ -48,16 +48,19 @@
alignz 16
; --------------------------------------------------------------------------
+ SECTION SEG_TEXT
+ BITS 32
+
%include "jdmrgss2.asm"
%undef RGB_RED
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_RGB_RED
+%define RGB_GREEN EXT_RGB_GREEN
+%define RGB_BLUE EXT_RGB_BLUE
+%define RGB_PIXELSIZE EXT_RGB_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgb_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgb_merged_upsample_sse2
%include "jdmrgss2.asm"
@@ -66,10 +69,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 0
-%define RGB_GREEN 1
-%define RGB_BLUE 2
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_RGBX_RED
+%define RGB_GREEN EXT_RGBX_GREEN
+%define RGB_BLUE EXT_RGBX_BLUE
+%define RGB_PIXELSIZE EXT_RGBX_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extrgbx_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extrgbx_merged_upsample_sse2
%include "jdmrgss2.asm"
@@ -78,10 +81,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 3
+%define RGB_RED EXT_BGR_RED
+%define RGB_GREEN EXT_BGR_GREEN
+%define RGB_BLUE EXT_BGR_BLUE
+%define RGB_PIXELSIZE EXT_BGR_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgr_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgr_merged_upsample_sse2
%include "jdmrgss2.asm"
@@ -90,10 +93,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 2
-%define RGB_GREEN 1
-%define RGB_BLUE 0
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_BGRX_RED
+%define RGB_GREEN EXT_BGRX_GREEN
+%define RGB_BLUE EXT_BGRX_BLUE
+%define RGB_PIXELSIZE EXT_BGRX_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extbgrx_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extbgrx_merged_upsample_sse2
%include "jdmrgss2.asm"
@@ -102,10 +105,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 3
-%define RGB_GREEN 2
-%define RGB_BLUE 1
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XBGR_RED
+%define RGB_GREEN EXT_XBGR_GREEN
+%define RGB_BLUE EXT_XBGR_BLUE
+%define RGB_PIXELSIZE EXT_XBGR_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxbgr_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxbgr_merged_upsample_sse2
%include "jdmrgss2.asm"
@@ -114,10 +117,10 @@
%undef RGB_GREEN
%undef RGB_BLUE
%undef RGB_PIXELSIZE
-%define RGB_RED 1
-%define RGB_GREEN 2
-%define RGB_BLUE 3
-%define RGB_PIXELSIZE 4
+%define RGB_RED EXT_XRGB_RED
+%define RGB_GREEN EXT_XRGB_GREEN
+%define RGB_BLUE EXT_XRGB_BLUE
+%define RGB_PIXELSIZE EXT_XRGB_PIXELSIZE
%define jsimd_h2v1_merged_upsample_sse2 jsimd_h2v1_extxrgb_merged_upsample_sse2
%define jsimd_h2v2_merged_upsample_sse2 jsimd_h2v2_extxrgb_merged_upsample_sse2
%include "jdmrgss2.asm"
diff --git a/simd/jdmrgmmx.asm b/simd/jdmrgmmx.asm
index b5777a3..d0800a7 100644
--- a/simd/jdmrgmmx.asm
+++ b/simd/jdmrgmmx.asm
@@ -19,8 +19,6 @@
%include "jcolsamp.inc"
; --------------------------------------------------------------------------
- SECTION SEG_TEXT
- BITS 32
;
; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical.
;
diff --git a/simd/jdmrgss2-64.asm b/simd/jdmrgss2-64.asm
index 36e2582..a64a6b3 100644
--- a/simd/jdmrgss2-64.asm
+++ b/simd/jdmrgss2-64.asm
@@ -20,8 +20,6 @@
%include "jcolsamp.inc"
; --------------------------------------------------------------------------
- SECTION SEG_TEXT
- BITS 64
;
; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical.
;
diff --git a/simd/jdmrgss2.asm b/simd/jdmrgss2.asm
index 6a0dbd9..04089aa 100644
--- a/simd/jdmrgss2.asm
+++ b/simd/jdmrgss2.asm
@@ -19,8 +19,6 @@
%include "jcolsamp.inc"
; --------------------------------------------------------------------------
- SECTION SEG_TEXT
- BITS 32
;
; Upsample and color convert for the case of 2:1 horizontal and 1:1 vertical.
;
diff --git a/simd/jsimd.h b/simd/jsimd.h
index 89ac1b7..6ee99cc 100644
--- a/simd/jsimd.h
+++ b/simd/jsimd.h
@@ -2,6 +2,7 @@
* simd/jsimd.h
*
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
+ * Copyright 2011 D. R. Commander
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
@@ -11,11 +12,12 @@
/* Bitmask for supported acceleration methods */
-#define JSIMD_NONE 0x00
-#define JSIMD_MMX 0x01
-#define JSIMD_3DNOW 0x02
-#define JSIMD_SSE 0x04
-#define JSIMD_SSE2 0x08
+#define JSIMD_NONE 0x00
+#define JSIMD_MMX 0x01
+#define JSIMD_3DNOW 0x02
+#define JSIMD_SSE 0x04
+#define JSIMD_SSE2 0x08
+#define JSIMD_ARM_NEON 0x10
/* Short forms of external names for systems with brain-damaged linkers. */
@@ -28,6 +30,13 @@
#define jsimd_extbgrx_ycc_convert_mmx jSEXTBGRXYCCM
#define jsimd_extxbgr_ycc_convert_mmx jSEXTXBGRYCCM
#define jsimd_extxrgb_ycc_convert_mmx jSEXTXRGBYCCM
+#define jsimd_rgb_gray_convert_mmx jSRGBGRYM
+#define jsimd_extrgb_gray_convert_mmx jSEXTRGBGRYM
+#define jsimd_extrgbx_gray_convert_mmx jSEXTRGBXGRYM
+#define jsimd_extbgr_gray_convert_mmx jSEXTBGRGRYM
+#define jsimd_extbgrx_gray_convert_mmx jSEXTBGRXGRYM
+#define jsimd_extxbgr_gray_convert_mmx jSEXTXBGRGRYM
+#define jsimd_extxrgb_gray_convert_mmx jSEXTXRGBGRYM
#define jsimd_ycc_rgb_convert_mmx jSYCCRGBM
#define jsimd_ycc_extrgb_convert_mmx jSYCCEXTRGBM
#define jsimd_ycc_extrgbx_convert_mmx jSYCCEXTRGBXM
@@ -43,6 +52,14 @@
#define jsimd_extbgrx_ycc_convert_sse2 jSEXTBGRXYCCS2
#define jsimd_extxbgr_ycc_convert_sse2 jSEXTXBGRYCCS2
#define jsimd_extxrgb_ycc_convert_sse2 jSEXTXRGBYCCS2
+#define jconst_rgb_gray_convert_sse2 jSCRGBGRYS2
+#define jsimd_rgb_gray_convert_sse2 jSRGBGRYS2
+#define jsimd_extrgb_gray_convert_sse2 jSEXTRGBGRYS2
+#define jsimd_extrgbx_gray_convert_sse2 jSEXTRGBXGRYS2
+#define jsimd_extbgr_gray_convert_sse2 jSEXTBGRGRYS2
+#define jsimd_extbgrx_gray_convert_sse2 jSEXTBGRXGRYS2
+#define jsimd_extxbgr_gray_convert_sse2 jSEXTXBGRGRYS2
+#define jsimd_extxrgb_gray_convert_sse2 jSEXTXRGBGRYS2
#define jconst_ycc_rgb_convert_sse2 jSCYCCRGBS2
#define jsimd_ycc_rgb_convert_sse2 jSYCCRGBS2
#define jsimd_ycc_extrgb_convert_sse2 jSYCCEXTRGBS2
@@ -163,6 +180,35 @@
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_rgb_gray_convert_mmx
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extrgb_gray_convert_mmx
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extrgbx_gray_convert_mmx
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extbgr_gray_convert_mmx
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extbgrx_gray_convert_mmx
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extxbgr_gray_convert_mmx
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extxrgb_gray_convert_mmx
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+
EXTERN(void) jsimd_ycc_rgb_convert_mmx
JPP((JDIMENSION out_width,
JSAMPIMAGE input_buf, JDIMENSION input_row,
@@ -222,6 +268,36 @@
JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
JDIMENSION output_row, int num_rows));
+extern const int jconst_rgb_gray_convert_sse2[];
+EXTERN(void) jsimd_rgb_gray_convert_sse2
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extrgb_gray_convert_sse2
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extrgbx_gray_convert_sse2
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extbgr_gray_convert_sse2
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extbgrx_gray_convert_sse2
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extxbgr_gray_convert_sse2
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extxrgb_gray_convert_sse2
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+
extern const int jconst_ycc_rgb_convert_sse2[];
EXTERN(void) jsimd_ycc_rgb_convert_sse2
JPP((JDIMENSION out_width,
@@ -252,6 +328,64 @@
JSAMPIMAGE input_buf, JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows));
+EXTERN(void) jsimd_rgb_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extrgb_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extrgbx_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extbgr_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extbgrx_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extxbgr_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+EXTERN(void) jsimd_extxrgb_ycc_convert_neon
+ JPP((JDIMENSION img_width,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows));
+
+EXTERN(void) jsimd_ycc_rgb_convert_neon
+ JPP((JDIMENSION out_width,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows));
+EXTERN(void) jsimd_ycc_extrgb_convert_neon
+ JPP((JDIMENSION out_width,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows));
+EXTERN(void) jsimd_ycc_extrgbx_convert_neon
+ JPP((JDIMENSION out_width,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows));
+EXTERN(void) jsimd_ycc_extbgr_convert_neon
+ JPP((JDIMENSION out_width,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows));
+EXTERN(void) jsimd_ycc_extbgrx_convert_neon
+ JPP((JDIMENSION out_width,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows));
+EXTERN(void) jsimd_ycc_extxbgr_convert_neon
+ JPP((JDIMENSION out_width,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows));
+EXTERN(void) jsimd_ycc_extxrgb_convert_neon
+ JPP((JDIMENSION out_width,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows));
+
/* SIMD Downsample */
EXTERN(void) jsimd_h2v2_downsample_mmx
JPP((JDIMENSION image_width, int max_v_samp_factor,
@@ -397,6 +531,10 @@
JDIMENSION start_col,
DCTELEM * workspace));
+EXTERN(void) jsimd_convsamp_neon JPP((JSAMPARRAY sample_data,
+ JDIMENSION start_col,
+ DCTELEM * workspace));
+
EXTERN(void) jsimd_convsamp_float_3dnow JPP((JSAMPARRAY sample_data,
JDIMENSION start_col,
FAST_FLOAT * workspace));
@@ -418,6 +556,8 @@
extern const int jconst_fdct_islow_sse2[];
EXTERN(void) jsimd_fdct_ifast_sse2 JPP((DCTELEM * data));
+EXTERN(void) jsimd_fdct_ifast_neon JPP((DCTELEM * data));
+
EXTERN(void) jsimd_fdct_float_3dnow JPP((FAST_FLOAT * data));
extern const int jconst_fdct_float_sse[];
@@ -432,6 +572,10 @@
DCTELEM * divisors,
DCTELEM * workspace));
+EXTERN(void) jsimd_quantize_neon JPP((JCOEFPTR coef_block,
+ DCTELEM * divisors,
+ DCTELEM * workspace));
+
EXTERN(void) jsimd_quantize_float_3dnow JPP((JCOEFPTR coef_block,
FAST_FLOAT * divisors,
FAST_FLOAT * workspace));
@@ -464,6 +608,15 @@
JSAMPARRAY output_buf,
JDIMENSION output_col));
+EXTERN(void) jsimd_idct_2x2_neon JPP((void * dct_table,
+ JCOEFPTR coef_block,
+ JSAMPARRAY output_buf,
+ JDIMENSION output_col));
+EXTERN(void) jsimd_idct_4x4_neon JPP((void * dct_table,
+ JCOEFPTR coef_block,
+ JSAMPARRAY output_buf,
+ JDIMENSION output_col));
+
/* SIMD Inverse DCT */
EXTERN(void) jsimd_idct_islow_mmx JPP((void * dct_table,
JCOEFPTR coef_block,
@@ -485,6 +638,15 @@
JSAMPARRAY output_buf,
JDIMENSION output_col));
+EXTERN(void) jsimd_idct_islow_neon JPP((void * dct_table,
+ JCOEFPTR coef_block,
+ JSAMPARRAY output_buf,
+ JDIMENSION output_col));
+EXTERN(void) jsimd_idct_ifast_neon JPP((void * dct_table,
+ JCOEFPTR coef_block,
+ JSAMPARRAY output_buf,
+ JDIMENSION output_col));
+
EXTERN(void) jsimd_idct_float_3dnow JPP((void * dct_table,
JCOEFPTR coef_block,
JSAMPARRAY output_buf,
diff --git a/simd/jsimd_arm.c b/simd/jsimd_arm.c
new file mode 100644
index 0000000..a9d920c
--- /dev/null
+++ b/simd/jsimd_arm.c
@@ -0,0 +1,662 @@
+/*
+ * jsimd_arm.c
+ *
+ * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
+ * Copyright 2009-2011 D. R. Commander
+ *
+ * Based on the x86 SIMD extension for IJG JPEG library,
+ * Copyright (C) 1999-2006, MIYASAKA Masaru.
+ * For conditions of distribution and use, see copyright notice in jsimdext.inc
+ *
+ * This file contains the interface between the "normal" portions
+ * of the library and the SIMD implementations when running on
+ * ARM architecture.
+ *
+ * Based on the stubs from 'jsimd_none.c'
+ */
+
+#define JPEG_INTERNALS
+#include "../jinclude.h"
+#include "../jpeglib.h"
+#include "../jsimd.h"
+#include "../jdct.h"
+#include "../jsimddct.h"
+#include "jsimd.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <ctype.h>
+
+static unsigned int simd_support = ~0;
+
+#if defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
+
+#define SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT (1024 * 1024)
+
+LOCAL(int)
+check_feature (char *buffer, char *feature)
+{
+ char *p;
+ if (*feature == 0)
+ return 0;
+ if (strncmp(buffer, "Features", 8) != 0)
+ return 0;
+ buffer += 8;
+ while (isspace(*buffer))
+ buffer++;
+
+ /* Check if 'feature' is present in the buffer as a separate word */
+ while ((p = strstr(buffer, feature))) {
+ if (p > buffer && !isspace(*(p - 1))) {
+ buffer++;
+ continue;
+ }
+ p += strlen(feature);
+ if (*p != 0 && !isspace(*p)) {
+ buffer++;
+ continue;
+ }
+ return 1;
+ }
+ return 0;
+}
+
+LOCAL(int)
+parse_proc_cpuinfo (int bufsize)
+{
+ char *buffer = (char *)malloc(bufsize);
+ FILE *fd;
+ simd_support = 0;
+
+ if (!buffer)
+ return 0;
+
+ fd = fopen("/proc/cpuinfo", "r");
+ if (fd) {
+ while (fgets(buffer, bufsize, fd)) {
+ if (!strchr(buffer, '\n') && !feof(fd)) {
+ /* "impossible" happened - insufficient size of the buffer! */
+ fclose(fd);
+ free(buffer);
+ return 0;
+ }
+ if (check_feature(buffer, "neon"))
+ simd_support |= JSIMD_ARM_NEON;
+ }
+ fclose(fd);
+ }
+ free(buffer);
+ return 1;
+}
+
+#endif
+
+/*
+ * Check what SIMD accelerations are supported.
+ *
+ * FIXME: This code is racy under a multi-threaded environment.
+ */
+LOCAL(void)
+init_simd (void)
+{
+ char *env = NULL;
+#if !defined(__ARM_NEON__) && defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
+ int bufsize = 1024; /* an initial guess for the line buffer size limit */
+#endif
+
+ if (simd_support != ~0)
+ return;
+
+ simd_support = 0;
+
+#if defined(__ARM_NEON__)
+ simd_support |= JSIMD_ARM_NEON;
+#elif defined(__linux__) || defined(ANDROID) || defined(__ANDROID__)
+ /* We still have a chance to use NEON regardless of globally used
+ * -mcpu/-mfpu options passed to gcc by performing runtime detection via
+ * /proc/cpuinfo parsing on linux/android */
+ while (!parse_proc_cpuinfo(bufsize)) {
+ bufsize *= 2;
+ if (bufsize > SOMEWHAT_SANE_PROC_CPUINFO_SIZE_LIMIT)
+ break;
+ }
+#endif
+
+ /* Force different settings through environment variables */
+ env = getenv("JSIMD_FORCE_ARM_NEON");
+ if ((env != NULL) && (strcmp(env, "1") == 0))
+ simd_support &= JSIMD_ARM_NEON;
+ env = getenv("JSIMD_FORCE_NO_SIMD");
+ if ((env != NULL) && (strcmp(env, "1") == 0))
+ simd_support = 0;
+}
+
+GLOBAL(int)
+jsimd_can_rgb_ycc (void)
+{
+ init_simd();
+
+ /* The code is optimised for these values only */
+ if (BITS_IN_JSAMPLE != 8)
+ return 0;
+ if (sizeof(JDIMENSION) != 4)
+ return 0;
+ if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
+ return 0;
+
+ if (simd_support & JSIMD_ARM_NEON)
+ return 1;
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_rgb_gray (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_ycc_rgb (void)
+{
+ init_simd();
+
+ /* The code is optimised for these values only */
+ if (BITS_IN_JSAMPLE != 8)
+ return 0;
+ if (sizeof(JDIMENSION) != 4)
+ return 0;
+ if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
+ return 0;
+ if (simd_support & JSIMD_ARM_NEON)
+ return 1;
+
+ return 0;
+}
+
+GLOBAL(void)
+jsimd_rgb_ycc_convert (j_compress_ptr cinfo,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows)
+{
+ void (*neonfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
+
+ switch(cinfo->in_color_space)
+ {
+ case JCS_EXT_RGB:
+ neonfct=jsimd_extrgb_ycc_convert_neon;
+ break;
+ case JCS_EXT_RGBX:
+ neonfct=jsimd_extrgbx_ycc_convert_neon;
+ break;
+ case JCS_EXT_BGR:
+ neonfct=jsimd_extbgr_ycc_convert_neon;
+ break;
+ case JCS_EXT_BGRX:
+ neonfct=jsimd_extbgrx_ycc_convert_neon;
+ break;
+ case JCS_EXT_XBGR:
+ neonfct=jsimd_extxbgr_ycc_convert_neon;
+ break;
+ case JCS_EXT_XRGB:
+ neonfct=jsimd_extxrgb_ycc_convert_neon;
+ break;
+ default:
+ neonfct=jsimd_extrgb_ycc_convert_neon;
+ break;
+ }
+
+ if (simd_support & JSIMD_ARM_NEON)
+ neonfct(cinfo->image_width, input_buf,
+ output_buf, output_row, num_rows);
+}
+
+GLOBAL(void)
+jsimd_rgb_gray_convert (j_compress_ptr cinfo,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows)
+{
+}
+
+GLOBAL(void)
+jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf, JDIMENSION input_row,
+ JSAMPARRAY output_buf, int num_rows)
+{
+ void (*neonfct)(JDIMENSION, JSAMPIMAGE, JDIMENSION, JSAMPARRAY, int);
+
+ switch(cinfo->out_color_space)
+ {
+ case JCS_EXT_RGB:
+ neonfct=jsimd_ycc_extrgb_convert_neon;
+ break;
+ case JCS_EXT_RGBX:
+ neonfct=jsimd_ycc_extrgbx_convert_neon;
+ break;
+ case JCS_EXT_BGR:
+ neonfct=jsimd_ycc_extbgr_convert_neon;
+ break;
+ case JCS_EXT_BGRX:
+ neonfct=jsimd_ycc_extbgrx_convert_neon;
+ break;
+ case JCS_EXT_XBGR:
+ neonfct=jsimd_ycc_extxbgr_convert_neon;
+ break;
+ case JCS_EXT_XRGB:
+ neonfct=jsimd_ycc_extxrgb_convert_neon;
+ break;
+ default:
+ neonfct=jsimd_ycc_extrgb_convert_neon;
+ break;
+ }
+
+ if (simd_support & JSIMD_ARM_NEON)
+ neonfct(cinfo->output_width, input_buf,
+ input_row, output_buf, num_rows);
+}
+
+GLOBAL(int)
+jsimd_can_h2v2_downsample (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_h2v1_downsample (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(void)
+jsimd_h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
+ JSAMPARRAY input_data, JSAMPARRAY output_data)
+{
+}
+
+GLOBAL(void)
+jsimd_h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
+ JSAMPARRAY input_data, JSAMPARRAY output_data)
+{
+}
+
+GLOBAL(int)
+jsimd_can_h2v2_upsample (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_h2v1_upsample (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(void)
+jsimd_h2v2_upsample (j_decompress_ptr cinfo,
+ jpeg_component_info * compptr,
+ JSAMPARRAY input_data,
+ JSAMPARRAY * output_data_ptr)
+{
+}
+
+GLOBAL(void)
+jsimd_h2v1_upsample (j_decompress_ptr cinfo,
+ jpeg_component_info * compptr,
+ JSAMPARRAY input_data,
+ JSAMPARRAY * output_data_ptr)
+{
+}
+
+GLOBAL(int)
+jsimd_can_h2v2_fancy_upsample (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_h2v1_fancy_upsample (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(void)
+jsimd_h2v2_fancy_upsample (j_decompress_ptr cinfo,
+ jpeg_component_info * compptr,
+ JSAMPARRAY input_data,
+ JSAMPARRAY * output_data_ptr)
+{
+}
+
+GLOBAL(void)
+jsimd_h2v1_fancy_upsample (j_decompress_ptr cinfo,
+ jpeg_component_info * compptr,
+ JSAMPARRAY input_data,
+ JSAMPARRAY * output_data_ptr)
+{
+}
+
+GLOBAL(int)
+jsimd_can_h2v2_merged_upsample (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_h2v1_merged_upsample (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(void)
+jsimd_h2v2_merged_upsample (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr,
+ JSAMPARRAY output_buf)
+{
+}
+
+GLOBAL(void)
+jsimd_h2v1_merged_upsample (j_decompress_ptr cinfo,
+ JSAMPIMAGE input_buf,
+ JDIMENSION in_row_group_ctr,
+ JSAMPARRAY output_buf)
+{
+}
+
+GLOBAL(int)
+jsimd_can_convsamp (void)
+{
+ init_simd();
+
+ /* The code is optimised for these values only */
+ if (DCTSIZE != 8)
+ return 0;
+ if (BITS_IN_JSAMPLE != 8)
+ return 0;
+ if (sizeof(JDIMENSION) != 4)
+ return 0;
+ if (sizeof(DCTELEM) != 2)
+ return 0;
+
+ if (simd_support & JSIMD_ARM_NEON)
+ return 1;
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_convsamp_float (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(void)
+jsimd_convsamp (JSAMPARRAY sample_data, JDIMENSION start_col,
+ DCTELEM * workspace)
+{
+ if (simd_support & JSIMD_ARM_NEON)
+ jsimd_convsamp_neon(sample_data, start_col, workspace);
+}
+
+GLOBAL(void)
+jsimd_convsamp_float (JSAMPARRAY sample_data, JDIMENSION start_col,
+ FAST_FLOAT * workspace)
+{
+}
+
+GLOBAL(int)
+jsimd_can_fdct_islow (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_fdct_ifast (void)
+{
+ init_simd();
+
+ /* The code is optimised for these values only */
+ if (DCTSIZE != 8)
+ return 0;
+ if (sizeof(DCTELEM) != 2)
+ return 0;
+
+ if (simd_support & JSIMD_ARM_NEON)
+ return 1;
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_fdct_float (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(void)
+jsimd_fdct_islow (DCTELEM * data)
+{
+}
+
+GLOBAL(void)
+jsimd_fdct_ifast (DCTELEM * data)
+{
+ if (simd_support & JSIMD_ARM_NEON)
+ jsimd_fdct_ifast_neon(data);
+}
+
+GLOBAL(void)
+jsimd_fdct_float (FAST_FLOAT * data)
+{
+}
+
+GLOBAL(int)
+jsimd_can_quantize (void)
+{
+ init_simd();
+
+ /* The code is optimised for these values only */
+ if (DCTSIZE != 8)
+ return 0;
+ if (sizeof(JCOEF) != 2)
+ return 0;
+ if (sizeof(DCTELEM) != 2)
+ return 0;
+
+ if (simd_support & JSIMD_ARM_NEON)
+ return 1;
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_quantize_float (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(void)
+jsimd_quantize (JCOEFPTR coef_block, DCTELEM * divisors,
+ DCTELEM * workspace)
+{
+ if (simd_support & JSIMD_ARM_NEON)
+ jsimd_quantize_neon(coef_block, divisors, workspace);
+}
+
+GLOBAL(void)
+jsimd_quantize_float (JCOEFPTR coef_block, FAST_FLOAT * divisors,
+ FAST_FLOAT * workspace)
+{
+}
+
+GLOBAL(int)
+jsimd_can_idct_2x2 (void)
+{
+ init_simd();
+
+ /* The code is optimised for these values only */
+ if (DCTSIZE != 8)
+ return 0;
+ if (sizeof(JCOEF) != 2)
+ return 0;
+ if (BITS_IN_JSAMPLE != 8)
+ return 0;
+ if (sizeof(JDIMENSION) != 4)
+ return 0;
+ if (sizeof(ISLOW_MULT_TYPE) != 2)
+ return 0;
+
+ if ((simd_support & JSIMD_ARM_NEON))
+ return 1;
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_idct_4x4 (void)
+{
+ init_simd();
+
+ /* The code is optimised for these values only */
+ if (DCTSIZE != 8)
+ return 0;
+ if (sizeof(JCOEF) != 2)
+ return 0;
+ if (BITS_IN_JSAMPLE != 8)
+ return 0;
+ if (sizeof(JDIMENSION) != 4)
+ return 0;
+ if (sizeof(ISLOW_MULT_TYPE) != 2)
+ return 0;
+
+ if ((simd_support & JSIMD_ARM_NEON))
+ return 1;
+
+ return 0;
+}
+
+GLOBAL(void)
+jsimd_idct_2x2 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
+{
+ if ((simd_support & JSIMD_ARM_NEON))
+ jsimd_idct_2x2_neon(compptr->dct_table, coef_block, output_buf, output_col);
+}
+
+GLOBAL(void)
+jsimd_idct_4x4 (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
+{
+ if ((simd_support & JSIMD_ARM_NEON))
+ jsimd_idct_4x4_neon(compptr->dct_table, coef_block, output_buf, output_col);
+}
+
+GLOBAL(int)
+jsimd_can_idct_islow (void)
+{
+ init_simd();
+
+ /* The code is optimised for these values only */
+ if (DCTSIZE != 8)
+ return 0;
+ if (sizeof(JCOEF) != 2)
+ return 0;
+ if (BITS_IN_JSAMPLE != 8)
+ return 0;
+ if (sizeof(JDIMENSION) != 4)
+ return 0;
+ if (sizeof(ISLOW_MULT_TYPE) != 2)
+ return 0;
+
+ if (simd_support & JSIMD_ARM_NEON)
+ return 1;
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_idct_ifast (void)
+{
+ init_simd();
+
+ /* The code is optimised for these values only */
+ if (DCTSIZE != 8)
+ return 0;
+ if (sizeof(JCOEF) != 2)
+ return 0;
+ if (BITS_IN_JSAMPLE != 8)
+ return 0;
+ if (sizeof(JDIMENSION) != 4)
+ return 0;
+ if (sizeof(IFAST_MULT_TYPE) != 2)
+ return 0;
+ if (IFAST_SCALE_BITS != 2)
+ return 0;
+
+ if ((simd_support & JSIMD_ARM_NEON))
+ return 1;
+
+ return 0;
+}
+
+GLOBAL(int)
+jsimd_can_idct_float (void)
+{
+ init_simd();
+
+ return 0;
+}
+
+GLOBAL(void)
+jsimd_idct_islow (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
+{
+ if ((simd_support & JSIMD_ARM_NEON))
+ jsimd_idct_islow_neon(compptr->dct_table, coef_block, output_buf, output_col);
+}
+
+GLOBAL(void)
+jsimd_idct_ifast (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
+{
+ if ((simd_support & JSIMD_ARM_NEON))
+ jsimd_idct_ifast_neon(compptr->dct_table, coef_block, output_buf, output_col);
+}
+
+GLOBAL(void)
+jsimd_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
+ JCOEFPTR coef_block, JSAMPARRAY output_buf,
+ JDIMENSION output_col)
+{
+}
+
diff --git a/simd/jsimd_arm_neon.S b/simd/jsimd_arm_neon.S
new file mode 100644
index 0000000..b2f9c2a
--- /dev/null
+++ b/simd/jsimd_arm_neon.S
@@ -0,0 +1,2159 @@
+/*
+ * ARM NEON optimizations for libjpeg-turbo
+ *
+ * Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * Author: Siarhei Siamashka <siarhei.siamashka@nokia.com>
+ *
+ * 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.
+ */
+
+#if defined(__linux__) && defined(__ELF__)
+.section .note.GNU-stack,"",%progbits /* mark stack as non-executable */
+#endif
+
+.text
+.fpu neon
+.arch armv7a
+.object_arch armv4
+.arm
+
+
+#define RESPECT_STRICT_ALIGNMENT 1
+
+/*****************************************************************************/
+
+/* Supplementary macro for setting function attributes */
+.macro asm_function fname
+#ifdef __APPLE__
+ .func _\fname
+ .globl _\fname
+_\fname:
+#else
+ .func \fname
+ .global \fname
+#ifdef __ELF__
+ .hidden \fname
+ .type \fname, %function
+#endif
+\fname:
+#endif
+.endm
+
+/* Transpose a block of 4x4 coefficients in four 64-bit registers */
+.macro transpose_4x4 x0, x1, x2, x3
+ vtrn.16 \x0, \x1
+ vtrn.16 \x2, \x3
+ vtrn.32 \x0, \x2
+ vtrn.32 \x1, \x3
+.endm
+
+#define CENTERJSAMPLE 128
+
+/*****************************************************************************/
+
+/*
+ * Perform dequantization and inverse DCT on one block of coefficients.
+ *
+ * GLOBAL(void)
+ * jsimd_idct_islow_neon (void * dct_table, JCOEFPTR coef_block,
+ * JSAMPARRAY output_buf, JDIMENSION output_col)
+ */
+
+#define FIX_0_298631336 (2446)
+#define FIX_0_390180644 (3196)
+#define FIX_0_541196100 (4433)
+#define FIX_0_765366865 (6270)
+#define FIX_0_899976223 (7373)
+#define FIX_1_175875602 (9633)
+#define FIX_1_501321110 (12299)
+#define FIX_1_847759065 (15137)
+#define FIX_1_961570560 (16069)
+#define FIX_2_053119869 (16819)
+#define FIX_2_562915447 (20995)
+#define FIX_3_072711026 (25172)
+
+#define FIX_1_175875602_MINUS_1_961570560 (FIX_1_175875602 - FIX_1_961570560)
+#define FIX_1_175875602_MINUS_0_390180644 (FIX_1_175875602 - FIX_0_390180644)
+#define FIX_0_541196100_MINUS_1_847759065 (FIX_0_541196100 - FIX_1_847759065)
+#define FIX_3_072711026_MINUS_2_562915447 (FIX_3_072711026 - FIX_2_562915447)
+#define FIX_0_298631336_MINUS_0_899976223 (FIX_0_298631336 - FIX_0_899976223)
+#define FIX_1_501321110_MINUS_0_899976223 (FIX_1_501321110 - FIX_0_899976223)
+#define FIX_2_053119869_MINUS_2_562915447 (FIX_2_053119869 - FIX_2_562915447)
+#define FIX_0_541196100_PLUS_0_765366865 (FIX_0_541196100 + FIX_0_765366865)
+
+/*
+ * Reference SIMD-friendly 1-D ISLOW iDCT C implementation.
+ * Uses some ideas from the comments in 'simd/jiss2int-64.asm'
+ */
+#define REF_1D_IDCT(xrow0, xrow1, xrow2, xrow3, xrow4, xrow5, xrow6, xrow7) \
+{ \
+ DCTELEM row0, row1, row2, row3, row4, row5, row6, row7; \
+ INT32 q1, q2, q3, q4, q5, q6, q7; \
+ INT32 tmp11_plus_tmp2, tmp11_minus_tmp2; \
+ \
+ /* 1-D iDCT input data */ \
+ row0 = xrow0; \
+ row1 = xrow1; \
+ row2 = xrow2; \
+ row3 = xrow3; \
+ row4 = xrow4; \
+ row5 = xrow5; \
+ row6 = xrow6; \
+ row7 = xrow7; \
+ \
+ q5 = row7 + row3; \
+ q4 = row5 + row1; \
+ q6 = MULTIPLY(q5, FIX_1_175875602_MINUS_1_961570560) + \
+ MULTIPLY(q4, FIX_1_175875602); \
+ q7 = MULTIPLY(q5, FIX_1_175875602) + \
+ MULTIPLY(q4, FIX_1_175875602_MINUS_0_390180644); \
+ q2 = MULTIPLY(row2, FIX_0_541196100) + \
+ MULTIPLY(row6, FIX_0_541196100_MINUS_1_847759065); \
+ q4 = q6; \
+ q3 = ((INT32) row0 - (INT32) row4) << 13; \
+ q6 += MULTIPLY(row5, -FIX_2_562915447) + \
+ MULTIPLY(row3, FIX_3_072711026_MINUS_2_562915447); \
+ /* now we can use q1 (reloadable constants have been used up) */ \
+ q1 = q3 + q2; \
+ q4 += MULTIPLY(row7, FIX_0_298631336_MINUS_0_899976223) + \
+ MULTIPLY(row1, -FIX_0_899976223); \
+ q5 = q7; \
+ q1 = q1 + q6; \
+ q7 += MULTIPLY(row7, -FIX_0_899976223) + \
+ MULTIPLY(row1, FIX_1_501321110_MINUS_0_899976223); \
+ \
+ /* (tmp11 + tmp2) has been calculated (out_row1 before descale) */ \
+ tmp11_plus_tmp2 = q1; \
+ row1 = 0; \
+ \
+ q1 = q1 - q6; \
+ q5 += MULTIPLY(row5, FIX_2_053119869_MINUS_2_562915447) + \
+ MULTIPLY(row3, -FIX_2_562915447); \
+ q1 = q1 - q6; \
+ q6 = MULTIPLY(row2, FIX_0_541196100_PLUS_0_765366865) + \
+ MULTIPLY(row6, FIX_0_541196100); \
+ q3 = q3 - q2; \
+ \
+ /* (tmp11 - tmp2) has been calculated (out_row6 before descale) */ \
+ tmp11_minus_tmp2 = q1; \
+ \
+ q1 = ((INT32) row0 + (INT32) row4) << 13; \
+ q2 = q1 + q6; \
+ q1 = q1 - q6; \
+ \
+ /* pick up the results */ \
+ tmp0 = q4; \
+ tmp1 = q5; \
+ tmp2 = (tmp11_plus_tmp2 - tmp11_minus_tmp2) / 2; \
+ tmp3 = q7; \
+ tmp10 = q2; \
+ tmp11 = (tmp11_plus_tmp2 + tmp11_minus_tmp2) / 2; \
+ tmp12 = q3; \
+ tmp13 = q1; \
+}
+
+#define XFIX_0_899976223 d0[0]
+#define XFIX_0_541196100 d0[1]
+#define XFIX_2_562915447 d0[2]
+#define XFIX_0_298631336_MINUS_0_899976223 d0[3]
+#define XFIX_1_501321110_MINUS_0_899976223 d1[0]
+#define XFIX_2_053119869_MINUS_2_562915447 d1[1]
+#define XFIX_0_541196100_PLUS_0_765366865 d1[2]
+#define XFIX_1_175875602 d1[3]
+#define XFIX_1_175875602_MINUS_0_390180644 d2[0]
+#define XFIX_0_541196100_MINUS_1_847759065 d2[1]
+#define XFIX_3_072711026_MINUS_2_562915447 d2[2]
+#define XFIX_1_175875602_MINUS_1_961570560 d2[3]
+
+.balign 16
+jsimd_idct_islow_neon_consts:
+ .short FIX_0_899976223 /* d0[0] */
+ .short FIX_0_541196100 /* d0[1] */
+ .short FIX_2_562915447 /* d0[2] */
+ .short FIX_0_298631336_MINUS_0_899976223 /* d0[3] */
+ .short FIX_1_501321110_MINUS_0_899976223 /* d1[0] */
+ .short FIX_2_053119869_MINUS_2_562915447 /* d1[1] */
+ .short FIX_0_541196100_PLUS_0_765366865 /* d1[2] */
+ .short FIX_1_175875602 /* d1[3] */
+ /* reloadable constants */
+ .short FIX_1_175875602_MINUS_0_390180644 /* d2[0] */
+ .short FIX_0_541196100_MINUS_1_847759065 /* d2[1] */
+ .short FIX_3_072711026_MINUS_2_562915447 /* d2[2] */
+ .short FIX_1_175875602_MINUS_1_961570560 /* d2[3] */
+
+asm_function jsimd_idct_islow_neon
+
+ DCT_TABLE .req r0
+ COEF_BLOCK .req r1
+ OUTPUT_BUF .req r2
+ OUTPUT_COL .req r3
+ TMP1 .req r0
+ TMP2 .req r1
+ TMP3 .req r2
+ TMP4 .req ip
+
+ ROW0L .req d16
+ ROW0R .req d17
+ ROW1L .req d18
+ ROW1R .req d19
+ ROW2L .req d20
+ ROW2R .req d21
+ ROW3L .req d22
+ ROW3R .req d23
+ ROW4L .req d24
+ ROW4R .req d25
+ ROW5L .req d26
+ ROW5R .req d27
+ ROW6L .req d28
+ ROW6R .req d29
+ ROW7L .req d30
+ ROW7R .req d31
+
+ /* Load and dequantize coefficients into NEON registers
+ * with the following allocation:
+ * 0 1 2 3 | 4 5 6 7
+ * ---------+--------
+ * 0 | d16 | d17 ( q8 )
+ * 1 | d18 | d19 ( q9 )
+ * 2 | d20 | d21 ( q10 )
+ * 3 | d22 | d23 ( q11 )
+ * 4 | d24 | d25 ( q12 )
+ * 5 | d26 | d27 ( q13 )
+ * 6 | d28 | d29 ( q14 )
+ * 7 | d30 | d31 ( q15 )
+ */
+ adr ip, jsimd_idct_islow_neon_consts
+ vld1.16 {d16, d17, d18, d19}, [COEF_BLOCK, :128]!
+ vld1.16 {d0, d1, d2, d3}, [DCT_TABLE, :128]!
+ vld1.16 {d20, d21, d22, d23}, [COEF_BLOCK, :128]!
+ vmul.s16 q8, q8, q0
+ vld1.16 {d4, d5, d6, d7}, [DCT_TABLE, :128]!
+ vmul.s16 q9, q9, q1
+ vld1.16 {d24, d25, d26, d27}, [COEF_BLOCK, :128]!
+ vmul.s16 q10, q10, q2
+ vld1.16 {d0, d1, d2, d3}, [DCT_TABLE, :128]!
+ vmul.s16 q11, q11, q3
+ vld1.16 {d28, d29, d30, d31}, [COEF_BLOCK, :128]
+ vmul.s16 q12, q12, q0
+ vld1.16 {d4, d5, d6, d7}, [DCT_TABLE, :128]!
+ vmul.s16 q14, q14, q2
+ vmul.s16 q13, q13, q1
+ vld1.16 {d0, d1, d2, d3}, [ip, :128] /* load constants */
+ add ip, ip, #16
+ vmul.s16 q15, q15, q3
+ vpush {d8-d15} /* save NEON registers */
+ /* 1-D IDCT, pass 1, left 4x8 half */
+ vadd.s16 d4, ROW7L, ROW3L
+ vadd.s16 d5, ROW5L, ROW1L
+ vmull.s16 q6, d4, XFIX_1_175875602_MINUS_1_961570560
+ vmlal.s16 q6, d5, XFIX_1_175875602
+ vmull.s16 q7, d4, XFIX_1_175875602
+ /* Check for the zero coefficients in the right 4x8 half */
+ push {r4, r5}
+ vmlal.s16 q7, d5, XFIX_1_175875602_MINUS_0_390180644
+ vsubl.s16 q3, ROW0L, ROW4L
+ ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 1 * 8))]
+ vmull.s16 q2, ROW2L, XFIX_0_541196100
+ vmlal.s16 q2, ROW6L, XFIX_0_541196100_MINUS_1_847759065
+ orr r0, r4, r5
+ vmov q4, q6
+ vmlsl.s16 q6, ROW5L, XFIX_2_562915447
+ ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 2 * 8))]
+ vmlal.s16 q6, ROW3L, XFIX_3_072711026_MINUS_2_562915447
+ vshl.s32 q3, q3, #13
+ orr r0, r0, r4
+ vmlsl.s16 q4, ROW1L, XFIX_0_899976223
+ orr r0, r0, r5
+ vadd.s32 q1, q3, q2
+ ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 3 * 8))]
+ vmov q5, q7
+ vadd.s32 q1, q1, q6
+ orr r0, r0, r4
+ vmlsl.s16 q7, ROW7L, XFIX_0_899976223
+ orr r0, r0, r5
+ vmlal.s16 q7, ROW1L, XFIX_1_501321110_MINUS_0_899976223
+ vrshrn.s32 ROW1L, q1, #11
+ ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 4 * 8))]
+ vsub.s32 q1, q1, q6
+ vmlal.s16 q5, ROW5L, XFIX_2_053119869_MINUS_2_562915447
+ orr r0, r0, r4
+ vmlsl.s16 q5, ROW3L, XFIX_2_562915447
+ orr r0, r0, r5
+ vsub.s32 q1, q1, q6
+ vmull.s16 q6, ROW2L, XFIX_0_541196100_PLUS_0_765366865
+ ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 5 * 8))]
+ vmlal.s16 q6, ROW6L, XFIX_0_541196100
+ vsub.s32 q3, q3, q2
+ orr r0, r0, r4
+ vrshrn.s32 ROW6L, q1, #11
+ orr r0, r0, r5
+ vadd.s32 q1, q3, q5
+ ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 6 * 8))]
+ vsub.s32 q3, q3, q5
+ vaddl.s16 q5, ROW0L, ROW4L
+ orr r0, r0, r4
+ vrshrn.s32 ROW2L, q1, #11
+ orr r0, r0, r5
+ vrshrn.s32 ROW5L, q3, #11
+ ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 7 * 8))]
+ vshl.s32 q5, q5, #13
+ vmlal.s16 q4, ROW7L, XFIX_0_298631336_MINUS_0_899976223
+ orr r0, r0, r4
+ vadd.s32 q2, q5, q6
+ orrs r0, r0, r5
+ vsub.s32 q1, q5, q6
+ vadd.s32 q6, q2, q7
+ ldrd r4, [COEF_BLOCK, #(-96 + 2 * (4 + 0 * 8))]
+ vsub.s32 q2, q2, q7
+ vadd.s32 q5, q1, q4
+ orr r0, r4, r5
+ vsub.s32 q3, q1, q4
+ pop {r4, r5}
+ vrshrn.s32 ROW7L, q2, #11
+ vrshrn.s32 ROW3L, q5, #11
+ vrshrn.s32 ROW0L, q6, #11
+ vrshrn.s32 ROW4L, q3, #11
+
+ beq 3f /* Go to do some special handling for the sparse right 4x8 half */
+
+ /* 1-D IDCT, pass 1, right 4x8 half */
+ vld1.s16 {d2}, [ip, :64] /* reload constants */
+ vadd.s16 d10, ROW7R, ROW3R
+ vadd.s16 d8, ROW5R, ROW1R
+ /* Transpose left 4x8 half */
+ vtrn.16 ROW6L, ROW7L
+ vmull.s16 q6, d10, XFIX_1_175875602_MINUS_1_961570560
+ vmlal.s16 q6, d8, XFIX_1_175875602
+ vtrn.16 ROW2L, ROW3L
+ vmull.s16 q7, d10, XFIX_1_175875602
+ vmlal.s16 q7, d8, XFIX_1_175875602_MINUS_0_390180644
+ vtrn.16 ROW0L, ROW1L
+ vsubl.s16 q3, ROW0R, ROW4R
+ vmull.s16 q2, ROW2R, XFIX_0_541196100
+ vmlal.s16 q2, ROW6R, XFIX_0_541196100_MINUS_1_847759065
+ vtrn.16 ROW4L, ROW5L
+ vmov q4, q6
+ vmlsl.s16 q6, ROW5R, XFIX_2_562915447
+ vmlal.s16 q6, ROW3R, XFIX_3_072711026_MINUS_2_562915447
+ vtrn.32 ROW1L, ROW3L
+ vshl.s32 q3, q3, #13
+ vmlsl.s16 q4, ROW1R, XFIX_0_899976223
+ vtrn.32 ROW4L, ROW6L
+ vadd.s32 q1, q3, q2
+ vmov q5, q7
+ vadd.s32 q1, q1, q6
+ vtrn.32 ROW0L, ROW2L
+ vmlsl.s16 q7, ROW7R, XFIX_0_899976223
+ vmlal.s16 q7, ROW1R, XFIX_1_501321110_MINUS_0_899976223
+ vrshrn.s32 ROW1R, q1, #11
+ vtrn.32 ROW5L, ROW7L
+ vsub.s32 q1, q1, q6
+ vmlal.s16 q5, ROW5R, XFIX_2_053119869_MINUS_2_562915447
+ vmlsl.s16 q5, ROW3R, XFIX_2_562915447
+ vsub.s32 q1, q1, q6
+ vmull.s16 q6, ROW2R, XFIX_0_541196100_PLUS_0_765366865
+ vmlal.s16 q6, ROW6R, XFIX_0_541196100
+ vsub.s32 q3, q3, q2
+ vrshrn.s32 ROW6R, q1, #11
+ vadd.s32 q1, q3, q5
+ vsub.s32 q3, q3, q5
+ vaddl.s16 q5, ROW0R, ROW4R
+ vrshrn.s32 ROW2R, q1, #11
+ vrshrn.s32 ROW5R, q3, #11
+ vshl.s32 q5, q5, #13
+ vmlal.s16 q4, ROW7R, XFIX_0_298631336_MINUS_0_899976223
+ vadd.s32 q2, q5, q6
+ vsub.s32 q1, q5, q6
+ vadd.s32 q6, q2, q7
+ vsub.s32 q2, q2, q7
+ vadd.s32 q5, q1, q4
+ vsub.s32 q3, q1, q4
+ vrshrn.s32 ROW7R, q2, #11
+ vrshrn.s32 ROW3R, q5, #11
+ vrshrn.s32 ROW0R, q6, #11
+ vrshrn.s32 ROW4R, q3, #11
+ /* Transpose right 4x8 half */
+ vtrn.16 ROW6R, ROW7R
+ vtrn.16 ROW2R, ROW3R
+ vtrn.16 ROW0R, ROW1R
+ vtrn.16 ROW4R, ROW5R
+ vtrn.32 ROW1R, ROW3R
+ vtrn.32 ROW4R, ROW6R
+ vtrn.32 ROW0R, ROW2R
+ vtrn.32 ROW5R, ROW7R
+
+1: /* 1-D IDCT, pass 2 (normal variant), left 4x8 half */
+ vld1.s16 {d2}, [ip, :64] /* reload constants */
+ vmull.s16 q6, ROW1R, XFIX_1_175875602 /* ROW5L <-> ROW1R */
+ vmlal.s16 q6, ROW1L, XFIX_1_175875602
+ vmlal.s16 q6, ROW3R, XFIX_1_175875602_MINUS_1_961570560 /* ROW7L <-> ROW3R */
+ vmlal.s16 q6, ROW3L, XFIX_1_175875602_MINUS_1_961570560
+ vmull.s16 q7, ROW3R, XFIX_1_175875602 /* ROW7L <-> ROW3R */
+ vmlal.s16 q7, ROW3L, XFIX_1_175875602
+ vmlal.s16 q7, ROW1R, XFIX_1_175875602_MINUS_0_390180644 /* ROW5L <-> ROW1R */
+ vmlal.s16 q7, ROW1L, XFIX_1_175875602_MINUS_0_390180644
+ vsubl.s16 q3, ROW0L, ROW0R /* ROW4L <-> ROW0R */
+ vmull.s16 q2, ROW2L, XFIX_0_541196100
+ vmlal.s16 q2, ROW2R, XFIX_0_541196100_MINUS_1_847759065 /* ROW6L <-> ROW2R */
+ vmov q4, q6
+ vmlsl.s16 q6, ROW1R, XFIX_2_562915447 /* ROW5L <-> ROW1R */
+ vmlal.s16 q6, ROW3L, XFIX_3_072711026_MINUS_2_562915447
+ vshl.s32 q3, q3, #13
+ vmlsl.s16 q4, ROW1L, XFIX_0_899976223
+ vadd.s32 q1, q3, q2
+ vmov q5, q7
+ vadd.s32 q1, q1, q6
+ vmlsl.s16 q7, ROW3R, XFIX_0_899976223 /* ROW7L <-> ROW3R */
+ vmlal.s16 q7, ROW1L, XFIX_1_501321110_MINUS_0_899976223
+ vshrn.s32 ROW1L, q1, #16
+ vsub.s32 q1, q1, q6
+ vmlal.s16 q5, ROW1R, XFIX_2_053119869_MINUS_2_562915447 /* ROW5L <-> ROW1R */
+ vmlsl.s16 q5, ROW3L, XFIX_2_562915447
+ vsub.s32 q1, q1, q6
+ vmull.s16 q6, ROW2L, XFIX_0_541196100_PLUS_0_765366865
+ vmlal.s16 q6, ROW2R, XFIX_0_541196100 /* ROW6L <-> ROW2R */
+ vsub.s32 q3, q3, q2
+ vshrn.s32 ROW2R, q1, #16 /* ROW6L <-> ROW2R */
+ vadd.s32 q1, q3, q5
+ vsub.s32 q3, q3, q5
+ vaddl.s16 q5, ROW0L, ROW0R /* ROW4L <-> ROW0R */
+ vshrn.s32 ROW2L, q1, #16
+ vshrn.s32 ROW1R, q3, #16 /* ROW5L <-> ROW1R */
+ vshl.s32 q5, q5, #13
+ vmlal.s16 q4, ROW3R, XFIX_0_298631336_MINUS_0_899976223 /* ROW7L <-> ROW3R */
+ vadd.s32 q2, q5, q6
+ vsub.s32 q1, q5, q6
+ vadd.s32 q6, q2, q7
+ vsub.s32 q2, q2, q7
+ vadd.s32 q5, q1, q4
+ vsub.s32 q3, q1, q4
+ vshrn.s32 ROW3R, q2, #16 /* ROW7L <-> ROW3R */
+ vshrn.s32 ROW3L, q5, #16
+ vshrn.s32 ROW0L, q6, #16
+ vshrn.s32 ROW0R, q3, #16 /* ROW4L <-> ROW0R */
+ /* 1-D IDCT, pass 2, right 4x8 half */
+ vld1.s16 {d2}, [ip, :64] /* reload constants */
+ vmull.s16 q6, ROW5R, XFIX_1_175875602
+ vmlal.s16 q6, ROW5L, XFIX_1_175875602 /* ROW5L <-> ROW1R */
+ vmlal.s16 q6, ROW7R, XFIX_1_175875602_MINUS_1_961570560
+ vmlal.s16 q6, ROW7L, XFIX_1_175875602_MINUS_1_961570560 /* ROW7L <-> ROW3R */
+ vmull.s16 q7, ROW7R, XFIX_1_175875602
+ vmlal.s16 q7, ROW7L, XFIX_1_175875602 /* ROW7L <-> ROW3R */
+ vmlal.s16 q7, ROW5R, XFIX_1_175875602_MINUS_0_390180644
+ vmlal.s16 q7, ROW5L, XFIX_1_175875602_MINUS_0_390180644 /* ROW5L <-> ROW1R */
+ vsubl.s16 q3, ROW4L, ROW4R /* ROW4L <-> ROW0R */
+ vmull.s16 q2, ROW6L, XFIX_0_541196100 /* ROW6L <-> ROW2R */
+ vmlal.s16 q2, ROW6R, XFIX_0_541196100_MINUS_1_847759065
+ vmov q4, q6
+ vmlsl.s16 q6, ROW5R, XFIX_2_562915447
+ vmlal.s16 q6, ROW7L, XFIX_3_072711026_MINUS_2_562915447 /* ROW7L <-> ROW3R */
+ vshl.s32 q3, q3, #13
+ vmlsl.s16 q4, ROW5L, XFIX_0_899976223 /* ROW5L <-> ROW1R */
+ vadd.s32 q1, q3, q2
+ vmov q5, q7
+ vadd.s32 q1, q1, q6
+ vmlsl.s16 q7, ROW7R, XFIX_0_899976223
+ vmlal.s16 q7, ROW5L, XFIX_1_501321110_MINUS_0_899976223 /* ROW5L <-> ROW1R */
+ vshrn.s32 ROW5L, q1, #16 /* ROW5L <-> ROW1R */
+ vsub.s32 q1, q1, q6
+ vmlal.s16 q5, ROW5R, XFIX_2_053119869_MINUS_2_562915447
+ vmlsl.s16 q5, ROW7L, XFIX_2_562915447 /* ROW7L <-> ROW3R */
+ vsub.s32 q1, q1, q6
+ vmull.s16 q6, ROW6L, XFIX_0_541196100_PLUS_0_765366865 /* ROW6L <-> ROW2R */
+ vmlal.s16 q6, ROW6R, XFIX_0_541196100
+ vsub.s32 q3, q3, q2
+ vshrn.s32 ROW6R, q1, #16
+ vadd.s32 q1, q3, q5
+ vsub.s32 q3, q3, q5
+ vaddl.s16 q5, ROW4L, ROW4R /* ROW4L <-> ROW0R */
+ vshrn.s32 ROW6L, q1, #16 /* ROW6L <-> ROW2R */
+ vshrn.s32 ROW5R, q3, #16
+ vshl.s32 q5, q5, #13
+ vmlal.s16 q4, ROW7R, XFIX_0_298631336_MINUS_0_899976223
+ vadd.s32 q2, q5, q6
+ vsub.s32 q1, q5, q6
+ vadd.s32 q6, q2, q7
+ vsub.s32 q2, q2, q7
+ vadd.s32 q5, q1, q4
+ vsub.s32 q3, q1, q4
+ vshrn.s32 ROW7R, q2, #16
+ vshrn.s32 ROW7L, q5, #16 /* ROW7L <-> ROW3R */
+ vshrn.s32 ROW4L, q6, #16 /* ROW4L <-> ROW0R */
+ vshrn.s32 ROW4R, q3, #16
+
+2: /* Descale to 8-bit and range limit */
+ vqrshrn.s16 d16, q8, #2
+ vqrshrn.s16 d17, q9, #2
+ vqrshrn.s16 d18, q10, #2
+ vqrshrn.s16 d19, q11, #2
+ vpop {d8-d15} /* restore NEON registers */
+ vqrshrn.s16 d20, q12, #2
+ /* Transpose the final 8-bit samples and do signed->unsigned conversion */
+ vtrn.16 q8, q9
+ vqrshrn.s16 d21, q13, #2
+ vqrshrn.s16 d22, q14, #2
+ vmov.u8 q0, #(CENTERJSAMPLE)
+ vqrshrn.s16 d23, q15, #2
+ vtrn.8 d16, d17
+ vtrn.8 d18, d19
+ vadd.u8 q8, q8, q0
+ vadd.u8 q9, q9, q0
+ vtrn.16 q10, q11
+ /* Store results to the output buffer */
+ ldmia OUTPUT_BUF!, {TMP1, TMP2}
+ add TMP1, TMP1, OUTPUT_COL
+ add TMP2, TMP2, OUTPUT_COL
+ vst1.8 {d16}, [TMP1]
+ vtrn.8 d20, d21
+ vst1.8 {d17}, [TMP2]
+ ldmia OUTPUT_BUF!, {TMP1, TMP2}
+ add TMP1, TMP1, OUTPUT_COL
+ add TMP2, TMP2, OUTPUT_COL
+ vst1.8 {d18}, [TMP1]
+ vadd.u8 q10, q10, q0
+ vst1.8 {d19}, [TMP2]
+ ldmia OUTPUT_BUF, {TMP1, TMP2, TMP3, TMP4}
+ add TMP1, TMP1, OUTPUT_COL
+ add TMP2, TMP2, OUTPUT_COL
+ add TMP3, TMP3, OUTPUT_COL
+ add TMP4, TMP4, OUTPUT_COL
+ vtrn.8 d22, d23
+ vst1.8 {d20}, [TMP1]
+ vadd.u8 q11, q11, q0
+ vst1.8 {d21}, [TMP2]
+ vst1.8 {d22}, [TMP3]
+ vst1.8 {d23}, [TMP4]
+ bx lr
+
+3: /* Left 4x8 half is done, right 4x8 half contains mostly zeros */
+
+ /* Transpose left 4x8 half */
+ vtrn.16 ROW6L, ROW7L
+ vtrn.16 ROW2L, ROW3L
+ vtrn.16 ROW0L, ROW1L
+ vtrn.16 ROW4L, ROW5L
+ vshl.s16 ROW0R, ROW0R, #2 /* PASS1_BITS */
+ vtrn.32 ROW1L, ROW3L
+ vtrn.32 ROW4L, ROW6L
+ vtrn.32 ROW0L, ROW2L
+ vtrn.32 ROW5L, ROW7L
+
+ cmp r0, #0
+ beq 4f /* Right 4x8 half has all zeros, go to 'sparse' second pass */
+
+ /* Only row 0 is non-zero for the right 4x8 half */
+ vdup.s16 ROW1R, ROW0R[1]
+ vdup.s16 ROW2R, ROW0R[2]
+ vdup.s16 ROW3R, ROW0R[3]
+ vdup.s16 ROW4R, ROW0R[0]
+ vdup.s16 ROW5R, ROW0R[1]
+ vdup.s16 ROW6R, ROW0R[2]
+ vdup.s16 ROW7R, ROW0R[3]
+ vdup.s16 ROW0R, ROW0R[0]
+ b 1b /* Go to 'normal' second pass */
+
+4: /* 1-D IDCT, pass 2 (sparse variant with zero rows 4-7), left 4x8 half */
+ vld1.s16 {d2}, [ip, :64] /* reload constants */
+ vmull.s16 q6, ROW1L, XFIX_1_175875602
+ vmlal.s16 q6, ROW3L, XFIX_1_175875602_MINUS_1_961570560
+ vmull.s16 q7, ROW3L, XFIX_1_175875602
+ vmlal.s16 q7, ROW1L, XFIX_1_175875602_MINUS_0_390180644
+ vmull.s16 q2, ROW2L, XFIX_0_541196100
+ vshll.s16 q3, ROW0L, #13
+ vmov q4, q6
+ vmlal.s16 q6, ROW3L, XFIX_3_072711026_MINUS_2_562915447
+ vmlsl.s16 q4, ROW1L, XFIX_0_899976223
+ vadd.s32 q1, q3, q2
+ vmov q5, q7
+ vmlal.s16 q7, ROW1L, XFIX_1_501321110_MINUS_0_899976223
+ vadd.s32 q1, q1, q6
+ vadd.s32 q6, q6, q6
+ vmlsl.s16 q5, ROW3L, XFIX_2_562915447
+ vshrn.s32 ROW1L, q1, #16
+ vsub.s32 q1, q1, q6
+ vmull.s16 q6, ROW2L, XFIX_0_541196100_PLUS_0_765366865
+ vsub.s32 q3, q3, q2
+ vshrn.s32 ROW2R, q1, #16 /* ROW6L <-> ROW2R */
+ vadd.s32 q1, q3, q5
+ vsub.s32 q3, q3, q5
+ vshll.s16 q5, ROW0L, #13
+ vshrn.s32 ROW2L, q1, #16
+ vshrn.s32 ROW1R, q3, #16 /* ROW5L <-> ROW1R */
+ vadd.s32 q2, q5, q6
+ vsub.s32 q1, q5, q6
+ vadd.s32 q6, q2, q7
+ vsub.s32 q2, q2, q7
+ vadd.s32 q5, q1, q4
+ vsub.s32 q3, q1, q4
+ vshrn.s32 ROW3R, q2, #16 /* ROW7L <-> ROW3R */
+ vshrn.s32 ROW3L, q5, #16
+ vshrn.s32 ROW0L, q6, #16
+ vshrn.s32 ROW0R, q3, #16 /* ROW4L <-> ROW0R */
+ /* 1-D IDCT, pass 2 (sparse variant with zero rows 4-7), right 4x8 half */
+ vld1.s16 {d2}, [ip, :64] /* reload constants */
+ vmull.s16 q6, ROW5L, XFIX_1_175875602
+ vmlal.s16 q6, ROW7L, XFIX_1_175875602_MINUS_1_961570560
+ vmull.s16 q7, ROW7L, XFIX_1_175875602
+ vmlal.s16 q7, ROW5L, XFIX_1_175875602_MINUS_0_390180644
+ vmull.s16 q2, ROW6L, XFIX_0_541196100
+ vshll.s16 q3, ROW4L, #13
+ vmov q4, q6
+ vmlal.s16 q6, ROW7L, XFIX_3_072711026_MINUS_2_562915447
+ vmlsl.s16 q4, ROW5L, XFIX_0_899976223
+ vadd.s32 q1, q3, q2
+ vmov q5, q7
+ vmlal.s16 q7, ROW5L, XFIX_1_501321110_MINUS_0_899976223
+ vadd.s32 q1, q1, q6
+ vadd.s32 q6, q6, q6
+ vmlsl.s16 q5, ROW7L, XFIX_2_562915447
+ vshrn.s32 ROW5L, q1, #16 /* ROW5L <-> ROW1R */
+ vsub.s32 q1, q1, q6
+ vmull.s16 q6, ROW6L, XFIX_0_541196100_PLUS_0_765366865
+ vsub.s32 q3, q3, q2
+ vshrn.s32 ROW6R, q1, #16
+ vadd.s32 q1, q3, q5
+ vsub.s32 q3, q3, q5
+ vshll.s16 q5, ROW4L, #13
+ vshrn.s32 ROW6L, q1, #16 /* ROW6L <-> ROW2R */
+ vshrn.s32 ROW5R, q3, #16
+ vadd.s32 q2, q5, q6
+ vsub.s32 q1, q5, q6
+ vadd.s32 q6, q2, q7
+ vsub.s32 q2, q2, q7
+ vadd.s32 q5, q1, q4
+ vsub.s32 q3, q1, q4
+ vshrn.s32 ROW7R, q2, #16
+ vshrn.s32 ROW7L, q5, #16 /* ROW7L <-> ROW3R */
+ vshrn.s32 ROW4L, q6, #16 /* ROW4L <-> ROW0R */
+ vshrn.s32 ROW4R, q3, #16
+ b 2b /* Go to epilogue */
+
+ .unreq DCT_TABLE
+ .unreq COEF_BLOCK
+ .unreq OUTPUT_BUF
+ .unreq OUTPUT_COL
+ .unreq TMP1
+ .unreq TMP2
+ .unreq TMP3
+ .unreq TMP4
+
+ .unreq ROW0L
+ .unreq ROW0R
+ .unreq ROW1L
+ .unreq ROW1R
+ .unreq ROW2L
+ .unreq ROW2R
+ .unreq ROW3L
+ .unreq ROW3R
+ .unreq ROW4L
+ .unreq ROW4R
+ .unreq ROW5L
+ .unreq ROW5R
+ .unreq ROW6L
+ .unreq ROW6R
+ .unreq ROW7L
+ .unreq ROW7R
+.endfunc
+
+/*****************************************************************************/
+
+/*
+ * jsimd_idct_ifast_neon
+ *
+ * This function contains a fast, not so accurate integer implementation of
+ * the inverse DCT (Discrete Cosine Transform). It uses the same calculations
+ * and produces exactly the same output as IJG's original 'jpeg_idct_ifast'
+ * function from jidctfst.c
+ *
+ * Normally 1-D AAN DCT needs 5 multiplications and 29 additions.
+ * But in ARM NEON case some extra additions are required because VQDMULH
+ * instruction can't handle the constants larger than 1. So the expressions
+ * like "x * 1.082392200" have to be converted to "x * 0.082392200 + x",
+ * which introduces an extra addition. Overall, there are 6 extra additions
+ * per 1-D IDCT pass, totalling to 5 VQDMULH and 35 VADD/VSUB instructions.
+ */
+
+#define XFIX_1_082392200 d0[0]
+#define XFIX_1_414213562 d0[1]
+#define XFIX_1_847759065 d0[2]
+#define XFIX_2_613125930 d0[3]
+
+.balign 16
+jsimd_idct_ifast_neon_consts:
+ .short (277 * 128 - 256 * 128) /* XFIX_1_082392200 */
+ .short (362 * 128 - 256 * 128) /* XFIX_1_414213562 */
+ .short (473 * 128 - 256 * 128) /* XFIX_1_847759065 */
+ .short (669 * 128 - 512 * 128) /* XFIX_2_613125930 */
+
+asm_function jsimd_idct_ifast_neon
+
+ DCT_TABLE .req r0
+ COEF_BLOCK .req r1
+ OUTPUT_BUF .req r2
+ OUTPUT_COL .req r3
+ TMP1 .req r0
+ TMP2 .req r1
+ TMP3 .req r2
+ TMP4 .req ip
+
+ /* Load and dequantize coefficients into NEON registers
+ * with the following allocation:
+ * 0 1 2 3 | 4 5 6 7
+ * ---------+--------
+ * 0 | d16 | d17 ( q8 )
+ * 1 | d18 | d19 ( q9 )
+ * 2 | d20 | d21 ( q10 )
+ * 3 | d22 | d23 ( q11 )
+ * 4 | d24 | d25 ( q12 )
+ * 5 | d26 | d27 ( q13 )
+ * 6 | d28 | d29 ( q14 )
+ * 7 | d30 | d31 ( q15 )
+ */
+ adr ip, jsimd_idct_ifast_neon_consts
+ vld1.16 {d16, d17, d18, d19}, [COEF_BLOCK, :128]!
+ vld1.16 {d0, d1, d2, d3}, [DCT_TABLE, :128]!
+ vld1.16 {d20, d21, d22, d23}, [COEF_BLOCK, :128]!
+ vmul.s16 q8, q8, q0
+ vld1.16 {d4, d5, d6, d7}, [DCT_TABLE, :128]!
+ vmul.s16 q9, q9, q1
+ vld1.16 {d24, d25, d26, d27}, [COEF_BLOCK, :128]!
+ vmul.s16 q10, q10, q2
+ vld1.16 {d0, d1, d2, d3}, [DCT_TABLE, :128]!
+ vmul.s16 q11, q11, q3
+ vld1.16 {d28, d29, d30, d31}, [COEF_BLOCK, :128]
+ vmul.s16 q12, q12, q0
+ vld1.16 {d4, d5, d6, d7}, [DCT_TABLE, :128]!
+ vmul.s16 q14, q14, q2
+ vmul.s16 q13, q13, q1
+ vld1.16 {d0}, [ip, :64] /* load constants */
+ vmul.s16 q15, q15, q3
+ vpush {d8-d13} /* save NEON registers */
+ /* 1-D IDCT, pass 1 */
+ vsub.s16 q2, q10, q14
+ vadd.s16 q14, q10, q14
+ vsub.s16 q1, q11, q13
+ vadd.s16 q13, q11, q13
+ vsub.s16 q5, q9, q15
+ vadd.s16 q15, q9, q15
+ vqdmulh.s16 q4, q2, XFIX_1_414213562
+ vqdmulh.s16 q6, q1, XFIX_2_613125930
+ vadd.s16 q3, q1, q1
+ vsub.s16 q1, q5, q1
+ vadd.s16 q10, q2, q4
+ vqdmulh.s16 q4, q1, XFIX_1_847759065
+ vsub.s16 q2, q15, q13
+ vadd.s16 q3, q3, q6
+ vqdmulh.s16 q6, q2, XFIX_1_414213562
+ vadd.s16 q1, q1, q4
+ vqdmulh.s16 q4, q5, XFIX_1_082392200
+ vsub.s16 q10, q10, q14
+ vadd.s16 q2, q2, q6
+ vsub.s16 q6, q8, q12
+ vadd.s16 q12, q8, q12
+ vadd.s16 q9, q5, q4
+ vadd.s16 q5, q6, q10
+ vsub.s16 q10, q6, q10
+ vadd.s16 q6, q15, q13
+ vadd.s16 q8, q12, q14
+ vsub.s16 q3, q6, q3
+ vsub.s16 q12, q12, q14
+ vsub.s16 q3, q3, q1
+ vsub.s16 q1, q9, q1
+ vadd.s16 q2, q3, q2
+ vsub.s16 q15, q8, q6
+ vadd.s16 q1, q1, q2
+ vadd.s16 q8, q8, q6
+ vadd.s16 q14, q5, q3
+ vsub.s16 q9, q5, q3
+ vsub.s16 q13, q10, q2
+ vadd.s16 q10, q10, q2
+ /* Transpose */
+ vtrn.16 q8, q9
+ vsub.s16 q11, q12, q1
+ vtrn.16 q14, q15
+ vadd.s16 q12, q12, q1
+ vtrn.16 q10, q11
+ vtrn.16 q12, q13
+ vtrn.32 q9, q11
+ vtrn.32 q12, q14
+ vtrn.32 q8, q10
+ vtrn.32 q13, q15
+ vswp d28, d21
+ vswp d26, d19
+ /* 1-D IDCT, pass 2 */
+ vsub.s16 q2, q10, q14
+ vswp d30, d23
+ vadd.s16 q14, q10, q14
+ vswp d24, d17
+ vsub.s16 q1, q11, q13
+ vadd.s16 q13, q11, q13
+ vsub.s16 q5, q9, q15
+ vadd.s16 q15, q9, q15
+ vqdmulh.s16 q4, q2, XFIX_1_414213562
+ vqdmulh.s16 q6, q1, XFIX_2_613125930
+ vadd.s16 q3, q1, q1
+ vsub.s16 q1, q5, q1
+ vadd.s16 q10, q2, q4
+ vqdmulh.s16 q4, q1, XFIX_1_847759065
+ vsub.s16 q2, q15, q13
+ vadd.s16 q3, q3, q6
+ vqdmulh.s16 q6, q2, XFIX_1_414213562
+ vadd.s16 q1, q1, q4
+ vqdmulh.s16 q4, q5, XFIX_1_082392200
+ vsub.s16 q10, q10, q14
+ vadd.s16 q2, q2, q6
+ vsub.s16 q6, q8, q12
+ vadd.s16 q12, q8, q12
+ vadd.s16 q9, q5, q4
+ vadd.s16 q5, q6, q10
+ vsub.s16 q10, q6, q10
+ vadd.s16 q6, q15, q13
+ vadd.s16 q8, q12, q14
+ vsub.s16 q3, q6, q3
+ vsub.s16 q12, q12, q14
+ vsub.s16 q3, q3, q1
+ vsub.s16 q1, q9, q1
+ vadd.s16 q2, q3, q2
+ vsub.s16 q15, q8, q6
+ vadd.s16 q1, q1, q2
+ vadd.s16 q8, q8, q6
+ vadd.s16 q14, q5, q3
+ vsub.s16 q9, q5, q3
+ vsub.s16 q13, q10, q2
+ vpop {d8-d13} /* restore NEON registers */
+ vadd.s16 q10, q10, q2
+ vsub.s16 q11, q12, q1
+ vadd.s16 q12, q12, q1
+ /* Descale to 8-bit and range limit */
+ vmov.u8 q0, #0x80
+ vqshrn.s16 d16, q8, #5
+ vqshrn.s16 d17, q9, #5
+ vqshrn.s16 d18, q10, #5
+ vqshrn.s16 d19, q11, #5
+ vqshrn.s16 d20, q12, #5
+ vqshrn.s16 d21, q13, #5
+ vqshrn.s16 d22, q14, #5
+ vqshrn.s16 d23, q15, #5
+ vadd.u8 q8, q8, q0
+ vadd.u8 q9, q9, q0
+ vadd.u8 q10, q10, q0
+ vadd.u8 q11, q11, q0
+ /* Transpose the final 8-bit samples */
+ vtrn.16 q8, q9
+ vtrn.16 q10, q11
+ vtrn.32 q8, q10
+ vtrn.32 q9, q11
+ vtrn.8 d16, d17
+ vtrn.8 d18, d19
+ /* Store results to the output buffer */
+ ldmia OUTPUT_BUF!, {TMP1, TMP2}
+ add TMP1, TMP1, OUTPUT_COL
+ add TMP2, TMP2, OUTPUT_COL
+ vst1.8 {d16}, [TMP1]
+ vst1.8 {d17}, [TMP2]
+ ldmia OUTPUT_BUF!, {TMP1, TMP2}
+ add TMP1, TMP1, OUTPUT_COL
+ add TMP2, TMP2, OUTPUT_COL
+ vst1.8 {d18}, [TMP1]
+ vtrn.8 d20, d21
+ vst1.8 {d19}, [TMP2]
+ ldmia OUTPUT_BUF, {TMP1, TMP2, TMP3, TMP4}
+ add TMP1, TMP1, OUTPUT_COL
+ add TMP2, TMP2, OUTPUT_COL
+ add TMP3, TMP3, OUTPUT_COL
+ add TMP4, TMP4, OUTPUT_COL
+ vst1.8 {d20}, [TMP1]
+ vtrn.8 d22, d23
+ vst1.8 {d21}, [TMP2]
+ vst1.8 {d22}, [TMP3]
+ vst1.8 {d23}, [TMP4]
+ bx lr
+
+ .unreq DCT_TABLE
+ .unreq COEF_BLOCK
+ .unreq OUTPUT_BUF
+ .unreq OUTPUT_COL
+ .unreq TMP1
+ .unreq TMP2
+ .unreq TMP3
+ .unreq TMP4
+.endfunc
+
+/*****************************************************************************/
+
+/*
+ * jsimd_idct_4x4_neon
+ *
+ * This function contains inverse-DCT code for getting reduced-size
+ * 4x4 pixels output from an 8x8 DCT block. It uses the same calculations
+ * and produces exactly the same output as IJG's original 'jpeg_idct_4x4'
+ * function from jpeg-6b (jidctred.c).
+ *
+ * NOTE: jpeg-8 has an improved implementation of 4x4 inverse-DCT, which
+ * requires much less arithmetic operations and hence should be faster.
+ * The primary purpose of this particular NEON optimized function is
+ * bit exact compatibility with jpeg-6b.
+ *
+ * TODO: a bit better instructions scheduling can be achieved by expanding
+ * idct_helper/transpose_4x4 macros and reordering instructions,
+ * but readability will suffer somewhat.
+ */
+
+#define CONST_BITS 13
+
+#define FIX_0_211164243 (1730) /* FIX(0.211164243) */
+#define FIX_0_509795579 (4176) /* FIX(0.509795579) */
+#define FIX_0_601344887 (4926) /* FIX(0.601344887) */
+#define FIX_0_720959822 (5906) /* FIX(0.720959822) */
+#define FIX_0_765366865 (6270) /* FIX(0.765366865) */
+#define FIX_0_850430095 (6967) /* FIX(0.850430095) */
+#define FIX_0_899976223 (7373) /* FIX(0.899976223) */
+#define FIX_1_061594337 (8697) /* FIX(1.061594337) */
+#define FIX_1_272758580 (10426) /* FIX(1.272758580) */
+#define FIX_1_451774981 (11893) /* FIX(1.451774981) */
+#define FIX_1_847759065 (15137) /* FIX(1.847759065) */
+#define FIX_2_172734803 (17799) /* FIX(2.172734803) */
+#define FIX_2_562915447 (20995) /* FIX(2.562915447) */
+#define FIX_3_624509785 (29692) /* FIX(3.624509785) */
+
+.balign 16
+jsimd_idct_4x4_neon_consts:
+ .short FIX_1_847759065 /* d0[0] */
+ .short -FIX_0_765366865 /* d0[1] */
+ .short -FIX_0_211164243 /* d0[2] */
+ .short FIX_1_451774981 /* d0[3] */
+ .short -FIX_2_172734803 /* d1[0] */
+ .short FIX_1_061594337 /* d1[1] */
+ .short -FIX_0_509795579 /* d1[2] */
+ .short -FIX_0_601344887 /* d1[3] */
+ .short FIX_0_899976223 /* d2[0] */
+ .short FIX_2_562915447 /* d2[1] */
+ .short 1 << (CONST_BITS+1) /* d2[2] */
+ .short 0 /* d2[3] */
+
+.macro idct_helper x4, x6, x8, x10, x12, x14, x16, shift, y26, y27, y28, y29
+ vmull.s16 q14, \x4, d2[2]
+ vmlal.s16 q14, \x8, d0[0]
+ vmlal.s16 q14, \x14, d0[1]
+
+ vmull.s16 q13, \x16, d1[2]
+ vmlal.s16 q13, \x12, d1[3]
+ vmlal.s16 q13, \x10, d2[0]
+ vmlal.s16 q13, \x6, d2[1]
+
+ vmull.s16 q15, \x4, d2[2]
+ vmlsl.s16 q15, \x8, d0[0]
+ vmlsl.s16 q15, \x14, d0[1]
+
+ vmull.s16 q12, \x16, d0[2]
+ vmlal.s16 q12, \x12, d0[3]
+ vmlal.s16 q12, \x10, d1[0]
+ vmlal.s16 q12, \x6, d1[1]
+
+ vadd.s32 q10, q14, q13
+ vsub.s32 q14, q14, q13
+
+.if \shift > 16
+ vrshr.s32 q10, q10, #\shift
+ vrshr.s32 q14, q14, #\shift
+ vmovn.s32 \y26, q10
+ vmovn.s32 \y29, q14
+.else
+ vrshrn.s32 \y26, q10, #\shift
+ vrshrn.s32 \y29, q14, #\shift
+.endif
+
+ vadd.s32 q10, q15, q12
+ vsub.s32 q15, q15, q12
+
+.if \shift > 16
+ vrshr.s32 q10, q10, #\shift
+ vrshr.s32 q15, q15, #\shift
+ vmovn.s32 \y27, q10
+ vmovn.s32 \y28, q15
+.else
+ vrshrn.s32 \y27, q10, #\shift
+ vrshrn.s32 \y28, q15, #\shift
+.endif
+
+.endm
+
+asm_function jsimd_idct_4x4_neon
+
+ DCT_TABLE .req r0
+ COEF_BLOCK .req r1
+ OUTPUT_BUF .req r2
+ OUTPUT_COL .req r3
+ TMP1 .req r0
+ TMP2 .req r1
+ TMP3 .req r2
+ TMP4 .req ip
+
+ vpush {d8-d15}
+
+ /* Load constants (d3 is just used for padding) */
+ adr TMP4, jsimd_idct_4x4_neon_consts
+ vld1.16 {d0, d1, d2, d3}, [TMP4, :128]
+
+ /* Load all COEF_BLOCK into NEON registers with the following allocation:
+ * 0 1 2 3 | 4 5 6 7
+ * ---------+--------
+ * 0 | d4 | d5
+ * 1 | d6 | d7
+ * 2 | d8 | d9
+ * 3 | d10 | d11
+ * 4 | - | -
+ * 5 | d12 | d13
+ * 6 | d14 | d15
+ * 7 | d16 | d17
+ */
+ vld1.16 {d4, d5, d6, d7}, [COEF_BLOCK, :128]!
+ vld1.16 {d8, d9, d10, d11}, [COEF_BLOCK, :128]!
+ add COEF_BLOCK, COEF_BLOCK, #16
+ vld1.16 {d12, d13, d14, d15}, [COEF_BLOCK, :128]!
+ vld1.16 {d16, d17}, [COEF_BLOCK, :128]!
+ /* dequantize */
+ vld1.16 {d18, d19, d20, d21}, [DCT_TABLE, :128]!
+ vmul.s16 q2, q2, q9
+ vld1.16 {d22, d23, d24, d25}, [DCT_TABLE, :128]!
+ vmul.s16 q3, q3, q10
+ vmul.s16 q4, q4, q11
+ add DCT_TABLE, DCT_TABLE, #16
+ vld1.16 {d26, d27, d28, d29}, [DCT_TABLE, :128]!
+ vmul.s16 q5, q5, q12
+ vmul.s16 q6, q6, q13
+ vld1.16 {d30, d31}, [DCT_TABLE, :128]!
+ vmul.s16 q7, q7, q14
+ vmul.s16 q8, q8, q15
+
+ /* Pass 1 */
+ idct_helper d4, d6, d8, d10, d12, d14, d16, 12, d4, d6, d8, d10
+ transpose_4x4 d4, d6, d8, d10
+ idct_helper d5, d7, d9, d11, d13, d15, d17, 12, d5, d7, d9, d11
+ transpose_4x4 d5, d7, d9, d11
+
+ /* Pass 2 */
+ idct_helper d4, d6, d8, d10, d7, d9, d11, 19, d26, d27, d28, d29
+ transpose_4x4 d26, d27, d28, d29
+
+ /* Range limit */
+ vmov.u16 q15, #0x80
+ vadd.s16 q13, q13, q15
+ vadd.s16 q14, q14, q15
+ vqmovun.s16 d26, q13
+ vqmovun.s16 d27, q14
+
+ /* Store results to the output buffer */
+ ldmia OUTPUT_BUF, {TMP1, TMP2, TMP3, TMP4}
+ add TMP1, TMP1, OUTPUT_COL
+ add TMP2, TMP2, OUTPUT_COL
+ add TMP3, TMP3, OUTPUT_COL
+ add TMP4, TMP4, OUTPUT_COL
+
+#if defined(__ARMEL__) && !RESPECT_STRICT_ALIGNMENT
+ /* We can use much less instructions on little endian systems if the
+ * OS kernel is not configured to trap unaligned memory accesses
+ */
+ vst1.32 {d26[0]}, [TMP1]!
+ vst1.32 {d27[0]}, [TMP3]!
+ vst1.32 {d26[1]}, [TMP2]!
+ vst1.32 {d27[1]}, [TMP4]!
+#else
+ vst1.8 {d26[0]}, [TMP1]!
+ vst1.8 {d27[0]}, [TMP3]!
+ vst1.8 {d26[1]}, [TMP1]!
+ vst1.8 {d27[1]}, [TMP3]!
+ vst1.8 {d26[2]}, [TMP1]!
+ vst1.8 {d27[2]}, [TMP3]!
+ vst1.8 {d26[3]}, [TMP1]!
+ vst1.8 {d27[3]}, [TMP3]!
+
+ vst1.8 {d26[4]}, [TMP2]!
+ vst1.8 {d27[4]}, [TMP4]!
+ vst1.8 {d26[5]}, [TMP2]!
+ vst1.8 {d27[5]}, [TMP4]!
+ vst1.8 {d26[6]}, [TMP2]!
+ vst1.8 {d27[6]}, [TMP4]!
+ vst1.8 {d26[7]}, [TMP2]!
+ vst1.8 {d27[7]}, [TMP4]!
+#endif
+
+ vpop {d8-d15}
+ bx lr
+
+ .unreq DCT_TABLE
+ .unreq COEF_BLOCK
+ .unreq OUTPUT_BUF
+ .unreq OUTPUT_COL
+ .unreq TMP1
+ .unreq TMP2
+ .unreq TMP3
+ .unreq TMP4
+.endfunc
+
+.purgem idct_helper
+
+/*****************************************************************************/
+
+/*
+ * jsimd_idct_2x2_neon
+ *
+ * This function contains inverse-DCT code for getting reduced-size
+ * 2x2 pixels output from an 8x8 DCT block. It uses the same calculations
+ * and produces exactly the same output as IJG's original 'jpeg_idct_2x2'
+ * function from jpeg-6b (jidctred.c).
+ *
+ * NOTE: jpeg-8 has an improved implementation of 2x2 inverse-DCT, which
+ * requires much less arithmetic operations and hence should be faster.
+ * The primary purpose of this particular NEON optimized function is
+ * bit exact compatibility with jpeg-6b.
+ */
+
+.balign 8
+jsimd_idct_2x2_neon_consts:
+ .short -FIX_0_720959822 /* d0[0] */
+ .short FIX_0_850430095 /* d0[1] */
+ .short -FIX_1_272758580 /* d0[2] */
+ .short FIX_3_624509785 /* d0[3] */
+
+.macro idct_helper x4, x6, x10, x12, x16, shift, y26, y27
+ vshll.s16 q14, \x4, #15
+ vmull.s16 q13, \x6, d0[3]
+ vmlal.s16 q13, \x10, d0[2]
+ vmlal.s16 q13, \x12, d0[1]
+ vmlal.s16 q13, \x16, d0[0]
+
+ vadd.s32 q10, q14, q13
+ vsub.s32 q14, q14, q13
+
+.if \shift > 16
+ vrshr.s32 q10, q10, #\shift
+ vrshr.s32 q14, q14, #\shift
+ vmovn.s32 \y26, q10
+ vmovn.s32 \y27, q14
+.else
+ vrshrn.s32 \y26, q10, #\shift
+ vrshrn.s32 \y27, q14, #\shift
+.endif
+
+.endm
+
+asm_function jsimd_idct_2x2_neon
+
+ DCT_TABLE .req r0
+ COEF_BLOCK .req r1
+ OUTPUT_BUF .req r2
+ OUTPUT_COL .req r3
+ TMP1 .req r0
+ TMP2 .req ip
+
+ vpush {d8-d15}
+
+ /* Load constants */
+ adr TMP2, jsimd_idct_2x2_neon_consts
+ vld1.16 {d0}, [TMP2, :64]
+
+ /* Load all COEF_BLOCK into NEON registers with the following allocation:
+ * 0 1 2 3 | 4 5 6 7
+ * ---------+--------
+ * 0 | d4 | d5
+ * 1 | d6 | d7
+ * 2 | - | -
+ * 3 | d10 | d11
+ * 4 | - | -
+ * 5 | d12 | d13
+ * 6 | - | -
+ * 7 | d16 | d17
+ */
+ vld1.16 {d4, d5, d6, d7}, [COEF_BLOCK, :128]!
+ add COEF_BLOCK, COEF_BLOCK, #16
+ vld1.16 {d10, d11}, [COEF_BLOCK, :128]!
+ add COEF_BLOCK, COEF_BLOCK, #16
+ vld1.16 {d12, d13}, [COEF_BLOCK, :128]!
+ add COEF_BLOCK, COEF_BLOCK, #16
+ vld1.16 {d16, d17}, [COEF_BLOCK, :128]!
+ /* Dequantize */
+ vld1.16 {d18, d19, d20, d21}, [DCT_TABLE, :128]!
+ vmul.s16 q2, q2, q9
+ vmul.s16 q3, q3, q10
+ add DCT_TABLE, DCT_TABLE, #16
+ vld1.16 {d24, d25}, [DCT_TABLE, :128]!
+ vmul.s16 q5, q5, q12
+ add DCT_TABLE, DCT_TABLE, #16
+ vld1.16 {d26, d27}, [DCT_TABLE, :128]!
+ vmul.s16 q6, q6, q13
+ add DCT_TABLE, DCT_TABLE, #16
+ vld1.16 {d30, d31}, [DCT_TABLE, :128]!
+ vmul.s16 q8, q8, q15
+
+ /* Pass 1 */
+#if 0
+ idct_helper d4, d6, d10, d12, d16, 13, d4, d6
+ transpose_4x4 d4, d6, d8, d10
+ idct_helper d5, d7, d11, d13, d17, 13, d5, d7
+ transpose_4x4 d5, d7, d9, d11
+#else
+ vmull.s16 q13, d6, d0[3]
+ vmlal.s16 q13, d10, d0[2]
+ vmlal.s16 q13, d12, d0[1]
+ vmlal.s16 q13, d16, d0[0]
+ vmull.s16 q12, d7, d0[3]
+ vmlal.s16 q12, d11, d0[2]
+ vmlal.s16 q12, d13, d0[1]
+ vmlal.s16 q12, d17, d0[0]
+ vshll.s16 q14, d4, #15
+ vshll.s16 q15, d5, #15
+ vadd.s32 q10, q14, q13
+ vsub.s32 q14, q14, q13
+ vrshrn.s32 d4, q10, #13
+ vrshrn.s32 d6, q14, #13
+ vadd.s32 q10, q15, q12
+ vsub.s32 q14, q15, q12
+ vrshrn.s32 d5, q10, #13
+ vrshrn.s32 d7, q14, #13
+ vtrn.16 q2, q3
+ vtrn.32 q3, q5
+#endif
+
+ /* Pass 2 */
+ idct_helper d4, d6, d10, d7, d11, 20, d26, d27
+
+ /* Range limit */
+ vmov.u16 q15, #0x80
+ vadd.s16 q13, q13, q15
+ vqmovun.s16 d26, q13
+ vqmovun.s16 d27, q13
+
+ /* Store results to the output buffer */
+ ldmia OUTPUT_BUF, {TMP1, TMP2}
+ add TMP1, TMP1, OUTPUT_COL
+ add TMP2, TMP2, OUTPUT_COL
+
+ vst1.8 {d26[0]}, [TMP1]!
+ vst1.8 {d27[4]}, [TMP1]!
+ vst1.8 {d26[1]}, [TMP2]!
+ vst1.8 {d27[5]}, [TMP2]!
+
+ vpop {d8-d15}
+ bx lr
+
+ .unreq DCT_TABLE
+ .unreq COEF_BLOCK
+ .unreq OUTPUT_BUF
+ .unreq OUTPUT_COL
+ .unreq TMP1
+ .unreq TMP2
+.endfunc
+
+.purgem idct_helper
+
+/*****************************************************************************/
+
+/*
+ * jsimd_ycc_extrgb_convert_neon
+ * jsimd_ycc_extbgr_convert_neon
+ * jsimd_ycc_extrgbx_convert_neon
+ * jsimd_ycc_extbgrx_convert_neon
+ * jsimd_ycc_extxbgr_convert_neon
+ * jsimd_ycc_extxrgb_convert_neon
+ *
+ * Colorspace conversion YCbCr -> RGB
+ */
+
+
+.macro do_load size
+ .if \size == 8
+ vld1.8 {d4}, [U, :64]!
+ vld1.8 {d5}, [V, :64]!
+ vld1.8 {d0}, [Y, :64]!
+ pld [U, #64]
+ pld [V, #64]
+ pld [Y, #64]
+ .elseif \size == 4
+ vld1.8 {d4[0]}, [U]!
+ vld1.8 {d4[1]}, [U]!
+ vld1.8 {d4[2]}, [U]!
+ vld1.8 {d4[3]}, [U]!
+ vld1.8 {d5[0]}, [V]!
+ vld1.8 {d5[1]}, [V]!
+ vld1.8 {d5[2]}, [V]!
+ vld1.8 {d5[3]}, [V]!
+ vld1.8 {d0[0]}, [Y]!
+ vld1.8 {d0[1]}, [Y]!
+ vld1.8 {d0[2]}, [Y]!
+ vld1.8 {d0[3]}, [Y]!
+ .elseif \size == 2
+ vld1.8 {d4[4]}, [U]!
+ vld1.8 {d4[5]}, [U]!
+ vld1.8 {d5[4]}, [V]!
+ vld1.8 {d5[5]}, [V]!
+ vld1.8 {d0[4]}, [Y]!
+ vld1.8 {d0[5]}, [Y]!
+ .elseif \size == 1
+ vld1.8 {d4[6]}, [U]!
+ vld1.8 {d5[6]}, [V]!
+ vld1.8 {d0[6]}, [Y]!
+ .else
+ .error unsupported macroblock size
+ .endif
+.endm
+
+.macro do_store bpp, size
+ .if \bpp == 24
+ .if \size == 8
+ vst3.8 {d10, d11, d12}, [RGB]!
+ .elseif \size == 4
+ vst3.8 {d10[0], d11[0], d12[0]}, [RGB]!
+ vst3.8 {d10[1], d11[1], d12[1]}, [RGB]!
+ vst3.8 {d10[2], d11[2], d12[2]}, [RGB]!
+ vst3.8 {d10[3], d11[3], d12[3]}, [RGB]!
+ .elseif \size == 2
+ vst3.8 {d10[4], d11[4], d12[4]}, [RGB]!
+ vst3.8 {d10[5], d11[5], d12[5]}, [RGB]!
+ .elseif \size == 1
+ vst3.8 {d10[6], d11[6], d12[6]}, [RGB]!
+ .else
+ .error unsupported macroblock size
+ .endif
+ .elseif \bpp == 32
+ .if \size == 8
+ vst4.8 {d10, d11, d12, d13}, [RGB]!
+ .elseif \size == 4
+ vst4.8 {d10[0], d11[0], d12[0], d13[0]}, [RGB]!
+ vst4.8 {d10[1], d11[1], d12[1], d13[1]}, [RGB]!
+ vst4.8 {d10[2], d11[2], d12[2], d13[2]}, [RGB]!
+ vst4.8 {d10[3], d11[3], d12[3], d13[3]}, [RGB]!
+ .elseif \size == 2
+ vst4.8 {d10[4], d11[4], d12[4], d13[4]}, [RGB]!
+ vst4.8 {d10[5], d11[5], d12[5], d13[5]}, [RGB]!
+ .elseif \size == 1
+ vst4.8 {d10[6], d11[6], d12[6], d13[6]}, [RGB]!
+ .else
+ .error unsupported macroblock size
+ .endif
+ .else
+ .error unsupported bpp
+ .endif
+.endm
+
+.macro generate_jsimd_ycc_rgb_convert_neon colorid, bpp, r_offs, g_offs, b_offs
+
+/*
+ * 2 stage pipelined YCbCr->RGB conversion
+ */
+
+.macro do_yuv_to_rgb_stage1
+ vaddw.u8 q3, q1, d4 /* q3 = u - 128 */
+ vaddw.u8 q4, q1, d5 /* q2 = v - 128 */
+ vmull.s16 q10, d6, d1[1] /* multiply by -11277 */
+ vmlal.s16 q10, d8, d1[2] /* multiply by -23401 */
+ vmull.s16 q11, d7, d1[1] /* multiply by -11277 */
+ vmlal.s16 q11, d9, d1[2] /* multiply by -23401 */
+ vmull.s16 q12, d8, d1[0] /* multiply by 22971 */
+ vmull.s16 q13, d9, d1[0] /* multiply by 22971 */
+ vmull.s16 q14, d6, d1[3] /* multiply by 29033 */
+ vmull.s16 q15, d7, d1[3] /* multiply by 29033 */
+.endm
+
+.macro do_yuv_to_rgb_stage2
+ vrshrn.s32 d20, q10, #15
+ vrshrn.s32 d21, q11, #15
+ vrshrn.s32 d24, q12, #14
+ vrshrn.s32 d25, q13, #14
+ vrshrn.s32 d28, q14, #14
+ vrshrn.s32 d29, q15, #14
+ vaddw.u8 q10, q10, d0
+ vaddw.u8 q12, q12, d0
+ vaddw.u8 q14, q14, d0
+ vqmovun.s16 d1\g_offs, q10
+ vqmovun.s16 d1\r_offs, q12
+ vqmovun.s16 d1\b_offs, q14
+.endm
+
+.macro do_yuv_to_rgb_stage2_store_load_stage1
+ vld1.8 {d4}, [U, :64]!
+ vrshrn.s32 d20, q10, #15
+ vrshrn.s32 d21, q11, #15
+ vrshrn.s32 d24, q12, #14
+ vrshrn.s32 d25, q13, #14
+ vrshrn.s32 d28, q14, #14
+ vld1.8 {d5}, [V, :64]!
+ vrshrn.s32 d29, q15, #14
+ vaddw.u8 q10, q10, d0
+ vaddw.u8 q12, q12, d0
+ vaddw.u8 q14, q14, d0
+ vqmovun.s16 d1\g_offs, q10
+ vld1.8 {d0}, [Y, :64]!
+ vqmovun.s16 d1\r_offs, q12
+ pld [U, #64]
+ pld [V, #64]
+ pld [Y, #64]
+ vqmovun.s16 d1\b_offs, q14
+ vaddw.u8 q3, q1, d4 /* q3 = u - 128 */
+ vaddw.u8 q4, q1, d5 /* q2 = v - 128 */
+ do_store \bpp, 8
+ vmull.s16 q10, d6, d1[1] /* multiply by -11277 */
+ vmlal.s16 q10, d8, d1[2] /* multiply by -23401 */
+ vmull.s16 q11, d7, d1[1] /* multiply by -11277 */
+ vmlal.s16 q11, d9, d1[2] /* multiply by -23401 */
+ vmull.s16 q12, d8, d1[0] /* multiply by 22971 */
+ vmull.s16 q13, d9, d1[0] /* multiply by 22971 */
+ vmull.s16 q14, d6, d1[3] /* multiply by 29033 */
+ vmull.s16 q15, d7, d1[3] /* multiply by 29033 */
+.endm
+
+.macro do_yuv_to_rgb
+ do_yuv_to_rgb_stage1
+ do_yuv_to_rgb_stage2
+.endm
+
+/* Apple gas crashes on adrl, work around that by using adr.
+ * But this requires a copy of these constants for each function.
+ */
+
+.balign 16
+jsimd_ycc_\colorid\()_neon_consts:
+ .short 0, 0, 0, 0
+ .short 22971, -11277, -23401, 29033
+ .short -128, -128, -128, -128
+ .short -128, -128, -128, -128
+
+asm_function jsimd_ycc_\colorid\()_convert_neon
+ OUTPUT_WIDTH .req r0
+ INPUT_BUF .req r1
+ INPUT_ROW .req r2
+ OUTPUT_BUF .req r3
+ NUM_ROWS .req r4
+
+ INPUT_BUF0 .req r5
+ INPUT_BUF1 .req r6
+ INPUT_BUF2 .req INPUT_BUF
+
+ RGB .req r7
+ Y .req r8
+ U .req r9
+ V .req r10
+ N .req ip
+
+ /* Load constants to d1, d2, d3 (d0 is just used for padding) */
+ adr ip, jsimd_ycc_\colorid\()_neon_consts
+ vld1.16 {d0, d1, d2, d3}, [ip, :128]
+
+ /* Save ARM registers and handle input arguments */
+ push {r4, r5, r6, r7, r8, r9, r10, lr}
+ ldr NUM_ROWS, [sp, #(4 * 8)]
+ ldr INPUT_BUF0, [INPUT_BUF]
+ ldr INPUT_BUF1, [INPUT_BUF, #4]
+ ldr INPUT_BUF2, [INPUT_BUF, #8]
+ .unreq INPUT_BUF
+
+ /* Save NEON registers */
+ vpush {d8-d15}
+
+ /* Initially set d10, d11, d12, d13 to 0xFF */
+ vmov.u8 q5, #255
+ vmov.u8 q6, #255
+
+ /* Outer loop over scanlines */
+ cmp NUM_ROWS, #1
+ blt 9f
+0:
+ ldr Y, [INPUT_BUF0, INPUT_ROW, lsl #2]
+ ldr U, [INPUT_BUF1, INPUT_ROW, lsl #2]
+ mov N, OUTPUT_WIDTH
+ ldr V, [INPUT_BUF2, INPUT_ROW, lsl #2]
+ add INPUT_ROW, INPUT_ROW, #1
+ ldr RGB, [OUTPUT_BUF], #4
+
+ /* Inner loop over pixels */
+ subs N, N, #8
+ blt 3f
+ do_load 8
+ do_yuv_to_rgb_stage1
+ subs N, N, #8
+ blt 2f
+1:
+ do_yuv_to_rgb_stage2_store_load_stage1
+ subs N, N, #8
+ bge 1b
+2:
+ do_yuv_to_rgb_stage2
+ do_store \bpp, 8
+ tst N, #7
+ beq 8f
+3:
+ tst N, #4
+ beq 3f
+ do_load 4
+3:
+ tst N, #2
+ beq 4f
+ do_load 2
+4:
+ tst N, #1
+ beq 5f
+ do_load 1
+5:
+ do_yuv_to_rgb
+ tst N, #4
+ beq 6f
+ do_store \bpp, 4
+6:
+ tst N, #2
+ beq 7f
+ do_store \bpp, 2
+7:
+ tst N, #1
+ beq 8f
+ do_store \bpp, 1
+8:
+ subs NUM_ROWS, NUM_ROWS, #1
+ bgt 0b
+9:
+ /* Restore all registers and return */
+ vpop {d8-d15}
+ pop {r4, r5, r6, r7, r8, r9, r10, pc}
+
+ .unreq OUTPUT_WIDTH
+ .unreq INPUT_ROW
+ .unreq OUTPUT_BUF
+ .unreq NUM_ROWS
+ .unreq INPUT_BUF0
+ .unreq INPUT_BUF1
+ .unreq INPUT_BUF2
+ .unreq RGB
+ .unreq Y
+ .unreq U
+ .unreq V
+ .unreq N
+.endfunc
+
+.purgem do_yuv_to_rgb
+.purgem do_yuv_to_rgb_stage1
+.purgem do_yuv_to_rgb_stage2
+.purgem do_yuv_to_rgb_stage2_store_load_stage1
+
+.endm
+
+/*--------------------------------- id ----- bpp R G B */
+generate_jsimd_ycc_rgb_convert_neon extrgb, 24, 0, 1, 2
+generate_jsimd_ycc_rgb_convert_neon extbgr, 24, 2, 1, 0
+generate_jsimd_ycc_rgb_convert_neon extrgbx, 32, 0, 1, 2
+generate_jsimd_ycc_rgb_convert_neon extbgrx, 32, 2, 1, 0
+generate_jsimd_ycc_rgb_convert_neon extxbgr, 32, 3, 2, 1
+generate_jsimd_ycc_rgb_convert_neon extxrgb, 32, 1, 2, 3
+
+.purgem do_load
+.purgem do_store
+
+/*****************************************************************************/
+
+/*
+ * jsimd_extrgb_ycc_convert_neon
+ * jsimd_extbgr_ycc_convert_neon
+ * jsimd_extrgbx_ycc_convert_neon
+ * jsimd_extbgrx_ycc_convert_neon
+ * jsimd_extxbgr_ycc_convert_neon
+ * jsimd_extxrgb_ycc_convert_neon
+ *
+ * Colorspace conversion RGB -> YCbCr
+ */
+
+.macro do_store size
+ .if \size == 8
+ vst1.8 {d20}, [Y]!
+ vst1.8 {d21}, [U]!
+ vst1.8 {d22}, [V]!
+ .elseif \size == 4
+ vst1.8 {d20[0]}, [Y]!
+ vst1.8 {d20[1]}, [Y]!
+ vst1.8 {d20[2]}, [Y]!
+ vst1.8 {d20[3]}, [Y]!
+ vst1.8 {d21[0]}, [U]!
+ vst1.8 {d21[1]}, [U]!
+ vst1.8 {d21[2]}, [U]!
+ vst1.8 {d21[3]}, [U]!
+ vst1.8 {d22[0]}, [V]!
+ vst1.8 {d22[1]}, [V]!
+ vst1.8 {d22[2]}, [V]!
+ vst1.8 {d22[3]}, [V]!
+ .elseif \size == 2
+ vst1.8 {d20[4]}, [Y]!
+ vst1.8 {d20[5]}, [Y]!
+ vst1.8 {d21[4]}, [U]!
+ vst1.8 {d21[5]}, [U]!
+ vst1.8 {d22[4]}, [V]!
+ vst1.8 {d22[5]}, [V]!
+ .elseif \size == 1
+ vst1.8 {d20[6]}, [Y]!
+ vst1.8 {d21[6]}, [U]!
+ vst1.8 {d22[6]}, [V]!
+ .else
+ .error unsupported macroblock size
+ .endif
+.endm
+
+.macro do_load bpp, size
+ .if \bpp == 24
+ .if \size == 8
+ vld3.8 {d10, d11, d12}, [RGB]!
+ pld [RGB, #128]
+ .elseif \size == 4
+ vld3.8 {d10[0], d11[0], d12[0]}, [RGB]!
+ vld3.8 {d10[1], d11[1], d12[1]}, [RGB]!
+ vld3.8 {d10[2], d11[2], d12[2]}, [RGB]!
+ vld3.8 {d10[3], d11[3], d12[3]}, [RGB]!
+ .elseif \size == 2
+ vld3.8 {d10[4], d11[4], d12[4]}, [RGB]!
+ vld3.8 {d10[5], d11[5], d12[5]}, [RGB]!
+ .elseif \size == 1
+ vld3.8 {d10[6], d11[6], d12[6]}, [RGB]!
+ .else
+ .error unsupported macroblock size
+ .endif
+ .elseif \bpp == 32
+ .if \size == 8
+ vld4.8 {d10, d11, d12, d13}, [RGB]!
+ pld [RGB, #128]
+ .elseif \size == 4
+ vld4.8 {d10[0], d11[0], d12[0], d13[0]}, [RGB]!
+ vld4.8 {d10[1], d11[1], d12[1], d13[1]}, [RGB]!
+ vld4.8 {d10[2], d11[2], d12[2], d13[2]}, [RGB]!
+ vld4.8 {d10[3], d11[3], d12[3], d13[3]}, [RGB]!
+ .elseif \size == 2
+ vld4.8 {d10[4], d11[4], d12[4], d13[4]}, [RGB]!
+ vld4.8 {d10[5], d11[5], d12[5], d13[5]}, [RGB]!
+ .elseif \size == 1
+ vld4.8 {d10[6], d11[6], d12[6], d13[6]}, [RGB]!
+ .else
+ .error unsupported macroblock size
+ .endif
+ .else
+ .error unsupported bpp
+ .endif
+.endm
+
+.macro generate_jsimd_rgb_ycc_convert_neon colorid, bpp, r_offs, g_offs, b_offs
+
+/*
+ * 2 stage pipelined RGB->YCbCr conversion
+ */
+
+.macro do_rgb_to_yuv_stage1
+ vmovl.u8 q2, d1\r_offs /* r = { d4, d5 } */
+ vmovl.u8 q3, d1\g_offs /* g = { d6, d7 } */
+ vmovl.u8 q4, d1\b_offs /* b = { d8, d9 } */
+ vmull.u16 q7, d4, d0[0]
+ vmlal.u16 q7, d6, d0[1]
+ vmlal.u16 q7, d8, d0[2]
+ vmull.u16 q8, d5, d0[0]
+ vmlal.u16 q8, d7, d0[1]
+ vmlal.u16 q8, d9, d0[2]
+ vrev64.32 q9, q1
+ vrev64.32 q13, q1
+ vmlsl.u16 q9, d4, d0[3]
+ vmlsl.u16 q9, d6, d1[0]
+ vmlal.u16 q9, d8, d1[1]
+ vmlsl.u16 q13, d5, d0[3]
+ vmlsl.u16 q13, d7, d1[0]
+ vmlal.u16 q13, d9, d1[1]
+ vrev64.32 q14, q1
+ vrev64.32 q15, q1
+ vmlal.u16 q14, d4, d1[1]
+ vmlsl.u16 q14, d6, d1[2]
+ vmlsl.u16 q14, d8, d1[3]
+ vmlal.u16 q15, d5, d1[1]
+ vmlsl.u16 q15, d7, d1[2]
+ vmlsl.u16 q15, d9, d1[3]
+.endm
+
+.macro do_rgb_to_yuv_stage2
+ vrshrn.u32 d20, q7, #16
+ vrshrn.u32 d21, q8, #16
+ vshrn.u32 d22, q9, #16
+ vshrn.u32 d23, q13, #16
+ vshrn.u32 d24, q14, #16
+ vshrn.u32 d25, q15, #16
+ vmovn.u16 d20, q10 /* d20 = y */
+ vmovn.u16 d21, q11 /* d21 = u */
+ vmovn.u16 d22, q12 /* d22 = v */
+.endm
+
+.macro do_rgb_to_yuv
+ do_rgb_to_yuv_stage1
+ do_rgb_to_yuv_stage2
+.endm
+
+.macro do_rgb_to_yuv_stage2_store_load_stage1
+ vrshrn.u32 d20, q7, #16
+ vrshrn.u32 d21, q8, #16
+ vshrn.u32 d22, q9, #16
+ vrev64.32 q9, q1
+ vshrn.u32 d23, q13, #16
+ vrev64.32 q13, q1
+ vshrn.u32 d24, q14, #16
+ vshrn.u32 d25, q15, #16
+ do_load \bpp, 8
+ vmovn.u16 d20, q10 /* d20 = y */
+ vmovl.u8 q2, d1\r_offs /* r = { d4, d5 } */
+ vmovn.u16 d21, q11 /* d21 = u */
+ vmovl.u8 q3, d1\g_offs /* g = { d6, d7 } */
+ vmovn.u16 d22, q12 /* d22 = v */
+ vmovl.u8 q4, d1\b_offs /* b = { d8, d9 } */
+ vmull.u16 q7, d4, d0[0]
+ vmlal.u16 q7, d6, d0[1]
+ vmlal.u16 q7, d8, d0[2]
+ vst1.8 {d20}, [Y]!
+ vmull.u16 q8, d5, d0[0]
+ vmlal.u16 q8, d7, d0[1]
+ vmlal.u16 q8, d9, d0[2]
+ vmlsl.u16 q9, d4, d0[3]
+ vmlsl.u16 q9, d6, d1[0]
+ vmlal.u16 q9, d8, d1[1]
+ vst1.8 {d21}, [U]!
+ vmlsl.u16 q13, d5, d0[3]
+ vmlsl.u16 q13, d7, d1[0]
+ vmlal.u16 q13, d9, d1[1]
+ vrev64.32 q14, q1
+ vrev64.32 q15, q1
+ vmlal.u16 q14, d4, d1[1]
+ vmlsl.u16 q14, d6, d1[2]
+ vmlsl.u16 q14, d8, d1[3]
+ vst1.8 {d22}, [V]!
+ vmlal.u16 q15, d5, d1[1]
+ vmlsl.u16 q15, d7, d1[2]
+ vmlsl.u16 q15, d9, d1[3]
+.endm
+
+.balign 16
+jsimd_\colorid\()_ycc_neon_consts:
+ .short 19595, 38470, 7471, 11059
+ .short 21709, 32768, 27439, 5329
+ .short 32767, 128, 32767, 128
+ .short 32767, 128, 32767, 128
+
+asm_function jsimd_\colorid\()_ycc_convert_neon
+ OUTPUT_WIDTH .req r0
+ INPUT_BUF .req r1
+ OUTPUT_BUF .req r2
+ OUTPUT_ROW .req r3
+ NUM_ROWS .req r4
+
+ OUTPUT_BUF0 .req r5
+ OUTPUT_BUF1 .req r6
+ OUTPUT_BUF2 .req OUTPUT_BUF
+
+ RGB .req r7
+ Y .req r8
+ U .req r9
+ V .req r10
+ N .req ip
+
+ /* Load constants to d0, d1, d2, d3 */
+ adr ip, jsimd_\colorid\()_ycc_neon_consts
+ vld1.16 {d0, d1, d2, d3}, [ip, :128]
+
+ /* Save ARM registers and handle input arguments */
+ push {r4, r5, r6, r7, r8, r9, r10, lr}
+ ldr NUM_ROWS, [sp, #(4 * 8)]
+ ldr OUTPUT_BUF0, [OUTPUT_BUF]
+ ldr OUTPUT_BUF1, [OUTPUT_BUF, #4]
+ ldr OUTPUT_BUF2, [OUTPUT_BUF, #8]
+ .unreq OUTPUT_BUF
+
+ /* Save NEON registers */
+ vpush {d8-d15}
+
+ /* Outer loop over scanlines */
+ cmp NUM_ROWS, #1
+ blt 9f
+0:
+ ldr Y, [OUTPUT_BUF0, OUTPUT_ROW, lsl #2]
+ ldr U, [OUTPUT_BUF1, OUTPUT_ROW, lsl #2]
+ mov N, OUTPUT_WIDTH
+ ldr V, [OUTPUT_BUF2, OUTPUT_ROW, lsl #2]
+ add OUTPUT_ROW, OUTPUT_ROW, #1
+ ldr RGB, [INPUT_BUF], #4
+
+ /* Inner loop over pixels */
+ subs N, N, #8
+ blt 3f
+ do_load \bpp, 8
+ do_rgb_to_yuv_stage1
+ subs N, N, #8
+ blt 2f
+1:
+ do_rgb_to_yuv_stage2_store_load_stage1
+ subs N, N, #8
+ bge 1b
+2:
+ do_rgb_to_yuv_stage2
+ do_store 8
+ tst N, #7
+ beq 8f
+3:
+ tst N, #4
+ beq 3f
+ do_load \bpp, 4
+3:
+ tst N, #2
+ beq 4f
+ do_load \bpp, 2
+4:
+ tst N, #1
+ beq 5f
+ do_load \bpp, 1
+5:
+ do_rgb_to_yuv
+ tst N, #4
+ beq 6f
+ do_store 4
+6:
+ tst N, #2
+ beq 7f
+ do_store 2
+7:
+ tst N, #1
+ beq 8f
+ do_store 1
+8:
+ subs NUM_ROWS, NUM_ROWS, #1
+ bgt 0b
+9:
+ /* Restore all registers and return */
+ vpop {d8-d15}
+ pop {r4, r5, r6, r7, r8, r9, r10, pc}
+
+ .unreq OUTPUT_WIDTH
+ .unreq OUTPUT_ROW
+ .unreq INPUT_BUF
+ .unreq NUM_ROWS
+ .unreq OUTPUT_BUF0
+ .unreq OUTPUT_BUF1
+ .unreq OUTPUT_BUF2
+ .unreq RGB
+ .unreq Y
+ .unreq U
+ .unreq V
+ .unreq N
+.endfunc
+
+.purgem do_rgb_to_yuv
+.purgem do_rgb_to_yuv_stage1
+.purgem do_rgb_to_yuv_stage2
+.purgem do_rgb_to_yuv_stage2_store_load_stage1
+
+.endm
+
+/*--------------------------------- id ----- bpp R G B */
+generate_jsimd_rgb_ycc_convert_neon extrgb, 24, 0, 1, 2
+generate_jsimd_rgb_ycc_convert_neon extbgr, 24, 2, 1, 0
+generate_jsimd_rgb_ycc_convert_neon extrgbx, 32, 0, 1, 2
+generate_jsimd_rgb_ycc_convert_neon extbgrx, 32, 2, 1, 0
+generate_jsimd_rgb_ycc_convert_neon extxbgr, 32, 3, 2, 1
+generate_jsimd_rgb_ycc_convert_neon extxrgb, 32, 1, 2, 3
+
+.purgem do_load
+.purgem do_store
+
+/*****************************************************************************/
+
+/*
+ * Load data into workspace, applying unsigned->signed conversion
+ *
+ * TODO: can be combined with 'jsimd_fdct_ifast_neon' to get
+ * rid of VST1.16 instructions
+ */
+
+asm_function jsimd_convsamp_neon
+ SAMPLE_DATA .req r0
+ START_COL .req r1
+ WORKSPACE .req r2
+ TMP1 .req r3
+ TMP2 .req r4
+ TMP3 .req r5
+ TMP4 .req ip
+
+ push {r4, r5}
+ vmov.u8 d0, #128
+
+ ldmia SAMPLE_DATA!, {TMP1, TMP2, TMP3, TMP4}
+ add TMP1, TMP1, START_COL
+ add TMP2, TMP2, START_COL
+ add TMP3, TMP3, START_COL
+ add TMP4, TMP4, START_COL
+ vld1.8 {d16}, [TMP1]
+ vsubl.u8 q8, d16, d0
+ vld1.8 {d18}, [TMP2]
+ vsubl.u8 q9, d18, d0
+ vld1.8 {d20}, [TMP3]
+ vsubl.u8 q10, d20, d0
+ vld1.8 {d22}, [TMP4]
+ ldmia SAMPLE_DATA!, {TMP1, TMP2, TMP3, TMP4}
+ vsubl.u8 q11, d22, d0
+ vst1.16 {d16, d17, d18, d19}, [WORKSPACE, :128]!
+ add TMP1, TMP1, START_COL
+ add TMP2, TMP2, START_COL
+ vst1.16 {d20, d21, d22, d23}, [WORKSPACE, :128]!
+ add TMP3, TMP3, START_COL
+ add TMP4, TMP4, START_COL
+ vld1.8 {d24}, [TMP1]
+ vsubl.u8 q12, d24, d0
+ vld1.8 {d26}, [TMP2]
+ vsubl.u8 q13, d26, d0
+ vld1.8 {d28}, [TMP3]
+ vsubl.u8 q14, d28, d0
+ vld1.8 {d30}, [TMP4]
+ vsubl.u8 q15, d30, d0
+ vst1.16 {d24, d25, d26, d27}, [WORKSPACE, :128]!
+ vst1.16 {d28, d29, d30, d31}, [WORKSPACE, :128]!
+ pop {r4, r5}
+ bx lr
+
+ .unreq SAMPLE_DATA
+ .unreq START_COL
+ .unreq WORKSPACE
+ .unreq TMP1
+ .unreq TMP2
+ .unreq TMP3
+ .unreq TMP4
+.endfunc
+
+/*****************************************************************************/
+
+/*
+ * jsimd_fdct_ifast_neon
+ *
+ * This function contains a fast, not so accurate integer implementation of
+ * the forward DCT (Discrete Cosine Transform). It uses the same calculations
+ * and produces exactly the same output as IJG's original 'jpeg_fdct_ifast'
+ * function from jfdctfst.c
+ *
+ * TODO: can be combined with 'jsimd_convsamp_neon' to get
+ * rid of a bunch of VLD1.16 instructions
+ */
+
+#define XFIX_0_382683433 d0[0]
+#define XFIX_0_541196100 d0[1]
+#define XFIX_0_707106781 d0[2]
+#define XFIX_1_306562965 d0[3]
+
+.balign 16
+jsimd_fdct_ifast_neon_consts:
+ .short (98 * 128) /* XFIX_0_382683433 */
+ .short (139 * 128) /* XFIX_0_541196100 */
+ .short (181 * 128) /* XFIX_0_707106781 */
+ .short (334 * 128 - 256 * 128) /* XFIX_1_306562965 */
+
+asm_function jsimd_fdct_ifast_neon
+
+ DATA .req r0
+ TMP .req ip
+
+ vpush {d8-d15}
+
+ /* Load constants */
+ adr TMP, jsimd_fdct_ifast_neon_consts
+ vld1.16 {d0}, [TMP, :64]
+
+ /* Load all DATA into NEON registers with the following allocation:
+ * 0 1 2 3 | 4 5 6 7
+ * ---------+--------
+ * 0 | d16 | d17 | q8
+ * 1 | d18 | d19 | q9
+ * 2 | d20 | d21 | q10
+ * 3 | d22 | d23 | q11
+ * 4 | d24 | d25 | q12
+ * 5 | d26 | d27 | q13
+ * 6 | d28 | d29 | q14
+ * 7 | d30 | d31 | q15
+ */
+
+ vld1.16 {d16, d17, d18, d19}, [DATA, :128]!
+ vld1.16 {d20, d21, d22, d23}, [DATA, :128]!
+ vld1.16 {d24, d25, d26, d27}, [DATA, :128]!
+ vld1.16 {d28, d29, d30, d31}, [DATA, :128]
+ sub DATA, DATA, #(128 - 32)
+
+ mov TMP, #2
+1:
+ /* Transpose */
+ vtrn.16 q12, q13
+ vtrn.16 q10, q11
+ vtrn.16 q8, q9
+ vtrn.16 q14, q15
+ vtrn.32 q9, q11
+ vtrn.32 q13, q15
+ vtrn.32 q8, q10
+ vtrn.32 q12, q14
+ vswp d30, d23
+ vswp d24, d17
+ vswp d26, d19
+ /* 1-D FDCT */
+ vadd.s16 q2, q11, q12
+ vswp d28, d21
+ vsub.s16 q12, q11, q12
+ vsub.s16 q6, q10, q13
+ vadd.s16 q10, q10, q13
+ vsub.s16 q7, q9, q14
+ vadd.s16 q9, q9, q14
+ vsub.s16 q1, q8, q15
+ vadd.s16 q8, q8, q15
+ vsub.s16 q4, q9, q10
+ vsub.s16 q5, q8, q2
+ vadd.s16 q3, q9, q10
+ vadd.s16 q4, q4, q5
+ vadd.s16 q2, q8, q2
+ vqdmulh.s16 q4, q4, XFIX_0_707106781
+ vadd.s16 q11, q12, q6
+ vadd.s16 q8, q2, q3
+ vsub.s16 q12, q2, q3
+ vadd.s16 q3, q6, q7
+ vadd.s16 q7, q7, q1
+ vqdmulh.s16 q3, q3, XFIX_0_707106781
+ vsub.s16 q6, q11, q7
+ vadd.s16 q10, q5, q4
+ vqdmulh.s16 q6, q6, XFIX_0_382683433
+ vsub.s16 q14, q5, q4
+ vqdmulh.s16 q11, q11, XFIX_0_541196100
+ vqdmulh.s16 q5, q7, XFIX_1_306562965
+ vadd.s16 q4, q1, q3
+ vsub.s16 q3, q1, q3
+ vadd.s16 q7, q7, q6
+ vadd.s16 q11, q11, q6
+ vadd.s16 q7, q7, q5
+ vadd.s16 q13, q3, q11
+ vsub.s16 q11, q3, q11
+ vadd.s16 q9, q4, q7
+ vsub.s16 q15, q4, q7
+ subs TMP, TMP, #1
+ bne 1b
+
+ /* store results */
+ vst1.16 {d16, d17, d18, d19}, [DATA, :128]!
+ vst1.16 {d20, d21, d22, d23}, [DATA, :128]!
+ vst1.16 {d24, d25, d26, d27}, [DATA, :128]!
+ vst1.16 {d28, d29, d30, d31}, [DATA, :128]
+
+ vpop {d8-d15}
+ bx lr
+
+ .unreq DATA
+ .unreq TMP
+.endfunc
+
+/*****************************************************************************/
+
+/*
+ * GLOBAL(void)
+ * jsimd_quantize_neon (JCOEFPTR coef_block, DCTELEM * divisors,
+ * DCTELEM * workspace);
+ *
+ * Note: the code uses 2 stage pipelining in order to improve instructions
+ * scheduling and eliminate stalls (this provides ~15% better
+ * performance for this function on both ARM Cortex-A8 and
+ * ARM Cortex-A9 when compared to the non-pipelined variant).
+ * The instructions which belong to the second stage use different
+ * indentation for better readiability.
+ */
+asm_function jsimd_quantize_neon
+
+ COEF_BLOCK .req r0
+ DIVISORS .req r1
+ WORKSPACE .req r2
+
+ RECIPROCAL .req DIVISORS
+ CORRECTION .req r3
+ SHIFT .req ip
+ LOOP_COUNT .req r4
+
+ vld1.16 {d0, d1, d2, d3}, [WORKSPACE, :128]!
+ vabs.s16 q12, q0
+ add CORRECTION, DIVISORS, #(64 * 2)
+ add SHIFT, DIVISORS, #(64 * 6)
+ vld1.16 {d20, d21, d22, d23}, [CORRECTION, :128]!
+ vabs.s16 q13, q1
+ vld1.16 {d16, d17, d18, d19}, [RECIPROCAL, :128]!
+ vadd.u16 q12, q12, q10 /* add correction */
+ vadd.u16 q13, q13, q11
+ vmull.u16 q10, d24, d16 /* multiply by reciprocal */
+ vmull.u16 q11, d25, d17
+ vmull.u16 q8, d26, d18
+ vmull.u16 q9, d27, d19
+ vld1.16 {d24, d25, d26, d27}, [SHIFT, :128]!
+ vshrn.u32 d20, q10, #16
+ vshrn.u32 d21, q11, #16
+ vshrn.u32 d22, q8, #16
+ vshrn.u32 d23, q9, #16
+ vneg.s16 q12, q12
+ vneg.s16 q13, q13
+ vshr.s16 q2, q0, #15 /* extract sign */
+ vshr.s16 q3, q1, #15
+ vshl.u16 q14, q10, q12 /* shift */
+ vshl.u16 q15, q11, q13
+
+ push {r4, r5}
+ mov LOOP_COUNT, #3
+1:
+ vld1.16 {d0, d1, d2, d3}, [WORKSPACE, :128]!
+ veor.u16 q14, q14, q2 /* restore sign */
+ vabs.s16 q12, q0
+ vld1.16 {d20, d21, d22, d23}, [CORRECTION, :128]!
+ vabs.s16 q13, q1
+ veor.u16 q15, q15, q3
+ vld1.16 {d16, d17, d18, d19}, [RECIPROCAL, :128]!
+ vadd.u16 q12, q12, q10 /* add correction */
+ vadd.u16 q13, q13, q11
+ vmull.u16 q10, d24, d16 /* multiply by reciprocal */
+ vmull.u16 q11, d25, d17
+ vmull.u16 q8, d26, d18
+ vmull.u16 q9, d27, d19
+ vsub.u16 q14, q14, q2
+ vld1.16 {d24, d25, d26, d27}, [SHIFT, :128]!
+ vsub.u16 q15, q15, q3
+ vshrn.u32 d20, q10, #16
+ vshrn.u32 d21, q11, #16
+ vst1.16 {d28, d29, d30, d31}, [COEF_BLOCK, :128]!
+ vshrn.u32 d22, q8, #16
+ vshrn.u32 d23, q9, #16
+ vneg.s16 q12, q12
+ vneg.s16 q13, q13
+ vshr.s16 q2, q0, #15 /* extract sign */
+ vshr.s16 q3, q1, #15
+ vshl.u16 q14, q10, q12 /* shift */
+ vshl.u16 q15, q11, q13
+ subs LOOP_COUNT, LOOP_COUNT, #1
+ bne 1b
+ pop {r4, r5}
+
+ veor.u16 q14, q14, q2 /* restore sign */
+ veor.u16 q15, q15, q3
+ vsub.u16 q14, q14, q2
+ vsub.u16 q15, q15, q3
+ vst1.16 {d28, d29, d30, d31}, [COEF_BLOCK, :128]!
+
+ bx lr /* return */
+
+ .unreq COEF_BLOCK
+ .unreq DIVISORS
+ .unreq WORKSPACE
+ .unreq RECIPROCAL
+ .unreq CORRECTION
+ .unreq SHIFT
+ .unreq LOOP_COUNT
+.endfunc
diff --git a/simd/jsimd_i386.c b/simd/jsimd_i386.c
index d9bb774..f77c5ef 100644
--- a/simd/jsimd_i386.c
+++ b/simd/jsimd_i386.c
@@ -2,7 +2,7 @@
* jsimd_i386.c
*
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
- * Copyright 2009 D. R. Commander
+ * Copyright 2009-2011 D. R. Commander
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
@@ -84,6 +84,28 @@
}
GLOBAL(int)
+jsimd_can_rgb_gray (void)
+{
+ init_simd();
+
+ /* The code is optimised for these values only */
+ if (BITS_IN_JSAMPLE != 8)
+ return 0;
+ if (sizeof(JDIMENSION) != 4)
+ return 0;
+ if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
+ return 0;
+
+ if ((simd_support & JSIMD_SSE2) &&
+ IS_ALIGNED_SSE(jconst_rgb_gray_convert_sse2))
+ return 1;
+ if (simd_support & JSIMD_MMX)
+ return 1;
+
+ return 0;
+}
+
+GLOBAL(int)
jsimd_can_ycc_rgb (void)
{
init_simd();
@@ -155,6 +177,55 @@
}
GLOBAL(void)
+jsimd_rgb_gray_convert (j_compress_ptr cinfo,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows)
+{
+ void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
+ void (*mmxfct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
+
+ switch(cinfo->in_color_space)
+ {
+ case JCS_EXT_RGB:
+ sse2fct=jsimd_extrgb_gray_convert_sse2;
+ mmxfct=jsimd_extrgb_gray_convert_mmx;
+ break;
+ case JCS_EXT_RGBX:
+ sse2fct=jsimd_extrgbx_gray_convert_sse2;
+ mmxfct=jsimd_extrgbx_gray_convert_mmx;
+ break;
+ case JCS_EXT_BGR:
+ sse2fct=jsimd_extbgr_gray_convert_sse2;
+ mmxfct=jsimd_extbgr_gray_convert_mmx;
+ break;
+ case JCS_EXT_BGRX:
+ sse2fct=jsimd_extbgrx_gray_convert_sse2;
+ mmxfct=jsimd_extbgrx_gray_convert_mmx;
+ break;
+ case JCS_EXT_XBGR:
+ sse2fct=jsimd_extxbgr_gray_convert_sse2;
+ mmxfct=jsimd_extxbgr_gray_convert_mmx;
+ break;
+ case JCS_EXT_XRGB:
+ sse2fct=jsimd_extxrgb_gray_convert_sse2;
+ mmxfct=jsimd_extxrgb_gray_convert_mmx;
+ break;
+ default:
+ sse2fct=jsimd_rgb_gray_convert_sse2;
+ mmxfct=jsimd_rgb_gray_convert_mmx;
+ break;
+ }
+
+ if ((simd_support & JSIMD_SSE2) &&
+ IS_ALIGNED_SSE(jconst_rgb_gray_convert_sse2))
+ sse2fct(cinfo->image_width, input_buf,
+ output_buf, output_row, num_rows);
+ else if (simd_support & JSIMD_MMX)
+ mmxfct(cinfo->image_width, input_buf,
+ output_buf, output_row, num_rows);
+}
+
+GLOBAL(void)
jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
JSAMPIMAGE input_buf, JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows)
diff --git a/simd/jsimd_x86_64.c b/simd/jsimd_x86_64.c
index 7659249..2951268 100644
--- a/simd/jsimd_x86_64.c
+++ b/simd/jsimd_x86_64.c
@@ -2,7 +2,7 @@
* jsimd_x86_64.c
*
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
- * Copyright 2009 D. R. Commander
+ * Copyright 2009-2011 D. R. Commander
*
* Based on the x86 SIMD extension for IJG JPEG library,
* Copyright (C) 1999-2006, MIYASAKA Masaru.
@@ -47,6 +47,23 @@
}
GLOBAL(int)
+jsimd_can_rgb_gray (void)
+{
+ /* The code is optimised for these values only */
+ if (BITS_IN_JSAMPLE != 8)
+ return 0;
+ if (sizeof(JDIMENSION) != 4)
+ return 0;
+ if ((RGB_PIXELSIZE != 3) && (RGB_PIXELSIZE != 4))
+ return 0;
+
+ if (!IS_ALIGNED_SSE(jconst_rgb_gray_convert_sse2))
+ return 0;
+
+ return 1;
+}
+
+GLOBAL(int)
jsimd_can_ycc_rgb (void)
{
/* The code is optimised for these values only */
@@ -99,6 +116,41 @@
}
GLOBAL(void)
+jsimd_rgb_gray_convert (j_compress_ptr cinfo,
+ JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
+ JDIMENSION output_row, int num_rows)
+{
+ void (*sse2fct)(JDIMENSION, JSAMPARRAY, JSAMPIMAGE, JDIMENSION, int);
+
+ switch(cinfo->in_color_space)
+ {
+ case JCS_EXT_RGB:
+ sse2fct=jsimd_extrgb_gray_convert_sse2;
+ break;
+ case JCS_EXT_RGBX:
+ sse2fct=jsimd_extrgbx_gray_convert_sse2;
+ break;
+ case JCS_EXT_BGR:
+ sse2fct=jsimd_extbgr_gray_convert_sse2;
+ break;
+ case JCS_EXT_BGRX:
+ sse2fct=jsimd_extbgrx_gray_convert_sse2;
+ break;
+ case JCS_EXT_XBGR:
+ sse2fct=jsimd_extxbgr_gray_convert_sse2;
+ break;
+ case JCS_EXT_XRGB:
+ sse2fct=jsimd_extxrgb_gray_convert_sse2;
+ break;
+ default:
+ sse2fct=jsimd_rgb_gray_convert_sse2;
+ break;
+ }
+
+ sse2fct(cinfo->image_width, input_buf, output_buf, output_row, num_rows);
+}
+
+GLOBAL(void)
jsimd_ycc_rgb_convert (j_decompress_ptr cinfo,
JSAMPIMAGE input_buf, JDIMENSION input_row,
JSAMPARRAY output_buf, int num_rows)
diff --git a/simd/jsimdcfg.inc.h b/simd/jsimdcfg.inc.h
index 4876038..0dacd06 100644
--- a/simd/jsimdcfg.inc.h
+++ b/simd/jsimdcfg.inc.h
@@ -32,9 +32,40 @@
definev(RGB_RED)
definev(RGB_GREEN)
definev(RGB_BLUE)
-
definev(RGB_PIXELSIZE)
+definev(EXT_RGB_RED)
+definev(EXT_RGB_GREEN)
+definev(EXT_RGB_BLUE)
+definev(EXT_RGB_PIXELSIZE)
+
+definev(EXT_RGBX_RED)
+definev(EXT_RGBX_GREEN)
+definev(EXT_RGBX_BLUE)
+definev(EXT_RGBX_PIXELSIZE)
+
+definev(EXT_BGR_RED)
+definev(EXT_BGR_GREEN)
+definev(EXT_BGR_BLUE)
+definev(EXT_BGR_PIXELSIZE)
+
+definev(EXT_BGRX_RED)
+definev(EXT_BGRX_GREEN)
+definev(EXT_BGRX_BLUE)
+definev(EXT_BGRX_PIXELSIZE)
+
+definev(EXT_XBGR_RED)
+definev(EXT_XBGR_GREEN)
+definev(EXT_XBGR_BLUE)
+definev(EXT_XBGR_PIXELSIZE)
+
+definev(EXT_XRGB_RED)
+definev(EXT_XRGB_GREEN)
+definev(EXT_XRGB_BLUE)
+definev(EXT_XRGB_PIXELSIZE)
+
+%define RGBX_FILLER_0XFF 1
+
; Representation of a single sample (pixel element value).
; On this SIMD implementation, this must be 'unsigned char'.
;
diff --git a/simd/jsimdext.inc b/simd/jsimdext.inc
index 12a04c2..4ab9bc0 100644
--- a/simd/jsimdext.inc
+++ b/simd/jsimdext.inc
@@ -38,16 +38,26 @@
; -- segment definition --
;
+%ifdef __YASM_VER__
+%define SEG_TEXT .text align=16
+%define SEG_CONST .rdata align=16
+%else
%define SEG_TEXT .text align=16 public use32 class=CODE
%define SEG_CONST .rdata align=16 public use32 class=CONST
+%endif
%elifdef WIN64 ; ----(nasm -fwin64 -DWIN64 ...)--------
; * Microsoft Visual C++
; -- segment definition --
;
+%ifdef __YASM_VER__
+%define SEG_TEXT .text align=16
+%define SEG_CONST .rdata align=16
+%else
%define SEG_TEXT .text align=16 public use64 class=CODE
%define SEG_CONST .rdata align=16 public use64 class=CONST
+%endif
%define EXTN(name) name ; foo() -> foo
%elifdef OBJ32 ; ----(nasm -fobj -DOBJ32 ...)----------
@@ -299,8 +309,6 @@
%ifdef WIN64
%imacro collect_args 0
- push r10
- push r11
push r12
push r13
push r14
@@ -330,8 +338,6 @@
pop r14
pop r13
pop r12
- pop r11
- pop r10
%endmacro
%else
diff --git a/testimgfst1_2.ppm b/testimgfst1_2.ppm
new file mode 100644
index 0000000..c17f310
--- /dev/null
+++ b/testimgfst1_2.ppm
@@ -0,0 +1,4 @@
+P6
+114 75
+255
+0/+10,32.63.83/83-:3-:3+72.61-61-72.61-61-61-61-4/+3.*3.*2-)2-)2-)2-)2-)/,%0-&2/(30)63,74-96/:70A;-E?1HB4JC3LE3LC2LD1PE3R?0fB2D5E4²D5¾D7ÆF;ÊG?êCKëDKíCFó?B÷:>ó:?ä@?Ò>:µ@,´?+³@-°@,«@,¤A,B*A(@->,>,>)?+>*>*?+@8?2®C1½D1¹A1¤G8xD6J7&:6584362/40-63.52-52-41,,1+.0+/0+2.+3.+3)(8,,G99sCCMK¥Z^¤p©z¼ekSGoNI`OL]jjr¤rsaWVDUQbUQb..,0/+21-52-52-61+61+81)61-50,50,61-61-61-61-61-3.*3.*2-)1,(4/+4/+4/+4/+2/(30)41*52+52+74-85.96/?9-B<0E?1G?2G@0H?.I@/MA1LC2[D2qD1A/;)¦<,³C5ºI;ÝADâDEìDDö?Aù:?ó<>áB>É@6±A-°@,¯?+®?,©@+¡A+A)A)?,?,>+<*>)>)?*?+A5A2´C3ÂC4ÀF9£I>pD7F:*=85<7494173063.32-32-21,-2,-2,/1,10,40-5-+6,+>43`;2|F:PNgxx£s¹Z_NBrNCcMH_ON\ost~
wjl^VWG[U_[U_,,*--+0/+10,30+30+4/)4/)3.+2-*2-*3.+4/,4/,4/,4/,3.+2-*1,)1,)4/,4/,4/,4/,41*41*41*52+52+63,74-96/<5+?9-A;/B:-C;.D;,F=.K?1FI6PH5aE0tA,;'=)¡D2®M<ÏEBÖE@äB?ò<;ú9<ï=;ÖC;ºA0@+@,¬?+©>,¤?+?+@)?)?,>+=*=*=*<+=,?.C2¥A2¼B5ÆA8¹D;MCcC8:;-@85>63:5174/43.23-14-03,,3,,3,-2,/1,23.40-1-*50-N7)b=-qE<ap|v¤ny»[`¢NFPAjJ@bFCXEHQRXVU\TQWKRXJ`XU`XU*,+,,*..,0/+/.*1.)1.)2-)1-*0,)0,)1-*/+(/+(/+(/+(1-*0,)0,)/+(1-*1-*1-*1-*30+30+30+30+41,52-74/850:3+<5-=6,>5,A9.C9-F<0K?3DE5LE3XC2f?.u<+:)>-F4»F<ÆH<ÚE>îA=ò::ç>9ÊD8©@*¦A-¦?,¦?,¤?- ?,?,?+>)>-=,>,=+=-<,=/?1E1¨B4¿C;ÃB<·PI`UeUH>I;?80=6094.63,34.14-/4--4,-4--4--4-.3-/1,23./0+0/+</)K5([B;}l~¼zÍkn½OLJ=hD=_DBX<CMBLKLWOMYMR\QaZJaZJ,.-,.-,.---+/.*.-)/,'/,'-,*-,*-,*-,*-,*-,*-,*-,*-,*-,*.-+/.,/.,/.,/.,/.,0,)2.+3/,3/,2.+2.+40-62/81+;4.<5->5.>5,@6-C9/H;2G?4L@4T>3]9-m9,~8,<.?1¦B3³E6ÉG:ÝD>çB>ÞE?¼D4C, A-@,>+?-=,>+>+>*=+<*<,
<+=.
=/
?3B6G4ªH;¼E?»LE°f[zjrtfM]PMI>A?3:7.33)34,03,-2,,1+-2,-2,-2,-2,02-02-12-12-7-6?42RID|ÅØqyÁbh¦TQpIKbLTa]klqzym}p\j[a[Cc]E+/0+/0-/.-/.--+-,(,+',+',+)+*(+*(+*(,+),+),+),+),+)-,*-,*-,*.-+.-+/.,/.,0,)1-*2.+1-*0,)0,)2.+40-91.;30<41=4/=4-?4.A7.E80G:4J;4O:5U61c60u6-:.<0A3A2®B5ÃE9ÑG=ÍH?±F6B.B.@,>,?-=->,=,>+=*<);*;,;/=2@7
E;K<£I@²LG®^U¦nzxao`PTCGI;=?224)01)./)./*/0+/0+/0+/0+/0+01,01,01,01,6+<711SUH²¿¶²|v
¬¦`q^ZV9`\?+/0+/0+/0-/...,--+-,(-,(,,,+++***)))+++++++++++++++*********+++,,,---.../+*0,+0,+.*)/+*/+*1-,3/.:20;31<41<20<3.=2.>3-B5/@72B94D95H70U7/h8.~<0>1?6@2C2¨D4µE9·G;§B6@1A,?+=,=,<-=,<,
<+;(;*:+:+=1?5D;
IAJ?JDªWQ¦uf}¨~s~m\hRJVB=F58<.12*.-(/+(2,,0,)0,)0,)0,)/.*/.*/.*/.*7)841(Q\>~r¨Æ«À«Â¨´°´§}yZnUST5UV7,03,01,01.0//10//-..,/.*...---+++*********************)))(((***+++---.../+*/+*.*),('0,+0,+2.-40/;23<42;31;1/;1/;0,<1-?2,:70983:94=82F3,Z6*q9*<+:3?3B2B/>.¨B6 @4?2@+=+;*<-<,<-;+;*:'9(9*}9,~>2A8H@NHIAPL«d^¥v¦¯}tfx^XgPHT@=C557,1.)1)'4*+2*(2*(0+(0+(0,)0,)0,)0,)9(232GW(vY{ °Î Χˡµ²°¥}sjSgKIL/FI,.1(/2)12*12*44,63,52+30)7/,6.+2-*0,+.,---/+,0)*./(//(/.)-.*+-,*-.)./)./),.-.../.,2.+2-'6/'90'<2)<5+=6,=4-<3,<3.;0,;0.=20F/'97*.:,36-C+)Q'(Y2+]A3vB,A1>19.<,B/C.@,82=1A/|B.B0>/;-;,x<1p;+s@-t<+>0H<MAQCLNm`zo}¢¦¦£kz`bX|VZnRQUDF?7:..6',2%,$-*'+*+),1(-3(03'10)1-*11-..-(HK8w`n£n§p¶}»´«x©z¦|{yliTcPCJ:;B203*14+34,34,66.96/85.74-92,61-4/+2.+0/-///..0*+-0*.0*./+,/+*/.*/.*/0*01+000//-0/+2/*61+92*=4+@6,?8.A8/?6-=4-<3.;0,;0.=20B4+O-,X&/L(,>1+;3(Q0'h.,i;,y=2<6;4>5B4B5B6?/?.?-;+:+:*<)w?(|<0v;-v>/x>0B6G>K@ODNNl`m| |ª
ª¡
{aj[cZ`SvXE^H5G7)6,$/'4%(2&(1(+/+,+,.(..%/0$002,..+&DG6s~`|hk}l§r
ªt§r~¦r~¥v}¢yxtjeRdLAC58:,47.47.67/780991<92=:3<92>71:5194073073054232010.5,-3--3--2.+3/,21,32-23+33134/43.83-<5-?6-C9/D:0D<1D<1B90@7.>5.=4/=4/>50@72R/3\(4Q-1<8/4;+D6)Z/(`80q:59:98~:7}A9B;
@9~F/B-=,9+7);)y?)qB(
2*H=|:.E9|H;K>NATHnoO{wZew¤|}zªuynl{lr
iesZUZFGA3</&9))3)',+&).('-)*,),*+1(+2*'?;0PUAhwXn_pbrgqgu jsjy¥ty£uwsspgbNeHB>3:6+6906908919:2;;3?<5@=6?<5@;5?:4>93=84<94<94:7285091.91.72.72.52-52+44,55-540761<92?;2@9/C;0F<0J>0H>4H>4E;1A8/A81@70?82@93>93?<5A>7D=3F90I9,H;*F>)g3(z93@<D@HA?690<5A5@4=2}=1y?1x@1|>1;1£3/å{¤TKL>nO;iU=sXC`LcPx]¾e_ÌbdÉv®~ }wqr~ssqig_xXS]BBD.B5-:3)11'.1&41*<-*F',M$,ME2`[EfmNj|VhViYoaqdpiniw tuttsole_MgDLC:D;28;28;2:;3=>6==5A>7B?8C@9E@:E@:D?9C>8B>5C<4B;3B;3A81A81?80?80<71:7085.74-77/96/=90A:0C;0G=1L@2MA1MA5K?3G=3E;1B90@9/>:1?;2C<4I81[<7h=7o>7r>3y@5I>F7G9?5>2¡I;£M<£G8¨D5 BC99<7uA4lE4wC610¬7@ÞPNÈFDÅb\M=h\BafFlgIjO¶eTâU[ú(Eÿ!Iÿ5SïQ`ågkàloÈuqÃzs¹u²u«s¨vm£d_TRHO>Bh86O0+J3-F3,J2.Q84]R2fc@qyRt\mYo]tavcrnurzy~zylic~]NiFTNBQK?6907:1<=5?@8AA9C@9DA:DA:EB;EB;FB9EA8IB8I@7F>3D<1C;0D<1D;2C<2=90<8/96/85.96-:7.=9.B<0E=0J>.M@/M@/M?2L>3H<0E;1D<1@<1@<1@=4Q9/@FÕN_ÖR]?7H8¹LGÛ?J¡F3¦@1«;-?0ªC0;$ª=)±<+³6<¼?E¹HJ£LE~<.5+½BGá@RÚ83Ì73ÉTMVEpbEopNkL¥s\ÿKWý8Jÿ5Lÿ0Jÿ5Mý1Jÿ/Iÿ/Nÿ5Vÿ9ZüA`øEcõFeõCgüClÿHrÿXzïUqÛ\qªOXe/-O<.;@,9K3[Q.ieB|`}kxjuixh~l
¨ ®¢°£¢wvaz\OjGVWEXYG58/690:;3>?7AA9DA:EB;FC<GD=GD;HD;KD:LD9JB5H>2G>/F=.E;/D</D<1A:0>:1<8/;60:8,<8-@:.D</G>/K@.NA0M@-N>1K=0G;/D:.B<0@<0@>2@@4u:4ÎU^ì<PÐ+2¤4&=#³?0×45¤@0ª</¶@6»G:ª?-¥:(¯:)ÁA4ÈB9Ý?>é:?ã?@ÑD=ÙSJÜ>=è08Ú6*Ð3*»80±bS[A_C®cPÚg`ö=Eá<@×HDßQOêKOò9Gú1Dÿ4Jþ9Uü:Uÿ=]ÿBdþ?hüAlúAm÷@nÿ?hÿFkøKièZp¾Zdl71QA1FK4bUB|j¥¯¤Â¶ÉÉÁÍÉÈÆÄDZ³°ey`RmLU^CW`E47.47.67/9:2==5A>7EB;GD=HE>HE<JF=MF<ME8ND8OC5NB2LC2JA2F>1D</B;1A:2=90<71;9-<8,A;/D=-I@/LA/NA.O@-N>1L</H:-C9-A;/?;/?=1@@4CB¼HI¹//¶0%©9!C!C"? 8/¥6-³>7´B8«?3§;.ºD:Á@:Ä>#ä2&ÿ $ÿ#)÷*'è3(å3'ë/&Ö7"Ô6*Ä;3ÃeYaN[HÜa\ñCLí?AÓ@9¾@4ÎA:òAIÿ4Gü6Gõ=Iý;Sý8Tÿ7Zÿ9cÿ>mÿ?pÿ@tùAuúGeÿLjþMjÿa|ïfxÏjrTQPHz³©§¼¼¾¸½Ã¼ÃÍÆÈÔÒÏÚãÙäìáÝíáãëÛåâÖàÇÂÈnj\uW^mN]lM11/442783893:;3=?4AC6DF9GI>HI9IK5MM3KJ6JIDRP[KI^OF7I@1IA4D<1B;3?82>95;63A62?74<;9===?@;EA6LA/O?(@B-J91N45F698?82E27A)QK3½L<¡6$:& =&¡=&®?+³:)µ6%¡:)¡<*§B.©B/©>*´?-ÂD5¼8+Í6+Ë<,Ñ=/â7/ò/-õ/,ä7)Ó>(Ú8#Ñ9$Ã7&ÉE8ÕJCñSRöAFþ9BàDEÌA<²<0¨?,¿N>ÖI@ì?Aÿ<FøEKûEQû@SÿA[ÿEi÷>g÷CpüL{ÿKwíRrçYqÿYzÿHqôLpÀhvzmdº ÝÕÊàäãäàîôÚõÿÞ÷ÿéöøôõûøó÷óðñëëéãåØÔÕ¶¶´{
zy~
s..,01,34/560891;=2?A4BD7IG;KI:NL7OM8NL@`_dttsvjbwVO_JDPC>DA=>;83=90=9-96-<90><0></E?1K?/O?/P=,7A&<=+>:/;83?:4P20r*.¥:D¥7&¤9'¢<&;$§='´A.½>-Á<-°?/«:*¬;+<*³;*ÃE6Â=.Ã7*Ö6*Õ9,Ú:,æ3,ô.+ò/)à5$Î9!Ü3 Û:(Ñ;-Ì?5Å:3ØD@çIFå@>ÓC;Å?4²:,«<+µ=/ÕJCä@AüGNñ@FúFOýDTü@YÿDeÿFoÿLyýLzÿFxÿMuÿWxúPmøKiÖK`ÓdWGÁøâ×û÷öøõÿþíÿÿîÿÿöÿÿýüÿþùÿúöþõöýòöîåæÍÉÆ®±¨§¡ª²£¤¬32-10+21,44,77/::0>>4AA5KE9PI9SL9RL<TPMqr»ÐË}´nm\[{POaA@E:9497+3828:/?<+D>&I?&K@,JA2I?5O<6F93893/<24</M5+?>¨7=¨=+ªA,§>)©?)¬9&¹<*Ä:-Ì<1Ã?3½9-½9-¼8+Å=1Ê<0Æ2(Ï8-â1)â4)é4+ï0(ö/*ð/&Þ4#Ì7Ù2 ×4#Ö8,Ô@6ÛLDÌC9ÐL@ÅC6¿;,º;*µ:*¹?0½=2Ë@;ÛEFëLPí@DöGNýKYûE[ùB`þIlÿOxÿLvÿP|ÿOvÿTuùOiìMaÿzÿKF¾vúÑËÿ÷ôþüÿýúÿÿùÿÿûþÿüùÿüöÿûøÿ÷øÿóõöìëàØÕÔÑÈÔÖÈËÕ;ÈÀ;;366.22*33)55+88.<<2??5LB6TH8WL:TJ>WRXwxÖ¢«ö£¨ù êÛÅ©hhTSeKIVCET>=C>;2C>*CA*BC1?E;;DABASJM\MW`LXVLNCaJ:R>@,ª?+«@,¯B-°=*¶9'Â8+Ì8,Ô:0Î92Í81Ñ:3Î7.Ö>3Ò5,Ù;0Ù8.é1'í1(ô/)ö,(÷.'í3'Ü7$Ï9!Ñ9$Ï6$Ó7*Ñ7-ßJCç]SÈH=·?1¶>%¶<%¹:'Â>1ÈB9ÏF@ÓIGÓIGèDEïIMûQZúN^öE_úHhÿPtÿQxê[wö\xýVpùRfÿ[lóRaòO`óL^¼ql︳ÿíéÿüûùÿÿùÿÿüüúüùôÿûõÿüùÿôôøêêìÞÝäÛÔïéÝø÷åæñíÏÚÖA?3><0:8,85,52)63*;8/A>5KA5SG7WJ9ZNBUNUppÙ¬ÿ©µÿ¬¶þ«´ù«°ò ¢ßÄtq¦_]]TVOqEAP??=>A6?G<;DAFOTMli||j| Xc¯RM«A1§;!¨;'¬=)±<*·:(½5'Ê8+×:1Ý:1Ü:5Ý;6ß<5á>7åA8Þ;2îLAóQFî6,ï,&ø+(ú*(ö1+é4)Ö3$Ò7%Å=%Ë='Ï9(Ð6*Ó9/ãNHÜOHÀ93·=%º<%½:(Ã;-É@6ÙTMÉJCÃF@âHFéOOíQUíMWøSd÷OhþQoÿRsíWtû\xÿZsýTgÿYgÿ[jøIZÿMcªg_ÑùÚ×ûóð÷ÿý÷ÿÿýÿüÿú÷ýúóÿ÷ôÿ÷õïáàáÓÐèÞÔþ÷åÿÿëïøõÖßÜGC7D@4@<0=9.95*84+;7.@;5G@6NE6TG4WJ:WNQhgͧõ©³ø®¸ý²»ÿ²¹ÿ¬°ù ê×yvÃod¨bZRRvBCU<:?QABdGKbi¯q¢¼u¡ÂfÈMlÒ>TØ?DÁ9+µ="¬9&°8'¸;)Á<-Ì=/Ù?5à=4ß80Ö3,Ø3-æ?7â;3Û4+Ö4'Ø8*Õ9*ñG8õ:3÷))û*-î.+â4-×3)Ó1&Ì;(Ï<*Õ>-Ø</Ù=1×>8êRQÔ@@Á<)À;(Á9)À8*Ä>2ÐNAÉMA¿E8ÕH?ÜOHßQOÞMPñYeý^púTlúPkÿKsÿWvÿVmÿ_pý_môbläfjÑcb}WJ¡{rßÀ½÷éè÷üøöÿþþÿÿÿúýúûóýúóÿú÷÷îéâØÏäÝÍÿûåÿÿæð÷ðÝäÝMJ9JG8FC4C?3>:/<8/<71?:4C@7KE5QF0WH3WLHb`v¾£è§÷«±û³ý®²ü©÷¢¦ðçÛ
Ënr¯bh\YxkPcJUµQYÏS[ðBcåG^ÕAOÍ3=åAHÝ?>ÊB6ºE1¼A1ÁB1ÉD5ÔF8×@5×9.Ø4+Û4+Ø7-Ý:1Ü8.Ü5,Ö4'Ó6'Ì5"Ð=)Õ>-ðB9þ68ø-0ë20Ø/*×2.à42ê72æ:0à:,×:+ÝE8éTMÕA?ßJLÑ>4Ç7,Å;.À<-»<+ÀC1ÁD2¼?-ÅE8ÍMBÒQKÓOMê_dÿiuùZløRhÿRvýWoõlvífmôbmîhqÓ{yrb_]Hyg[Ë«öàâüø÷ùÿÿÿÿÿÿùÿûÿ÷üÿöÿÿøÿüôïçÜëæÓÿýäÿÿâó÷éêîàQN=OL;KH9HD8D@5@<3?:4@;5AB<JG8QF0VG0SI?`^l¶¡Þ£¤÷¨©ü«¬üªú¦ªó¡¨ì¡©ê§èàÕĪi¹SaàCL÷8?é@-ÖI-ÂK)¼E'ÝP?Ü:7â<>Ô59ÁB1Ã?0Å9,Å3&Í3'Ô3)Ø4*Ú6,Ý?4Ù9-Û9.Ö4'Ô4&Î5#Ì;&Ç;"Å:'Ü5,ù78þ7<ò;=ß:8á99å58ü+0ô.-ä2(Õ5%Æ5$îaWÎ@<ÕFHæIDÏ81Æ9/¿=-¹>,»A,¹:'¾=(¶<-ÀF9ÇMBÉLFæabújsýbrúYkú^sàkqãàwtþp|îaqó·KbF`]N¾¤£öÜßÿ÷ûýþÿÿýÿÿ÷ÿøÿ÷øþôýþöÿÿöû÷ëöôßþþâÿÿáýþîûüìXO@WN?TK<RI:MD5KB3I@1I@1DD:KH7RJ3TL5UNFa`r
µÞ£ô ü¥ÿ ¬ÿ¬ò¢§ç«¥í¯¢ôªý¢Ý¬¼¾lzÝ@Iõ6>ê<>ÕF@á:BÓ??ÊC?Ï@<éCGì9?â9<Ô<9Ë@9ÊE<ÅG9µ:+»9+Æ6-Ó1,à42á>-ß4#å8'Ú5!Í7Æ8 Ë8(Ï5)Ñ3*Î8*É8%Ñ6"à2'ì0.ì+0ê-4ó+.ì/+ã5*Ô7$Ä3ÜO>ÙKAÒA<ÞRQÒD@É90È9)Æ;(¾:%»>*¶?+³;-¸>/½?0ÃA3ñmaíhaïiföpoÿmzïdkòadõtoý{yÿVmõ}¦SiB`dI¼¬ûæãÿøøüúûûÿÿúþÿãÿíæÿê÷ÿóÿÿòÿýíÿøçüöàýùàüþûþÿýZQBXO@VM>UL=QH9OF7NE6OF7IG;OJ7TL5WL6VMDb_p}«ÎØä ð¥ð§å¡ÚÛÜΨ¹ÈlÏG[ÝAEâ@>ã?@ä=DÜ;@ÑA@Â>9ÖKFâ?Bç:>Ø88Ì=5Ê@6¾:-ÆH9¹<*¼8)Ë9,Û81é<8Ó5)Ú6,Û7+Ö=+À9#¸;%º<-½9-ë?;Û=1È:&È:"Ð7%Ô0$Ø1+Ô1,Ø1)×7+Í6#Í<'Ê<(áM?×:5ïLMùecíZS×D:Ä5%Á8&º9&¶=*±>,<.±=.¶>.¿D5Û]QéhbîjhédgåTaóho÷djûws÷qrýG`ñtqsQj@hoNÊ¿ÿõíÿý÷ûÿùùÿûóýõØýÞÔòÖãõÝôùåûøåûòáíåÒòê×üùôÿýø\P@[O?ZN>YM=WK;VJ:UI9VJ:MI=SL:XM7XM7UMB_\etu¶»È×ÙÓÀy¹owµp¹[ì=dö5JæDBÖLAáEFö:KÛBDÌEA´:/ÐKDÜB@ß<=ÖA;ÊH;Â8+½8'½<)½<'Å<*Ò<-Þ7.æ81æ44ç10í53ß4-Î4,È91Ä22Ô>@ò14à5-È7$Â<#Æ;$Ë8&Õ=/Ô>0ÊC0¿:'Â>)Ä<&Ì;*Û=2â64â.1Ô72Ú@8ÝE:ÓD4ÉA1º=+°=+¬=,©>.«=,¬=,¶B3ÓZOæicëikìfmûozðgnûhnÿxxöelþ=ZîgxucOz`ÍÉ®ÿùæÿÿñõÿñèûçÖçÔ´ß´³Ù°ÁܹÔãÆêìÖôíÛëÝÐíÜÒìâÙëáØZN>YM=YM=XL<XL<WK;XL<YM=SK>VM<YN8ZN8XNBYSUb_rqpy|±Åʽwy¬oo£gfWSÅISü8Lÿ4AðA<ÝJBäEIö;NÔEAÄE<¯;.ÉK?Ì73Ë0,ÎA8¾E4Â;(À;(¾<&¿;&Ç9%Õ:(à6)æ4*ö.1ÿ16ÿ-4ÿ.4ú17ô/8þ1Bý'?ö'/è0.Ô6+Í:*Ð8*á=3ä<3æ;3ÑL;ÉA1Á8&Ç:)Î6)ä?9Û++ì57Õ4*Õ7,Ð8+È9+ÖQB¾@2¯9+<.¬<.®?.«<+¬=,ÆQGâhcîpsös{út}öpwÿnwÿpwõ[eÿ:ZëZk¥
{el´¸ÚÝÀ×æÇ¾Ù¸¬Ê¦£½½Â£Ç³Ì¢ËÖ¶ãáÌêÜÑâÍÈÕǼ̾³ZM<ZM<ZM<ZM<XK:YL;YL;ZM<YM?[N=[O9\P:ZN>XOJZSZ_Yehepm|w¹È½t©t¨d¡@0»?3Ý>8÷@<ö=;ð=@ëBIä@KÄ?8´>2¬=,ÆH<Ô?9Ñ4/ÏB8³:)¿8$Ã<(Â;'Æ;&Î9%Ö4%á4&ð:/î3*ô-&ü(%ÿ'(û$)ÿ$0ÿ"8ÿ1ö&3é*1Ú,-Ù0-í76ö45÷/1ö.0Ö90ßB;Ë1)Ï2+×82äA:Ø1+ã81Ô<.Ë5'Ì:-Ç;.æ^RÀ<0½:0·7,·3'´4'±7(°;*µ?3ße`òuyùwüzùv|ÿr}ÿitôVdÿ:\æO`zw`}bsx}nqgrg~ n±sº|¾¾¤¹½Á¨ÙÍÁ׿½Âµ¯µ¨¢YL;YL;YL;YL;XK:YL;YL;ZM<\L=]M=]N;\P:^Q@[OAZOI\QO`Tlf^upª
|»º¨y¥Áv¹\Ò=9Ä@3ÈI8ÚC8õ=?ý9Cë@FÍA@»=1¬;+ª;*ÃC6Ö;6ß;9ßKAÄE4À9&Â;(É>+Ë:)Ð4%Ü4'ñ?5ì4,Ø9&ß4#é.%ì,'ë+*ð(2ø#7þ7ð-;ó;EüKUì7@ð,8÷.8õ.3ì,+Ú51Þ97ÿ]\Ú86Ü=9Ù<5Ñ7+Î5'¾7#À8(Á<-Ä;1áWMÅ5-Ó>7Õ<4à=6Û>5Ì=/½9*¸<0×\Uòvxþùzüyÿp}ûcpóPaÿ7WäM\tW^HkPx
YrYfUj^w h¦m¯p·v¹wº{¯{§
º³¡Ê·±«¦ª[L9[L9[L9[L9ZK8[L9[L9\M:^K<^M;]N;^O:[N;\O<_O?`PAcO[bUomj|v¢¢ÏämàKaÿ:MìGMÊE>ÑF?êBBô?FãEDÅB8·?1©:)©:'Â<1æB@ë=<ß=8æZMÉD3¾6&È;*Î8*Ó3'ç:3ì5/ê-)ç53ð45÷29÷4<ì1<î3Dó.Jÿ3Wë=GÿYdÿ[hñ@Pî8Gâ3:Ò72Á8(Æ3)åRJéTPÖA=ØC?Ë7-Í;,É8%¯=%²=)²8)À=3×H@Ñ4/æ=6æ5/ó-.í4/á90Ð<.¼6*ÐQJñusÿõx~üzÿn}ùapðOaÿ7WÞLWXh;[wDmPy[}cyiz¥m«nªmp´s¶o¹t²v¦{¸¸ ÖȽ²¶Â©ZK8ZK8ZK8ZK8ZK8[L9[L9\M:^K:_L;^M;^O:`Q<`Q:aQ:`P9gMN`Tbmm|y~×üjmÿHNÿ)Mÿ9RÞAJÓCCÛBDÝB@ÔD<Â@3²<.¨;'°?-ËA6á77å.0Ý52æRFêeVÈ>1É:,Ð8-Ú7.å61é0-ò53ÿ'Bÿ$Aÿ=þ;ó"Aò*Nñ(Tÿ8jú]f÷[fîM]ß:KÜ:G»-,¥8$E%´;(ÑSEÄA7Â;5ÚOHÇ9-Æ9'Ç9#¥?&¥<'§6&ÈH?ÙHCÛ62ë40ò1*ÿ)-ú,,ê3+Ú:.Ä8+ÃC8élhÿû~ý{ÿgyóZlëJ\ÿ5TÓFNJ`/]xE|`jq©w}¨p|¨i¨i¨km±j·l³r¬}»¾£×˽ªµÉª\K7\K7\K7\K7]L8]L8]L8]L8]K=[N>ZO=[S>^S?^Q@bPBbOAkLIgWbqv··¹åywùlZñO\êDPñEQë=Fá;?×<:Ì?5½;-¦@*«:(ÅA5Ð92Ù6/Ú6*Û:&Ø:!ç@:æNCÉ<+Ï>-å@:ê16ó1<ù4Eü&(ý')ü('ø&%ñ%(ñ)3è(7÷:NÿdmýX_ïKLÔ=6¿B0«B,34"§60ÇGDÄ44ÖB@ØICË>4Ç4*Î6+¹=1¶0%Ã5+×D:àI>Ù5,ì0.ÿ.1ò12ó/0ñ1,ã7+Ê8)¸>/ÝjcýøÿmÿZvÿNjù=^ñ>\¨LOHV5^Cv]y¡e~§k}¦j{¥f|£d~¢b{¦n~ªk}c²c´k°t³¶cqr]L8]L8]L8]L8^M9^M9^M9^M9^M9`Q>[P>YPAZRG^SOdVViY\k]]ljw¹Ü×°±Ñ}ê~qÿbgòKSöFPñ=Fá7:Õ<7ÇA5¹@-©>,²A1ÄH<¾5+Ì8.Ö:-Ù8&Ü:%Ü3.äH<ÕB2Ó<+è@7ì23ù5?ÿDPò01ì**ï--ì,+é-.â-2ñAKûO[åOQçHLá=>Õ:6Ã:0¹?2»E;´94¨3,ËGCÕCCéSRÎ>6ÏA7Ò>4ÞA8á=<ç=>ç;;íEBÝ<4Ø4+é3/õ20ó12õ/0ò1,ä6+Ì:+³9*ÜkcÿùýjzÿVqÿGgú;]éMe;6N\;cGrYuay¢fx¢cv ax`| bz£g{¨ezª^}®]´i°s¢sqhKZU5D?^O:^O:^O:^O:]N9]N9]N9]N9^M1_O6ZN>YRJ^Y]qjzvn
vlnut}¨{Ï
æâ´©w¬m[ç\Wõ]\öLOí8=ç79Ú=8ÉD5ºC/³=1«7*ËYNÇQEº:-Ê;-Ú:,à6)â3.á?4ßC4ß?/ä3+ð0/ó04ÿQYÿZ\á46ç;;ß33Û32Ý:;ãGJÆ-0Ë32ß<?Û25Ô01Ô<;èZYôch÷_kÉJCê_\ô\[Ö<:Ó@8ÚJ?Õ>3×6.ú.:÷)6ô+5üBCÞ3,Ù5+ã5,ï4/ö/2ø-0õ/,æ5+Ð<.±6'Ôc[ÿÿxôfvúNhÿ8_ú;]ÅO[`<,YdFgNs[wbx bt^u^w_| by£cz¨`y¨Z{ªY`
¬k¥szlizj[l\_P=_P=_P=_P=^O<^O<^O<^O<bQ3_P;ZQH_Zarp¥|z«yv«r~¸{
ÀÆÉ¦À»¬±Ì¶¡²s®S>²B4ÚMFðJJë=>ä<;×@7Æ</½=4±8/ÂVIÍfWÂQA¾8,Õ7,â4-â4-ß9-äB3à9)è2'ñ/-ñ10ï56ñRV÷X\ãBGæFHäFGôZ\Ö@AÆ45ê=?î;?ç/7óBJÿagÿemú^küYjê]VÞFCÓ41×84âKBßKAÖ90Ý82ú*7ÿ-:ÿ4>ú>?ß4-Ü5,â4+ð5.÷/2ù-0ö/,ç5+Ó=/³5'ËVOþÿkî`pøIfÿ6_÷DdDDLH/V\@d~Nt]ybt]nVpWsZw_x¡]y¤\u¤Tw¦U}©\¦fkubey]XlP[N=^Q@]P?^Q@_RA\O>`SB_RAbS>^RF^X\omx{¤}·tx¸nq¶uyÔͧ§¿ÃÀ¯ÖÒ¥ßÙßÖÖÌÄ¡³yaÄdVæa\ëKKå;<ä::Þ63É83À=5¼L@½WHÐeUÀ@3Ï5+à3-á40â;2Ü8,à6'ê2(í0*é2,â5.Ø?AíRVéJOÿemÿckþahÿfiðZ\ÿ<Bù1;ñ)6í3@þXbÿfnÿcnüZgâGBÙ53Û2/Ú51ÜB8Õ=2Ú91ä84î7;ð69ð67ä2.Ü5,Þ8,ç2)ó2-÷03ù.1÷0-ê5,Ö>1¸6)ÅJEÿÿc{óWmùDcÿ:aßMdc9-9C(OQ9[pEr\v\oUkPnSqXt\tVu¡Vt SrQsSmQ]zDKe6>W/<U-YL;]P?^Q@`SB`SB`SBaTC^Q@\QOaZaqmxz£v{³ks´`g¯ou¿ä¦¥ßÉÇÌãà³íé ìèâÛ¤Êâ¥
ogWÆibötrèLMí@Bì8;Û<8ÑA9¹;/<,ÒaQÙWIÌ5*Ø4+ã><ìKCÖ6*Ý2(å0'ã.'ß4,Ü>3Å1-ÜFEìQUíMWîNXøXbÿlrçLRò.2ø/9ð(5þDQîGOñUYÿ^cíDKß82é<8î<:â70Ù;0Ö:.Ý90é:5ß<7â:7å95Û4,Ú8-Þ8*è1)÷0+ó23ö01ö0-ê5,Ü@4Á7-ÍIGûv{ÿ[tþLlû;`îCc°LTYF5;D)JE/Qa<jRqVkMgIiLmRoXtVqSkLgJ`DUw;Jf3G^0Hb2Pj:TH8YM=[O?^RB_SC`TD_SC`TD_Xhvrxwuz±jr³\d¬iqº~Îâµ·çÌÎÛÙÚÌàÜ¿ÛÕ»ÎŶ²§£}{ori¢i`Ù~yóvrø^^ñGHé>7àB9Ì>4ÄB5¹;,ÎI:Î?/Ò9+àBAû`\Ý@7Þ:0ä6-á4-Ó5*Ã5'º2"È>3ÓB?Ô=BßEOñWaøahãNRê;8ò;=üCIÿR[Ý49á8;øDGò46ê93ñ:6î73ä50ß<3Ú<1á81é62ã;8ç:6è94Ý5,Û9,Ü9*ç2'ò/)î53ó11ô1-ê5,Ý<2Å5-àTUûktõRmÿ;bÿ7`ÜSgLF[U?PN9NF3FT3]oEj
NiHeEgIkPmVpRjLcF_DYASt=Tn>[rFVs=Wt>OC3UI9XL<]QAcWGbVFaUEk_Ospwwtv©jo¯]eem¶yÉÛ§Í«µÙµ»Ýº½Ü¼¹Ö´®Ê®¤¿§utyjfevgbaXZQÕphÿzuÿjgÿPJìE=ÜB8ÕG;¿7)Æ>.Ë>,ÒA.Ö=?Ò=9Ô;5Ü92å:2ß80Ò;0ÇB1¾B(ÅD/À:1Ä57ÛJQèU]êY`×HLÏ7,Ý;6ç=>ç:>ã6:ì8;ù25ÿ-1î71ï4/é-+å4.á=3ß>4å:3ì63ì46ï34í42à2+Ü8,Ý:+ã3&î2'ì63ð31ó2-ê5,Ù6-Í82ùgjò\gèJcÿ3_ÿ8e¼IVW@0PN7YL;LA/<I+N`8a|EeDbAcEfKiRjNeI`G_H]H^|H_yJezO[xB\yC?C5IF=RH?]M=`R8^VAc_\on|wqws¥gh¡^_¢eg´wuÉÝìÖ¡Ø¡Ø Õ ÑÊÁ
}¬lkpc^[oXRVI¢XM¹[QÙqhî{øêdcçSQÇ3)Ä7&À7$Ç:(Ñ>.Õ9*Ô=,Ï8'Ú:,à:.Ú8+Ë:'¿?&Ã:2ËB:É@8¼6-Ä>5×QHÛULÊD;Í<!ß8(ð,.û'6ÿ)@ÿ(@ÿ#@ÿ ?ÿ :ÿ'<ò.8æ::Û94Ý<4å:3è62ì23é62â7/Ø6)Ú;(Û:&ß9#â7#ë4.ï4+ï5)ä7'Ú:.ÝB@ÿdtùKfÿ?aÿ6^ëHet7679$CD2FC28G0FIX`;csNdOaCb=fElNiFeFeGc
HdJcFeGb~C\<aA4:,??7KB;UI;ZO;\UEecfnoolb`XY]`£lpº|}ÍÙÞÌÎÏÍÉ¿³}w^ge\W]^LvWE±ZSÔXXâheÞvmó}ÿ}ùngÄ8+Á:'½;%Â9&É:)Ö8,Î6(Ñ>.Ë3%×7+Ô6*Í:*Â;'Á7,Ã9.Ç=2Ê@5ÌB7ÍC8ÎD9È>3Ò7#ä6-õ.3ü)8ú':ù%;û#:þ 7ÿ 7ü(7ó6=ä::Û94Þ;4å:3é62î45ê65â70Ø6)Ù9)Ù:%Û9$Þ7$Ý5(á7(ß8&Ù:'Ô8,÷X\þSfúBdÿ5^ö>b¸DWI*'-8'6>)B='EA&Wa/
is]`~J`
@c>hGlPkJhGgIfKeIdGfHeDcEhJ-5(7:3A>9KD:PJ<TQHccmhi
baQSTXei²sxÉÔ×ÕÉÌÒÓÍ
¾§wtOZhZQRfKh\D§PIÜQXê_dãpmâvj÷|tørgÂ:*¿='¾>%Ä;(Ê9(Ú6,Ñ9+Æ;(Ç<)Ï<,Õ<.Í7(É<*È<-É;-È:,Æ7)Í>0Ï=0Ð<0Ê6*Õ.&ê22ø/9ü-=ú0@÷1>û/;ÿ-:ü,:õ0:ë7:Û64Û94ß:4æ95é54ó57í76ã81Ø6+Ô8)Ô9'×8%Ø7#Ñ:%Ð>%Ð@(Ð?,Ø=8ÿ^iþCbÿ:eÿ/ZÜRkc28841-7.4@*<=n^:¨m¬ÄlaI_@iDoNpTnKhGhJiNdJeHgHg
EiJnO&1#/4-664?<7GD;LMH\^k]a~[\WXfh²v{Ï~Þß×ÑÇÍÔ×϶~nlqQOg[KYhKeaDXHÉUUãX]íbgîujæaXÓE9É:)Ä<&Æ>(Î;)Õ7+Ò/&Í9+Â=*¾;'Ê>-âL>Ð:,Ì:+Ç:(Ç8'Ê9(Ì9)Ò:,Õ<.Ú>1×9-ç55õ8>ú2?ô.=í/9ë28î15ó/3ò5;í6:á55Ü94Ü94á96ç77é56ô5:ï77ã73Õ7,Ï9*Í:(Ï9(Ð9&Å;!Ä>#Ä@)Ê<.îIMÿPgÿ;cÿ2cõB`CI>=8:8;B449>(J\,e¬Ê¥Ä¤oa
H^?jEqPnTlIfEfHhNeJdGgFgEjMoR(0!).'/1.783=?4FIBQT]Z\s[ZcduwÄ
ãðçÖÏÅÌ
Ò
Ͻ}yrzfbYg_Lf^If`HhaEuZ?¦^OÕURýS\éZRÕ<4Ù8.Ø;,Ð9&Ð;'×7)ß4,Ì2&É<+ÂA,½<'Ã7&ãOAÉ7(Ç:)É<*É:)Ê7'Í5'Ô8+Ú:.Ø4*ä=4ö=Bñ2:ò0;ë1<ã6:ß76ïB>ô=9é;:å97à85Ý84Þ95æ::é9;í9<ô5:î87â;5Ð8-Ç:)Ä;)Ã<)Ä;)À<#¶8½?)Í:3ÿXeÿ>\ø4Zú;f®IOR:03C6G78S/1ON2rXÃy¾²|lYWx?`>kDlKiPfEbBfHfJhLgIeFkJoRs¡V/3$.1(/1.36-9=.AE6MOLUUa\Zrih~~¾ãíâ}Ì~ÂÁÆÁ´
{yn~od`h\NXeKd^HpYGq]Eq\?X?ÖWNþEKÜ94ß6/â6,Ý7)Ó8$Ò9'Ù5)á3,Ã7(½:(¿@-À;*ÔB5Ó?3È:,¿<*Å:'Ç:(Ê9(Í5'Ô6*×3)á90è=5í6:í4:ë3;å:@èMKù`[òPKå:3ß82ß82à93ä;8ä88ç9:é9<ë8<ï58ç77Ü:5È8-½9*·<*¶=*¶=*·=(8$°5&ÜFGÿNaô9TëG`ÕJ_cF8ED07@+C5(O5$xxR³vÀu·
rKd<Sm=a=iBhHcKdBeDiKlPiMhKhHnJt¥Vx©Z:;)8:/8939;.>B+CG.KM?RQMXXNddlww
ÆÛÐ~¹}y«}}³³¢~vwmuna[k[LkZHb`Kh]Ko\Ky\JYC©R?ÑD:ã1-Þ5.ã5.à2'Û8'Ð:"Î<%Ô9'Ü6*¸>)±7"¾=*È9+æLBÕ=2Ã;+±=&Á9)Â9)È9+Î7,Õ7.Ü71é=9å84é:7ì::ê=?÷YXúkeÔG@Ð71á<8ß;2à91ã73å76ç79è8;é9<è7=î79æ:8Ø>6Å=1³:)=)©<'©<'¦=(¡:)©9.éX]ôI[éHZÆSZ ZRHR:JE/@<AR(`xF^¢jµuvUfF?N1Se;cBjBfE`GdCiHkMlRkPkMkHrNv©Zwª[ED2DD8EE=CF5EI.JM.OQ9USF[]8]^Nkjzzy¥º·xvolkiomolmgii_Uk[Ko]Ir]JuYNl_OkcP^M¢RG¸92Î4*Ù6'ß7.à4*à6'Ô8"Ê="Ç?%Í<'Õ9*±A+©4 ¾:+Î7.à=8èNFÇC4¨;$Å@1Ä<.Ë=1ØA8àA;á<8å97è88æ;4æ:6õPNáLH¾71Ã=4ÕB;Þ<9à<3â92æ95ê88ë7:ë8<è7=æ7<ê67â96Ô=6À</:'¦;'¡;%;$;(<*¬E<îelìN]ÑHR§ZPnP?Q9J9%WO+m]x¼oyWWwOBO39C+<F.O]9gEkEgF^FiHnMkMiMqTqRpOw§Swª[t§XTM=TM=TM=TM=VO?XQA[TD]VFb[IbZOh^\qflwkuznxtiqh]c^^VZZP[WL^XJd\Ig\Fj^Fm_EdhQwVE¢UK±UH¦J5¨=)Æ9/ß12Ü8.Ü8.Ú8-×7+Õ7+Ô8+Ò9+Ò9+·>-ª5#¬7%¾<,É6,Ó;0ÜJ=ÍD2ÛH@ÑA8ØC<Þ<7é77î87ä84ß>6ÅE8·9+±8'»@0Ç?1Ù?7è96ò67æ7<å8:ã:7ã:3á81ã:3æ:6å97è:<Þ<:ÎA:·?1¢=+=(;'9%?+3+Ñ[[Ï[^¬QNZP^R_TK`Vm'®d³lySXk>JV><B6>?/;?1:B3HY9a}CoIjGhJkTmQjJkGnHp¢Kv¨Sw«Yl][L^WG^WG^WG^WG]VF^WG`YIaZJd^Fd]Je]Pf]Vh_Zh_Zf]VaXOYWKRPCQN?TQ@ZUB_XEd^Hh`IdfQ~\P®[U¹C?À=5¾:-½9*Ä?.Ù7*Ú8+Ù9+Õ8)Ô8)Ô8)Ò9)Ò9)¸@0¦7#¡7!³>*Á<-Æ4'Ï=0ÔG6Þ44×31ß;9ê<=î5:ë14æ66Ü94³9*®6&8&µ<+ÈC4Ø@5å95î66ë7:ê88ç:4æ;3â;2à;5Þ;6Ý98Ú<;ÒA<»;0¥7(<(<(:%8$v9$?2´QL¬MIRI^PbT`V~[£µ§rSi88J"<K.8A08;2=>.:>09A2GX8cErLnKmOoSoPkImIoKt£RyªYnRYHNw=c\Lc\Lc\Lc\Lc\Ld]Me^Nf_Of`FhbJicMhaNhaNgaKgaIhbHa^MXUDOL;KJ8NM9OQ<TVAXZE^\MsWK±f`ÎLNÜ9<Ø63¾=*«H)Ô7&Ö9(Ö9(Õ:(Ò9'Ò9'Ñ:'Ñ:'¹?0¥:&8£A(´?+Ã9,Ê6*Ô=2ð3:é49ä79ã68ç48ç7:Ý98Ç/*¬;)«<)©<'ª:&·:(Î>3ß<5è96î64í74ê93æ;3à=4Ü?8Ø@;Ô>=ÅB:·=2¢6):(<(<&9%
7#u;'A1¡SGSGZK\N^SaXew
aBQ4-:&0<.7?4=@7::0;<,9=/8@1FW7eGsMqNpRqQpNnJrOu¤Ty¨ZqV[B[JR{Af_Of_Of_Of_Of_Og`Pg`PhaQjcPibOg`Mg`MhbLgaIgbEgbEf`J`[EUS>LK7EH5EI8EL<EN=OOCXQA{QA¹SNâFGã77Ë=/«B%Ð7%Ñ:'Ò;(Ò;(Ñ:'Ñ:'Ð;'Ð;'¸<0¨=)9>"¬?*À<-Ê3*Ù<5ñ8@ê@CÙ?=Í97Ä30È:6¸92©7,¢?*£@+£@)¤>(¬9&»7*Ë8.Ý@9ë:4é;4ç<2á?4ÝC9ÑC9Å>8¼;6¢:-7'9';'=*<(~:'}6$y6%L<QCXJ[M]P\SZUU]6=F'7C/2<34=8AF?DF8=<(:;+7;-6>/DU5dFsMqNqSpLoKpLx¤W¬ar X]G^H^
NSzChaQhaQhaQhaQhaQhaQhaQhaQi`[i`Yi`WiaTibPibPibOibOh`If`J`[GQP<FI6?F6>G6<G7BI9AK3QL/`LÚ_WêHFà>9Í=2Ë8(Í:*Í:*Ï<,Ï<,Ï<,Ñ;,Ð:+¿:1¯>.6 7¬<(Â:.Ù@8çHBãEFÌ>:°:.£<-¢>/=.=-?,=*>*@,@+¡>+¨9(´8,À<0Ø;2Ü@4ÛC6ÕC6ÎD7»=1¨6, 3,<,;*;(=*|;'y:(x9'u6%8,N@O@TFXOUNYTYTR[.OY4;H.5@/GRBX_MGK2>? ;<,9=/7?0EV6fHsMpMqSp JoKs¢R}©^y¤]bJ`JeO^
PSzEhaQhaQhaQhaQibRibRibRibRj`_j`^jaZjbWjbUjbUjbUjbWjbMjbMd_KYVCKL:DG6?F6=D48F/BJ2PE)fP»UGî_[ìIJå?AÈ:,Ç9+È9+È9+Í;.Î</Ï;/Ï;/É:6½=4®=-µA2ÎJ>ßJCæIDáB>ÐE@µ?5A/H3F2C0}C/vD-:*:*<*=+<*:*;+¢<.³9.¸<0»=/¸=.¬8)¢8*8,:.=,<*:*}<*z;*x:+s8(q8'C9K>L?SIQKSN]Vi`^m}P@P)O^=apSNY;@G(<? 9:*8<.8@1DU5fHtNqNqSp¢Ko Ny¨Zx¦^eM\
CgNbI^ORwChaQhaQhaQhaQibRibRibRibRja\jaXjbUjcQjcPjcQjbUjbWldQkbQjcQc^KWTCML:EF4AB28K-RB+M@§F?°;4ãb]ôfeìSXØNCÍC8ÑD:ÖH>ÚJAÛKBÞKCßLDçMMÝNJ×NHÛNGáFBæBAäB?ßD?ÒGD³>5B1F2D3
@1~?0z?1:.;/</=-<,:+;,;+:.;.;+;+9(9):);,;,~9*{8(z8*x9*u:,o5'r:-J<K:RBWNQMVRbWsfSQ`7EV*Zm@awIL^68G(<F.9=.9:*7;-9A2AR2a}CrLqNqSmLu¦Uy§^gQZDcJfJeG[MPuBhaQhaQhaQhaQjcSjcSjcSjcSkdTkdQkeMkeKkeKkeMkdRkcVlcTkbSlcThaQaZHUP=NI6HC07J*mF5¶HIÅ3=É=@ÈLJäjgÙYZÔKCÍD<ÑF?ÎA:ÒC=ÔC>ØD@ÙEAà?DßEEàHGãCCê@Cí?Aä@?ÛB<Ó??µ82?1?0;.9081:4;4~;2|<2{=0w<.x=-w<,x;)};/:,9*9(8';*=*~=+8*}5'z4(y5*t4(s7,n6)t?1R@R?XHSHRMVOvaPBL1L[<asM\sELd47L#0@#:E77;:;<,7;-9A2=N.Yu;nHqNrTo£Qs¦YjQ[G`JbIfHbAZLNs@i`QjaRjaRkbSjaRjaRjaRjaRjcSjcSjcSjcSkdTkdTkdTkdTq`PqdTneVicUgdSdbM]Y@QK1MD'lP:dW¤LH»KJÈHIÐHHÓIGÓGHÏ?>ÓD>ÌD8ÅG8ÈH=ÔDCÜ?FáCDáCBàECáFBâDAáB>â@=ãA>ÊD;±;1</?0}B4}?4:182
<-;,;,;,:+~:-~:-};/}9.}9.|:.|:.z:.z:.x:-w9,u9.t8-r6+p6*m5(l4'l7)wB4UJQJOLQLRJ`LedFXjD^xKPi?Mb;ET58B)5:&>?/@>11<.5;-:>->C,Zf@pRrRrQz¡bu]`H]EaIdLdL_GXzGJl:haQibRibRjcSibRibRibRibRjcSjcSjcSjcSkdTkdTkdTkdTrbSk_QmeXieYmk^
spwr^MW<CE-K@,Y=/`8,k;/yC7
M@¨SLµLHÈDBÔC@ÒB:ÔE=×FAÛEDßCDÞDDÞFCÞFCÛF@ÙD=ØC<ÙD=ÓF=¾B8:-
<-A2~?0;/90;,;,:+:+~:-~:-};/};/|90|90{8/y9/z<1y;0v:/v:/t8.r8-p6+n5*m4)j4(j4(u?3QGRJSLVN\Qu^LiiO^mNG[8?S0CT4ES9?I17?*:>-9;-3=46<2:>/<A*R^:hJpPu¡Rx`dL[C[C`HbJaI^
FRwDDi6haQibRibRjcSibRibRibRibRjcSjcSjcSjcSkdTkdTkdTkdTqeWnf[kg^~wµ²«¸´©®¨oQVB=I5:G3<K68E39A2=A3O<-JCµMNÑFKÚACÜDAÝE@ÜD?ÞDDÝEDÜDCÙEA×G?ÓF=ÑG<ÐH<×@9ÈD8©?2=,@/~?.<,;-;,:+:+:+~:-};/};/};/z:0y9/w9.v8-v:/u9.t:.s9-q7,p6+m4)l3(j4(g3&g3&q=0MERKXMZNs\L^WDRWA@L65A-2>*6B.=I5>J6:F26B.2>*2;65:38;0:?)KW3d|HsSx¤UnWYB[D\E^G_
H^G\EQuEAe5gaQhbRhbRicShbRhbRhbRhbRjcSjcSjcSjcSkdTkdTkdTkdTlfZmi`¶¶´ÐÒÑììêïëèãÞÚ×»°|c^JAI2=J6>F7=>6=966A3J70LKÅbeÌTU×PMáIFæB@ÞDFÞDFÝCCÛCBÙEAÔE=ÐF<ÎH=Ý@9ÏB8µD6:)?-?-=*=+;,:+:+}9,};/};/{;1{;1w;1v:0t8.r8-q8-q8-n8,m7+o6-l6,j4*h4)i5*e3(d2'm;0LFSKYMo\MYVEFJ99B12:+47017-/7*2:-9D4=J88G21@+-63160690:>-DO/ayGtVsT`KVyA[~F[~F_J_J^I]HMqE=a5icSicSicSicSicSicSicSicSjcSkdTkdTleUleUleUleUleUgg_ÃÅÂéíîõùúýÿþÿþüüøõþãÐÜʲ§ efGGJ/HC0H92L76;@<LDAkgÖ¯¨à¤Äf^×OOéCGØFGÚDEÛACÚ>?Ù??×B>ÓB=ÏB9ß@:ÏA7·A5:+>->->*=*:+}9,}9,{9-|:.z:0z:0z:1v=2t;0q8-n8,m7+l8+l8+j9+k7,o;0j6+e3(e3(_/#`0$g9,NI
TMrXKRL<;D14A02=/4:077557216//7,/;-6E27I32D.+4/.3-36-9=,>I+`wIv]lRX{ESv@WzDY|F^K^K\I]JKiG7U3gdSgdSgdSgdSgdSgdSgdSgdSjcSkdTkdTleUleUleUmfVmfVpts©¬Øàâôüþùÿÿûÿüþÿùÿÿø÷þÝçñÎÌØ°«dnIFJ/JG6I@7SKI
}{µ°¬ßÝÑÿöèÿÚÐÖ{xÊLPÍRKÉHCÑGDÖDDÖ>=Ö@?ÕA=ÒC=Ø?9ÎD:¸C:<0=/>.>,>,~:-}9,|:.{9-|<2{;1z;2z;2p:0n:/l8-i7,i7,h8,h8,h8,k90j8/j8/c3)b3)^/%\0%j>3}VOlOGMA58:,/:*1=/5=27:179449338119..9+2?.7F37H55?4.4*.1&48)>H/e{UxgaPTtBRr@TtBUuCXxF[{I\|JXxFE[D-C.gdSgdSgdSgdSgdSgdSgdSgdSjcSkdTkdTleUleUmfVngWohXt|~¦®±ÔÞàñýýöÿýúÿùùýïö÷çñÿçïüàçñÏÆÌ¨xTZ@DM:AL>|v¹´ÙÑÎîíèö÷ïÿûðÿóê굯¼eT¶VF¼MBÃD=ÉB>ÎC>ÏD?ÎC<ÔA:ÊE>²A9<4<2=0=/=/~:-|:.|:.y9/|<2z;2y:1x92k9.j8-i7,g7+g9,g9,e9,e9,h8.f6,h8.d5+c4*]1&]1&qG;WMD@9/99-6:,3;.4</69.57,2:/2:-19,/:,.9)/:*2?.8E49D34;+04&04%=F1mcriNuFMm<Nn=Nn=Pp?VvE[{J]}LQq@9F<$1'feSfeSfeSfeSfeSfeSfeSfeSjcSkdTkdTleUleUmfVohXpiYhqv¡ÊÕÙé÷÷óþøùÿöûÿîúüçû÷îÿöêÿñáæÑ¼³¢mfTVYNhsk«¯ áÚÒþêëÿóöÿûúõÿöõÿñûÿóÿÝÃÊm«R@¸L@ÂG?ÇG>ÈE=ÆC;ÒE>ÅD>«<5<4<4=4=1=1};/|:.|:.y9/z:1x90v70s7/k9.i9-i9-g9,f8+d8+d8+d8+g6/j92h91m>6k?6e90|QHvKB4;33;039/36+47,35(35(46)-8(-8(-8(-8(.9)-8(.9)0;+7C-<C19=.04%>G4fz_YyTAg>Jg7Nk;Kh8Mj:VsC[xH\yIIf6/83 )$heVheVheVheVheVheVheVheVgfTieZkd\meXidNmlXghb~©ªÇÏÑëïðüüüÿþúþÿùùüó÷ýñ÷úñøúì÷ùáØÜ»¤ªbmOiw`ÅÆÁëìçøùôúûöþÿúþÿúþÿúþÿúíÿÿÿþüÛ®¨®VLÁH=ÊF:ÈF9ÄF:ÁJ2µL6G2F5D4@4:/8/}:1|90x8.w7-v8-w9.s7,p4)h9/g8.g8.g7-e5+h8.i7.h6-k4/m80k;-hA0fJ5kYEyfihV3;.2:-19,19,08+/7*/7*.6).5-.5-.5-.5-/6.-4,-4,/6./;14@67C54A0<I5UcLIW=ES9Ie?Jf>Hd;Jg;UqH[wOXsR<W8&.1"*-heVheVheVheVheVheVheVheVgfTieZkd\lfXkiRjlWsvo¤§®ÌÖØóûýüÿÿþþüÿþúýþöô÷ìíóçñõçóöãîñÖÑÒ³¤§m®¸ÜÝØö÷òýþùþÿúþÿúþÿúþÿúþÿúûÿÿýüúÿûóÿÚÊ·zg¢K8¿QBÂH;ÇC6ÁH=¦?6B:A:@9{?7z>6w=2u<1t;0q;/p:.o;.m9,k7*m80j8/i7.i7.h8.g7-g8.i:0i=4g=1iB1fE2gQ:ocMs[^K19,19,08+/7*08+/7*/7*.6)-4,-4,-4,-4,-4,,3+,3+-4,*6,,8.1=16C2:G5?M66D+>L3F^<Jb>Ha:F_8UnG^vTTkN2I/%-/"*,heVheVheVheVheVheVheVheVheTieZkd\lfXkiRnp[zx´ºÝçéùÿÿúþÿÿÿýÿÿúùûðèìÞÞåÕçìÖëïØêêÐÕÓºÆÁÀ½®ÐÍÆáàÞñòíüýøþÿúýþùþÿúþÿúþÿúþÿúÿùüÿÿý÷ÿúóÿòýüçɦ WD³P=Å@9ÃD>°=:::>=@>tC<mE;q?6q?6o?5o?5m>4i=2h<1h<1q60p70m6/i7.i:0f:/c;/f>2`D6dI8cJ4_K3_S9okR~lAJ519,19,08+/7*08+/7*/7*.6)-4,-4,-4,-4,,3++2*+2*,3++7-)5++7+.:,0=,4A/1>*4B+;M3DW;H[=K^>XkMbtZPbL+<)#,+ )(heVheVheVheVheVheVheVheVheTkdZkd\lfXllTinXovn§¬Úäæ÷ÿÿûÿÿýýûÿÿ÷ôöéæêÛâé׿íÎçëÐçåÎÜÕÃÚÐÄêßÛøîïÿöùýþùÿÿûþÿúþÿúþÿúþÿúþÿúþÿúÿüúÿÿýñÿÿíÿÿóÿùÿÿíìȲ¬t[µN=³L=±I@ =7<8
@9uC8mH8q?8q?8p?8p?8qB:k?6j>5k?6r71p70m80h9/c;/c?1aA2^A1WL8f[E^T9ZS7YX:nrWjt[0?(3;.2:-19,19,08+/7*/7*.6),3+,3+,3+,3++2*)0()0(+2**4,*4++5,,6+-8*4?/8C36A01@+8G0@P6HX>VfL_nYJXG(6'&/,#,)heVheVheVheVifWifWifWifWkeUle[le]khYlnViqZlxn £ÇÐÕîöùûÿÿþÿúÿÿ÷øúìò÷ãèðÙêñÏçêÍâàËÝÕÊçÙÖøêêÿõùÿûÿþÿúþÿúþÿúþÿúþÿúþÿúþÿúþÿúýÿ÷ýÿüýþÿýþÿÿþÿÿüôÿÿìÿõÙÖ¡^BWAO>A1A0xA-qB.s>8t?9t?9r@9r@9p?8o>7m>6l:1m=3i?3d@2_B2_H6M;'F5!LN6FI.Z[<^_@\_@sy]KX>0>'5=04</3;.3;.3;.2:-19,19,07/07//6..5-,3++2*+2**1)*4,)3+)3*+5,+5,/9.7A6>H=7D23@.4B+AO8P^GYfTCOA,8.'0+&/*heVheVheVheVifWifWifWifWkeUle[le]khYkmUis[lyo¥¨ÊÓØï÷úûÿÿþÿúþþôøûêðõßäìÔÜâÀÚÚÀÞØÊåÜ×õéëÿôøÿùúÿüüþÿúþÿúþÿúþÿúþÿúþÿúþÿúþÿúöÿüûÿþÿûÿÿ÷ÿÿùÿÿûùÿÿôöÿîÿüãûåÍʨeLQ:zF0xE0p@*sC9rB8o?5n?5k?4j>3i?3h>2cB3cC4`E4ZE2WF2aV@QK3HD+=G,<E(CH(_bCknOkoT<D,9B-8@37?26>16>17?27?26>16>15<44;33:23:207//6.,3+*1))0))0))0)+2+.5.+2+070<C<>L;;J73B+1@)BQ:L[H@N?/<2,6.*4,gdUgdUifWifWifWifWifWifWkeUle[le]khYjnUfrZeuj¥¦ÉÒ×îöùúþÿÿÿûÿÿôþÿîôùâãìÏÔ׸ÏÏ·ÜÕËïæçÿ÷üÿýÿþÿúýÿ÷þÿúþÿúþÿúþÿúþÿúþÿúþÿúþÿúúÿÿýÿþÿþúÿý÷ÿûõÿýøþþüûÿþþúùÿý÷ÿüïÿòáâкº¡{i
fTrQ>iH5bC/dE1`D/aE0`E0`E0[J6ZK6VK5QK3NL3qtY`fJCL/:G+@I,CH(MN/xwY__EEG1>A.8@38@37?26>17?27?27?28@39@88?77>67>66=54;329107/-4-+2+*1*+1-+1-,2..400626G4=O9:L44F,5G/=O98I7,</+5,)3*fcTgdUifWjgXifWifWifWifWkeUle[le]khYimTgs[ewkª«ÔÝäóûþûÿÿþÿùýýñûþëðöÜÜåÈÏϳůÓÌÆîåêÿùÿÿþÿûÿùùÿôþÿúþÿúþÿúþÿúþÿúþÿúþÿúþÿúÿûÿýþÿ÷ÿ÷óÿòõÿóùÿøÿýÿÿúÿÿûÿÿýÿüýÿøþôþÿóÿÿïÿûìÿöéÿîÔòbQ7ZJ0[K1[M2\N3[P4UQ8TP7PP6KN3LR6YdFCP2=J,?L0GP3HM-[Z<ieH^ZAXVALI8;C6;C6:B59A47?28@39A4:B5:A99@89@88?79@89@88?78?76;5271.3/-2.-2.-10-10-10(;%6J1;O49M16J/:M78K8-?/,6+*4)YgM]jPblTglVghVifUkeWmeXjgVkg[jf]hfWfkUdp\m~x§ºÁÚâåòûúùÿùûÿñ÷úçóòÞêçÔØÕÂÌ¿®½±¥Ç¼ºâÙÞûöýþýÿüýÿúþýýÿþýÿþþþüþþüÿþúÿüùÿþùÿÿúÿýúþýûÿÿÿýýýÿýüÿüöýóêÿòçþüÿÿÿýþÿûúþýþÿÿÿýÿÿþòÿÿäùùß¶µSN0QK+UO-TO/QP2PP4ON2PP4KO6EN3FP5@I*CJ(HN(PT1RV5]]AZZ@XX>ZZ@XY:UT5LG1FD/A?0>@3;>38@38C57D38C56A36A38C58C58C59D6<G99E;8E48A05=0292/;/1D&;U&Be-@_6<T<;N;?Q7H]>D\<0H.*4)(2'YgM]jPblThmWjkYkjXmgYnhZkhWjfZie\hfWdiSdp\u¢µ¼ÓÚàñùû÷þ÷ó÷éëîÛÞÝÉÒϼÅÀµ¤É½±ÚÏÍïæëýøÿþýÿüýÿûÿþýÿþýÿþþþüþþüÿþúÿýúÿýøÿýøÿýúýüúÿÿÿþþþÿþýÿúôçÝÔõçÜþüÿÿÿýþÿûúþýýþÿÿþÿÿþòÿýàüüâµ´QL.RL,UO/UP0RQ3OO3ON2NN2KO6HQ6GQ6EN/KR0U[5`k@}`ovTQV8MO7OO7SQ8VU9WR<OM8GE6@B5;>39A47B47D38C57B47B48C58C58C5:E7<G9=I?=J9?H7<D7<C<5A5=P2Tn?Z}EOnE:R:1D1>P6OdEOgG9Q7/9.+5*YgM\jPdnVhpYlo\mlZliZoi[liXieYie\igXejTdp\s~¨¯ÊÓÚëõ÷ñ÷óéìáÜßÎÎ͹ÆÁ¼·£ÐóãÖÍóèæÿ÷üÿúÿþýÿüýÿûÿüýÿþýÿþþþüþþüþýùÿýúÿýøýúõÿüùûúøýýýÿÿÿÿýüÿûõöìãýïäþüÿÿÿûþÿúúþýüýÿÿþÿÿþïÿûÞÿÿê¹·TO2UN1UO/VQ1RQ3MN/ML0MM1KO6JS8JT9NW8U\:djD£m°tgrPKO6KJ5OJ6SN:TO9PN9KI:DF9=@59A47B45B19D68C58C59D69D69D6;F8=H:=I?=J9>G6<D7:A:6B6=P2Oi:Tw?Ji@2J2*=*6H.K`ANfF9Q7*4)$.#
\ No newline at end of file
diff --git a/testimgfst1_4.ppm b/testimgfst1_4.ppm
new file mode 100644
index 0000000..c4eda85
--- /dev/null
+++ b/testimgfst1_4.ppm
@@ -0,0 +1,4 @@
+P6
+57 38
+255
+0/-51.72.92,80-80-80-80-5-*4,)5-*5-*1.'41*63,96/B<0H@3JA2MA1YB4C3«?2ÀF;æCHñAD÷:@Ù?=³@-°?-¦?,@*>.=+=,?+?6¸B4±E9_>/;5572/62/41,.0-0/-5,-=13yD@`l±XTPGbopubcSYSa,,,0/-2.+3.*2-*2-*2-*2-*2-*1,)3.+3.+41,41,52-850<5-@7.C9/I=1JG6fA/;*¢E6ÊE>è@?ò;=ÁB3ª?-¨?, ?.?+>-=,<-=.B3ÂA;ªPHPF<@6494043.02--3/02/21/3/.P5*sTY|~»YXJ>fDCUMVQQYNaXQ,-/---.-+/+(.*).*)/+*/+*/+*0,+1-,1-,1-*2.+1-*40-:2/=4/?4.E80J=5V93r7/;1¦A5ÇD:ÙF?ªC2@.=-=-=,<,;-<0B7H;¶OJ¡}mhseKI=77-01+/0+.0-//-00.00.:/7jhiÄv¶hoiyxj{k`Z@,03./1....-+-+,+)*+)*+)*+)**(),*+/-./+*.*)0,+3/.;23<21<1/@2/?82A83X6-;.>4A3C6?3?-;-<.;-
9)9+>5
IAKE¨nc¥
|yZfR?E710+2)*1++1++1-,1-,6,-cqMºÆ§²«g~bOO312,32-74/72.7/,3--/-.,+0/(//)+.-+/0*///2.+70*=3*?6->5.<1-<1/D1+B0.D,*\4,x>0:3?2A3<1>.<.;+w;0v>/C:MB\X~x¨^bWpS>D:.-+-)*1(-/*0+,10,+^cLl¨u°}¨w~y`r\?A4671872=:5?:6?74;629527327./50-41,43.540;62@7.G:1G=4C90?61?61D65M34A9.K8*m61==A;=7B1
;.<,{>,¨KFG>tM<VFxwX§xh~
¡{pxpasYGD39.*./)1-*=&,H@5clQm^rerjw ttqZsUD;4893=<7B?:D?;FA;F?9F?7D;4B92B92<7194.96/@9/F<0M@0M?4H;2B90?;2\:8EK@7¤EAD6¥=2¤E3ª@2©<AD@y=2¶:DÔ@>ªVLjeG
kPæOVÿ+Iý;UôL]äWgØclÐ`lÐQfÁL_DKR3.E=2cZ9y`sdxf¤{|YrRURC671;:5B?:GB>HC=LE=MC9L@4H>2D<1A:2<71<8-C;0K?/O?/M=0F:.A:0A?3¨EHÌ17 <%°=+¥:0¶A8¨</»?5Ô<1÷.4â=7æ42Ö6*¾NC]HÖ[Vè>AÑFAô>Jü5Hþ9Uÿ;`ÿ?mûArÿFjùTr»WalLA~u©«¨«³µ¾¼¿ÚÒÏÙÏ×§©¦`w][eJ10.762<<4BB8JH<NL7PPHb`xWNQH?@A96=82>71>;6F?5P?-A>-D65>;4h;5«;-¡:'«>*»9+©;,¬>-·?/Á;/Ñ7+Þ7.ô.+Ú7&Ù6#Ë=1ÚFBñADÒA><.ÇG<ó@FøDMýAYÿBjýIxÿKwùVuóJknnÓ»¯îëòþäýÿóüýøõöíðÒÎÍ74/52+:70@=4OE9TK<ecqÖÚ||®`^vECH<;@B<,G@-EB;I?G@IHLB8B;ª?->+¸9*Í9/È91Ç9/Î:0Ñ7-è1)ð/*ò/)Ö7"Ö5#Ó9/ÜMEÅE:»<)»<-ÈA;ÛIJïDJüK]úEdÿNwûUyýSnù\mß`iÙÿööýüÿÿûúÿûøÿñôêßÝäâÕÐÙÔC?4<8/84+>93MC7WJ:a\p欶þ®µû ãvtµbXGDWD@=[OSs§f¾IR³<(:(º;,Ì9/Ý:3Ú72ä=7Ý90äD8ñ91ú**ì1,Ö2&Ê<(Ó:,Ú?:×EE½<'Á9+ÎH?ÅIAßKGæOTøWiþQoÿTwÿXoý\kíWc§unóÞÛ÷ÿýÿüýýúõûðîåØÐÿüèæìèPJ<IC7B;3A:4GC8SG1[T[Ωªü¬¯ü¥©óåÍuw UgØHQåDIÇA8àB?Ï>9Â@2Ë=1Ô7.Ù5,Û:0Ú6,Ô4&Ì9%Û;/ü47ç55á55ò21Ü6*ßK?ÖDEÔ=6Ã;/½@.½>-ÃE9ÎMHôdmúXmû[sëtxôftÈbaOßÂÄýûþÿúÿúÿöÿþ÷ôîàÿÿãööêXO@TK<NE6LC4JF:VK5]V]Ãì¥ø¦ç¤èÚÁnä=Dâ?BÙ=AÌB?è=CØ:9È?7¿A3Ä7-ß63Ý7+Ý7'Ã8#Æ8,Ú91Ë8&Ý2(à-0å/,Õ8'ÔC2ÝD?æTTÍ:0Á:'·>-´<.¾@2éf^ïijóboöllþbo¶[iFãÑÇÿüùúþýßýåôýìÿøè÷ïÚþýùZN>YM=WK;WK;SK>YL9ZRPsr¶Ð
Àqs¬¤Ymù7OáFAí>KÒDBÁB9Ô97ÌC9Á9)¾;'Í:*â6,ó04ô02á34æ2>í/1Ë8(Ñ9+Ý<2ÊB2Å9(×:1ã03Ö71Ò>2ÇC6¯;,¬<.®=-Ú_Xïlr÷nxÿpwûNb½~yxa×ÖºãñØÃÚ¾¢Í»ÔäãÎêÙÑßÑÈZM<ZM<XK:ZM<\L=^O<[OC]RVh`
yº|³¥i½>5ÝC9ö<?âAG¸<2¸@2×96ËC7Á:'È;)Õ5'ì7.ç2'ô*&õ&.ÿ8ò.:ç6<ó08ô-0Ü:5Ý>:Ý;8×4+Ç8(Ç:0ÔJ@È;2Ë80¼:,ÊOH÷xüyÿkxÿE`¶mdpXhpczlµw»¤´Î½µ¯¥¤ZK8ZK8ZK8\M:^K<_N<_P=aP>cQ_uqºòZiÿ9PÓCCæAEÑB<¯;,»=/ç9:âH@ÏG9Ì8,ß6/í1/ü,<ý(<ð,Dü/XùS_ñIZÛ4>´;*ÍE9ÓD@ÑA9Ê9(«<(¹=1Ø?:ë51ù-.Þ7.Å@7øz{üzýdvùA[VEiPh~¥p©m¬oµnyɰ §¹]L8]L8]L8]L8^M=[O?^RFfSOkZd|¹§¸çwsôP[ñALÝ:;Ã?2>-Ç<5Õ7.Ú9%äA:Ñ=/ê86û7Eö*-õ)*ì)/ó=LôT\ß@=º?0§8-¹>9×CCÐA9Ò91Ï:6Ý>:Ü;3ò00ô02ë2-Â:,î{xþw
ÿQnôAaqM?jPz¢f{£g}¡c}¦j}a²p¥[gg_N<_N<_N<_N<`N6\SNqlxqt|ªÒ¥Â¶|ÏSIëGHä:;È@2´91ÉYMÃ?3Ý6-â70á?0ì1,ú9<ôNRå<?åBEÓ:=à:>ã4;ðW\ù_kàRNÞ@?ÜG@Ø93û+9ü7>Ý4-ê5.ù.2î1-Â8+çtqûj{ÿAcÓCZWQ9mVwbr[w_y¤_x§Yªd~las]\O>^Q@_RA`SBaTNnjwy²mq¸ÜÆÃ¼äÞ¢ØÑ¬xÃe[ìRTè:;Í<7¸G9ÐVIÕ4,å>8Ü6*è0(ã60ÚACóS[úZdø]cú2<ô1?ùU^üXaá<8â64Ù<3â94è8:å63Ý6-ð0+÷03ñ1.Ì9/ädeþWsû?bEHCG0bwLpVjOqYtVoOgKNh8G^4UH8]P@bUEdWGpksv«cj²|Ë¥«ÛÆÇÙËÅDz¦°yxthbÐoiübbîE@ÐB8Ã>/Ð=-âFGÜ;3ã60Ì:-Â=,Ë;;åMYèSYã:7öCIä7;ù59î73é30ß<3è64ê67æ40Ü8,ì1(ñ33ï2.Ò80ò_gûBdêCaaK=RG5LZ7g
IeFjSjN`G[|E]tHZuB@@6TG>^SAjgrol`` qrÂáÓÓ˱n_drWL¸YSãtmözxÛKCÁ8&É:*Õ9,Ò9+Ú8-Ç<)Å;1Æ<2ÎD:ÏF<Ù7(ø*6ÿ'?ÿ!<ÿ#9í6;Ý:5ç85ì44Þ6-Ú9'Þ7$ç5+ã7)áB>ÿQjÿ:a;F8<+BA-_h=g~RcBkKjIfKdIeFcC/4-A<8OJDabwYYfh³~×
ÖÌÕÅ}xxUS^bG¹SQèagìqi×K>Ã<(Ì9)Ô6+Ä;)Ô@2Í9+É:,Ê8+Ò;0Ò:/é24ù/=ó1<ø/9õ1;â66Þ95é77ò59Ý6.Ò9)Ô9'Ê<$Ì?-÷MVÿ:dÜB\F678:-de;¥¾
s]fCqSjIiNf
IhGlN-0'34/@B7TT`b_Ôê~ÍÇÆzndbd_Km\H[DêQTàA=Û7-Ñ8&Ý5,Æ7)À=+ÔB5Ç9+Ç:)Ì6(×6,â92ð5<ì2=êFGïB>ä86á96å99ë8<î68Ö92¿:)½<)¸:$Ç=3ÿG^î@akC;><0[J8²o±~YuEeAhKeDhLiKjIt¢WA?2??5EG/RPC]]Qzw¢
Èyv£xt§yqob\n[Ll\Mu^N¤L@Ø7/á4.Ý5(Ì<$Õ9*³:'Æ:-âE>¸=+Ã;-Ï;1Þ;6ç98é:7ïLMÔIDÙ;8á:4æ66ê7;è7=è8:Í=4®;)¥:&:*ÌOMçHZ£]SHG3R^6v\bWdHGT6iDcHiHlPnQrOv©ZZQBZQB[RC_VGd[Jj_]qeij^`ZWNYSGaYFi^Hp_O¯RK³?0Ë80Û7-Ù7,Õ7+Ô8+²:*±9(Ê7-ÓD6Ù;8à<:í49â96¹;-´;*Ð@5í76é6:å95â92ã99Ü<<¸<2<*8&:,ÁUUVO_VpI`Rd:>D6<>1AM7jHlKnTlJq¡Mu¦W]Lf]Nf]Nf]Ng^OiaLiaNiaLhaG`[HOL;JK9ORA^THUQß;<¹@+Ô8)Õ9*Ò9)Ñ:)°<-;"º<-Ñ80ï7?Ü9:Ø58Á61§>+§<(¼:,Ý;6î85ç<4Ú@8Í=<®<19(<(8%?/SGZN]VcmJ6A08?7>>29;.>J4mKqPqOsOz¦[bJXHi`Qi`Qi`Qi`Qj_]j`WjaRjaRiaL]XEFI8?E7AI4wT>ÛVQàA>Ë9*Ì:+Ï;-Ñ;-¾;3¤;(ÈB7âE@ÍB?¡@0A1@-;+=,;+¬:/É<2É?4¶</6-<,:+|:*u7(D:PFUO]YdoE@M1U^I@C(9;.>J4nLqPp Lz¦[hOdMY~Ji`Qi`QkbSkbSlbXldQldQlbVnbThaQWQAHE4MG/¬BBÉIHæ^`ÒG@ÒE>×FAÛGCáGIÝIGçACáB?Ä>;A2=0<2;3=1};-;,:/9,:);,8*{5)v6,q9,M?UHSPn]MP`;YoA;L*:@49;.<H2g
ErQr£RjR`IeGWyGi`QkbSjaRjaRkbSkbSlcTlcTqaTldYpm^lfPSK4yK>A=©HBÀHGÐB>ÎE=ÙCDáCDàECÞC?ßB=ÄA9:0?381;,:,9-~:/}90|90z:0x:/t8.p6+l3(p:.QJRN[LbiJNd>HW89A,=>04<1<?,arFrSs\]FbK`IOq?haQjcSibRibRkbSkbSlcTlcTnf[þÎÉÃxHM9<G6=>6V?7·PSØJIàEAÞDFÜDCÖE@ÑG=ÔA: >1?.;,:,9-~:/}:1y:1v7.s9.r8-p5-l3*i3)k7,OIZO\UE@G74:,6>/<G65A-284:</Vg=tU`I\E`I^GIj=icSicSicSicSkbSmdUmdUmdUßãäúþÿÿýúîçË¢NQ6K>6XSP¼©£ì¶¬ÚUXÓIGØBCØ@?ÓB=Õ@:©>4
=.=,9-|8-}:1{;2s:1m7-l8-j8-l7/g5,a1'd5+~QKSG94?/5;168516/1=/7F307046)Q`?oZUuCWwE\|J\|J>V<gdSgdSgdSgdSkbSmdUmdUpgXÞéëöÿúùûí÷úéåßÅ~hQYL´°§ôææûúõüëáÕsºK@ÉD?ÊC=ÎC>¤=8<3=1~:/{8/{;2w81j8/i7.f7-d8-i70i81e6.qE<A>767/58-57,08+08+.9+2=-9B146(TbIWzPNk=Ol>ZwIVsE,6.heVheVheVheVhdXmd[khUÉÑÔúúüÿþúõøïõ÷êååÉtááßûûùþþüþþüúÿÿç·ºTFÃI>ÀH8C6A7;3z;2u9/s9.o6+j81i70h6/h70j92j@2jUBtq^39/17-17-/5+/4./4..3-.3-.:04@2BO;AO6Ic@Hb;YsNF_B&+/heVheVheVheVjdXmd[mlXëóöþþþûûóäèÙèìÓâÝÇÓËÀìãäúúøþþüþþüþþüÿüýôÿýñêØ»xe½G=¨?<?<qE<q?8p?8n?7i=4q62l71f;2c?3bM<_O8fbIV`H39/17-17-/5+-2,-2,,1+,1+*4,-7,2=-5@/;J3HX=]mS<J9%++heVheVifWifWkeYmf\knYÜãéþþþüüðíòÜâåÈáÙÎôèêÿøüþþüþþüþþüþþüûÿüÿûÿÿüýÿýêß·¦lXE3uB/t?9q?8o>7m>6i>5cA5_J9L?,DH/XX<jmR=G/7=36<26<25;1382271/4.,1+*1*+2+.5.9@89F57D0N[I8D8+1-gdUifWifWifWldYmf\hpY}àçíþþþþÿñêðÖÏͶãÛÙÿúÿþÿúþþüþþüþþüþþüþýÿûÿ÷ýÿ÷ÿýÿÿüÿÿûòèÝËÊ´¦¨xaH2^H1^J2XM9QL6Z\DJS8@J/NN2ieLJI5:@69?58>49?5:?99>88=75:4051,1--10/325G19K39K53D4-4,\hPfkUjhYnfYkg[ieZemXäìïùüóìíÛØÓÀÅ·ªÝÒÖþøÿüýÿþþþÿþüÿýúÿýùÿüûÿýþÿüùøêáÿýÿýÿüþýÿÿþëØÖ½RK.UO/QP4PN5IO5EN1KQ/agC]`CTT<VU9OJ6CA49?58C59A69A6:B7=E:<F;:B54>5AU0Kk<:M:EX<?V:-4,[iPgoXlm]nhZkg[ieZemX
ÚãêìñëÖÕû©ÚÌÁøíñÿüÿüþýþþþÿþüÿýúÿúöþúùÿýþÿüùûíäÿýþýÿüþþÿÿûçÝÛÆTM1VO2PO1MK2LR8LU8^dBªsxaKM7SL:SN:IG:;A76A3;C8;C8;C8>F;>H=<D77A8H\7PpA/B/AT8E\@)0(
\ No newline at end of file
diff --git a/testimgfst1_8.ppm b/testimgfst1_8.ppm
new file mode 100644
index 0000000..11dca13
--- /dev/null
+++ b/testimgfst1_8.ppm
@@ -0,0 +1,4 @@
+P6
+29 19
+255
+0/-50,4/,4/,2-*3.+30+74/B:/J>0dC2¥A2âBBá=;®?,@+>-=-¬B5F;:5232./1.5//uKLkj¤SNdci_\VX-.0.-+,*+,*+,*+.,-0,+2.-<20A4.H94w9.¦A5³C7>,=,;,A8¤TKsGK<0/+/.,0/-PMF§~wwWV:45/:728302012,.10,32.?5,B8/>3/F21K4,;4?6>0<-C8M@xc mfFJ<1,)1+-NO?yh¥vkg@>29:4C@;GB<I?5D<1<71=9.L?/J<1@<1>A?1§?4¬@3Â::¾:8ÃG?bMé?Hù>QïKcçLlÔJanE?m£±¹¬wuX[F43/==3OI9kllgIDJ>;6H@3C?<a?6¨=+º;,¹;/Å;0â4+å3'Ô8+ÛFB½=0ØDB÷ESþHpýRtÚ]kèÎÍÿóýþôóÎËÆ°·¯EA5=82OF7wy °ýÜihKQ¸WhÈA=¼=.Ö8/Ý82Ø:.ð50â3.Û7-ÚEAÅ;.ÃC6ÖKHøYmû_têhp¶þüÿýúõ÷ðÞëîçYM?SG9SJ9ljÜϽfå@DÍB?Ø=;Á=0Ô7.é3/Ô51×6,Ú6-Ò9+Û<6ÖA:»=.³=/èfdøksÛns£¨éñäÌçÈñè×îçá[K;[K;^M=^PEqgºpÛ?@ä@A·=0Ú?:É=,ã5,õ,2ù'@ð@KÝ34×?:Ó:2½;-Ø=8×6.à`]þp|ÑRYx^zk´u²¸£¢ª^M;^M;]P@kalxy§¹éJNÔ<7¼C8Ó9-Þ>2ó6:ñ7:æ9?å@DÒKHÓECÖ?8é6:æ5/ò00×XQÿ\t£IKr[x`z¨`
¦oYi^[N>aTDlhqvº°°ÒÎÇukçWVÑB:ÎB5à=8Þ6-×CAðV^ñ8>ôGMæ74á:4è66å4*ò21ÝMLøFhcG;bzJjOkN\yCPj;A>5^Z[ccÔÑ´n\RÎa^å`YÇ:(Ï9*Ñ;,È:0Ð@7í04ú)<ò09â96ç53Ø9&Ù9)öGX°;NEG1w\iHiJfHhJ780JKComÊ|¯sgkm^K¼LAß8/Ô8)¿:+Í?3É:,à93ì<?âC@â96è8;Þ95´;*º@3ÞK[PI6yYcxQgFiJlNv¦Z`WHbYJh_PkaWXUFXUBWLÅ=1Ø8*Ò9)ª;(Ê<0à::Ú65¯<*Õ;3è96Û<8·;39(H=\QdsHBI7=D2mLoOpSWHi`QjaRkaWkbSg^MHI9kJ9ÛONÎ@6Õ@9ÈA;ÝB>²@6?0<.:,¬<0:,9+v8+NAXPTb>CK4;B0nMqTdKTyFjaRjaRkbSlcTumbjZJnC<¦GC×FCÞDDÙD>±?5<0:,~:/y9/u9.p6+l6*SL`XE?M4:A/6<0gJdMaJIj=gdSgdSlcTneV²·ºûýøÚØ¿[ZH¯¤¢ï½¶ÎWOÐB>¼?9<0}9.z:1m9.h8,i70g80RD;4:.28.2?.39-ZtMSp@[xH1B2heVheVkeYy{pëïòõöîèêÔµ¶¨õõóþþüöîëËq°D:?9u<5o:2l71f:1eE6gbN28.06,.3--2,/90;G3EZ;NbG%*-heVifWlfZtqîòõô÷æÝÚÉý÷÷þþüþþüþþþÿþùáÆ»«t{UHeD5]F6TN8JN3VXB8>47=36;5271-2.1628G2=K:+2+akSliZjfZwzéïï×ÔÃÜÑÍýüÿþþþÿüùþüýýôïþþþÿýöxTO2LN6OV5r~VRP9KH79A4:B7<D9=E8=L5AZ:CW<*1)
\ No newline at end of file
diff --git a/testimggray.jpg b/testimggray.jpg
new file mode 100644
index 0000000..95505a2
--- /dev/null
+++ b/testimggray.jpg
Binary files differ
diff --git a/testimgint1_2.ppm b/testimgint1_2.ppm
new file mode 100644
index 0000000..391cd8a
--- /dev/null
+++ b/testimgint1_2.ppm
@@ -0,0 +1,4 @@
+P6
+114 75
+255
+0/-10.51.62/83/:3-:3-:3-91.80-80-91.80-80-80-80-6.+5-*5-*4,)4,)4,)4,)4,)/,%0-&2/(30)63,74-96/:70A;/E?3IA4JB5MD5NB2NB2PD4T>1gA4D5D6²D7¿C7ÈE=ÊG?ìBKëDKíCFó?Bø9@ó:?å??Ò>:µ@.´?-´?-°?-«@,¤A,A*A*?/>.>,<+?+=*>+?,?8?2®C3¾C3º@1¦F8yD6J7(:6584371150-72/61.61-50,.0-//-0/-2.-5,-3)*:+.G8;sCCLK¥Z_¥o~ª{¼gjSGoPH`PK_jjr¤rsaWVDUQbUQb/.,0/-40-51.61-61-81+81+80.7/-7/-80.80.80.80.80.5-+5-+4,*3+)6.,6.,6.,6.,2/(30)41*52+52+74-85.96/?9-B<0F>3G?2H?0J>0K?/MA1LC2[D4rC1A/:)§;.´B7¼G=ÝAEãCEìDDö?Cû:?ô;@áB?Ê?8³@-²?,¯>,®?,©@-£@+@+@)>.>.=+<*=+<+=,?+@6 @4¶B5ÂB5ÀF;£I>rD7G9,=77<6694183062/51.52-21,-2./1.00.10.5//5,-6,-?35a:3~E<PNfzx£t~¹Z_NBrNCeOFaPN\osv
yjl^VWI\T_\T_,,,.-+0/-3/,3/,4/+4/+6/)3.+2-*2-*3.+4/,4/,4/,4/,3.+2-*1,)1,)4/,4/,4/,4/,41,41,41,52-52-63.74/961<5+?8.B:/B:/D:.F:.H<.K?1GH6RG5aD2u@.;)<+£C3°L=ÏEBÖEBäB@ò;=ú9<ð<=×B;º@1@,@,¬>-©>,¥>-?+?+>)?.>-=,=,=,<+=,?.B4¥A2½A7ÇA8ºC;MCcC8<:.A75>63<4183/43/23.23.02-,2.-2./1.00.32040/2,,5//P5*c<-qE<aq|v¦ox»\_¤OEPAlK?cFBYEHQRXVU\TQWKTWL`XV`XV+++,,,/.,0/-1-*1-*2-)2-)2,,1++1++2,,0**0**0**0**2,,1++1++0**2,,2,,2,,2,,30+30+30+30+41,52-74/850:3+<5->5.>5,B8.E8/H<0K?3DE5LE5YB2h>.v;+
9)>/¡E6¼F<ÇG>ÜD?î@?ò::ç>;ÊD8ª?+§@-¦?,¦?.¥>-¢>.?-?+>)>-=,=.<-=-;.=/?1E1¨B4ÁB;ÃB=¸OK_WeTJ>H=@72=6094.63.43.13./4..3--3/-3/.3/02/00.2200/-0/-=.)K5*]B;~k~¼zÏkn½OLJ=iF<aDBZ>BMBLMLWQNXOR\QaYLaYL,-/,-/---.-+/.,0,)/+(/+(/+*/+*/+*/+*/+*/+*/+*/+*/+*/+*0,+1-,1-,1-,1-,1-,0,)2.+3/,3/,2.+2.+40-62/80-;4.=4/>5.?4.B5-E80H;2G>5M?6U=3^8/n8.~8,;0>1§A3´D8ÉF<ÞC>çB@ÞE?½C4¡B, A- ?.>->.=,=-=+>*<+<,<,;-</
=1?3B6F4ªH=¼E?»KG²e]ylstfO\RMI>B>5:7.33+34.03,/1,,1+-2.-2./1./1.02/11/11/11/8,6?42SHD{ÇÙrxÂbg§TQpJJdLTa]klq|zo}p\j]a[Cc]E-.0-.0-.0....-+-,*.*'.*',*++)*+)*+)*,*+,*+,*+,*+,*+-+,-+,-+,.,-.,-/-./-.0,+1-,2.-1-,0,+0,+2.-40/91/;30=31=4/>3/A4.C60E82H94L:6O:5U61e60v6-90<0@5 @2®B5ÃE9ÑF?ÍH?³E8B.B.?->,>/=-=.=,=-<*;+;,;-;/=2@7D<J=¥H@³KH°]U¦o|xao`QSEGI;=?224)01)./)./*0/-//-//-//-//-00.00.00.00.7*>713SUJ²À¸
´|w
«¥`q_ZV9`\?+/2+/2-.0.......-+-,*-,*-+,,*++)**(),*+,*+,*+,*+,*++)*+)*+)*,*+-+,.,-/-./+*0,+0,+.*)/+*/+*1-,3/.:12;31=32<20=20?1.@2/B5/A62B94D95I62W61i7.;0>1?6?4B4¨D5µE9¸F<¨B6?1@,>-=,<.;-<.<,;+:*:*:+9-<1?6D=HAI?JDªWS¨tg§s~n\hRLUB>E58;022*0-(0**2,,1++1++0,+0,+1-,1-,/.,/.,9(:41*R[>s ¨¡Å«À«Á©³°³§~yZnUTS7VU9,03,03./1./1000////.,/.,/-..,-,*++)*+)*+)*+)*+)*+)*+)**())'(+)*,*+.,-/-./+*/+*.*),('0,+0,+2.-40/;23<34<21;10<1/=/.>0-?1.:70983:94?82F3,[5*q9,<,95?3B2A1>0¨A8 ?6>4@-=+;*<-;.;-:-;,
9)9(9*~8,=4A8H@NHHAPL«d`§v¥®}thw`YgPHSB=C566.2-)1()4*+2)*2)*2)*0**1++0,+0,+0,+9(241 IV*wY{ °Ì¡Î§Ê¡´±¯¤}slSgKIL/FI,/0*01+12,21,43.63.52-4/+7/,6.,2-*0,+.,---/,+0)*./(//(//)-.*+/+*.-)./*./)--/.../.,2.+4,)7.):/)<2)=4+>5.=4-<3.=2.;0.=/.?10F/':6+.:,45-C++Q'(Y2+]A3vB,A1=39.<.A/B0?,83<2@0~A/A1=0:.:-x<1p;-s@/u;->2G<MAQCKNm`|q~¡¦¥¢kzbbY{V[mSRUDG>7<..6',4%,&,,)*,-(,2'/4'03'10(3/)31-..-(HK8xbn¢p¦pµ}»³«x©z¦~}ynkTcPEI:=A212,23-34.43.65096185083/91.80-4/,3--2./0.1..0+*/2(00*.0*./+,1-,/.*0/*10+0000./0/-3.+81+:1*>4+@6-@7.A8/?6/=4-=2.;0.;0.=20D3,P,.X&/N&.?0-<2)Q0)i-,i;,{<3;7:6>5
A6B5B6?/?.>-;+9+:*<)x>(~;2v:/v>/y>0B8G>JAODNNl`o| |ª©
{cj]c\bTuXE^H6F9*6,%/'5%(4%*2'+/*.,,.)-0&.0%/12,..+&DF8s~`~jk}m¦s©v¦s~¦t~¥x}¢yxvjgRdNBB699-560560671872983<94=:5=84>63<419418307327323121/05,/5,/3--3--3/,40-32-32-43143162/83/<5/?6-C90F90E;2E;2C90A60?40>3/>31?42@72R/5\(4Q,3<714;+F6)Z/)b70s979:8:~:7}A9B;
@;~E1A/<.9-7+:+y?+sA*
2*G?|90E9}G;K>MCTJnoP|wZgw£~~{©vynn{nr
iesZVYHH@5=/&9))3)',+').('-)*,+.*+1(+3)'?;2QTAivZp`qdrgsiu ktlz¤ty¢vwutpgbPdID=5<5-782782893:94;:5?<7@=8@;7B:7A96>95=84=84=85;63941:0/91/91/72.61-52-63.74/540952<94A:4A8/D:0H<0J>2J=4J=4E;2B8/A81@72@72A83>95?<7A>7E<5G90J8,H;+F>+g2*z93?>C@HB?692<5A5?4<2=1y?1y?1}=1:1£31å{¦SMK?nO=jT?sXC`McRx]¿daÎadÉ~x®~ ~wst~stqji`xXS]DDC.C4-;2+11'/0(41*>,,G',N#,OC3`[EgkPk{WhXiYobqdpkokw vuvtupne_MfFLC<D;49:49:4:;5>=8=<7A>9B?:D?;E@<E@:D?9E>8D=7C<6B;5B;3A81A83@72?82<71;6085.74/96196/=82A:0C;0I=1L@2N@3N@7K>5I<3E;2B90@91@91A:4D;4I81[<7h=7p>7s<5z?7H>F7E;>5=4¢I;£M>£G8¨C7¡AE9;<9uA6lE6wC802¬6BßOOÊEFÅb]M?h\BbeFmfIiO·dVäU[ú'Gÿ!Iÿ4TñP`çemâkoÈuqÃztºu²w¬uªum£caSTHO>Bi78Q/-J3-G2-J2.S74]R2gbBrxTu\n[o^ucwcsnutzzz{mid}_OiFUMBRJ?782893<=7@?:A@;C@;DA<E@<FA;FA;FA;G@8JA:I@7G=4E;1D:0E;2D;2D;4?80<71:5/94.96/;7.?8.C;0F<0J>0M@0M@/O>4L>3H;2E;1D;2B;1@<3A=4Q81?GÕMaÖR]>7H:»KGÛ?J¢E3§@1«;/®>0ªC0:&ª=)³;+³6>¼?GºGL£KG;04-½AIâ?TÚ85Î65ÉSOVGqaGppNkL¥s\ÿJWý8Jÿ5Nÿ/Jÿ5Oý1Jÿ.Kÿ/Nÿ5Xÿ9ZüA`øEc÷EgöBgüClÿGsÿXzñTsÛ\qªNYf.-Q;0<?,9K5]P0idD|a}kxlwiyhm
§¡£¯¥¢xvby]OjIXWEZYG671782:;5?>9A@;DA<EB=GB>GD=HC=HD;KD:LC:KA7J>2I=1F<0E;/E;1D;2A:0@91<71;60;7.<8-@:.D</G>/L?/NA0O?/N=3M<2H:/D:0C;0@<1@>2B?6v94ÎT_í;QÐ*4¤4&<#´>0×47¥?1ª</¶@6»G:¬>/¥:(¯9+ÁA6ÊA9Þ>>é:?ä>@ÑD=ÙSJÜ>=é08Ú6*Ñ2,»72³aSZC^D®bRÜg`÷<Gâ<@×HDßQOëJPò9Gú0Fÿ4Lþ9Uþ9Wÿ=_ÿAfþ?hþ@lú@o÷@pÿ?hÿFkùJkèZp¾Zdm63RA1FK4dUB{j¤¯¤Â¶ËÈÃÍÉÈÈÃDZ³²exbSlNU]EW_G560560671:94=<7A>9EB=HC?HE>ID>JF=MF<ME:ND8OC5OA4LC4JA2G=1D<1C:1A:2?82<71<8-<8-A;/D</K?1M@/P@0O@-O=1L</H:/C9/B:/?;0?=1@@4 BC¼HK¹//¸/'©9#B#B">"8/¥6/´=9¶A:«?3§;/ºD:Ã?:Ä>%ä2(ÿ &ÿ"+÷))è3*å3)ë.(Ö7$Ô6*Å:3ÅeYaN¡YJÜa\ñCLî=CÔ?;¿?4Î@<òAIÿ4Gü5Hõ<Jý;Uþ7Tÿ7Zÿ9cÿ=mÿ?rÿ@tùAuúGeÿKjþLlÿa|ïfzÏjrTSPH~z´¨¨½»¾¸¼Å¼ÂÎÆÈÕÔÎÜãØæìáßïàãëÛåãÕâÇÂÈnl\uW_lN^kM201542875984;:5>>6BB8EE9HH@HI;KJ5MM5KJ8JIERP]KI_OF7I?3J@6D;2C:5?74@86;55A62?75>:;===@?;G@6M@/O?(BA/J91P37H599>83D48@)QK3½L>£5& 9& =(¢<&®?+³:)·5'£9)¢;*§B0©B/«>*´?.ÂD5¼8+Í6+Í;.Ó=/â7/ò/-ö/,æ6)Ô=(Ü7#Ñ9$Ã7&ÊD9×JCòRRøAFþ9BàDGÎ@>²<0¨>.¿N>ÖIBí?Aÿ<FøDMýEQû@SÿA]ÿEiø=høBrýK{ÿKwïQrèXsÿYzÿGsõKpÀhvzmeº ÝÕÊâãåæßïôÚõÿÝùÿèøùó÷ûøóøóðóêíëâçÙÓÕ·¶´}
z{~
u/.,10.43/650991<<4@@6CC9IF=LI:NL7OM8NL@`_ettuujbwVOaKCRD=EB<><73=90=9.96/<90>;2?;0F>1K?/P?/P=,8@(>=+@91<73A96Q20t).¥9F¦6(¤9'¢;( :$§<(µ@.½>/Ã;/²>1«:,¬;+¯;,³;+ÄE6Ä<0Ã6,×4+Ö8-Û9.æ3,ô.+ô/)á4&Ï9!Ý2 Û9*Ñ;-Ì?5Ç:3ØD@çIHå??ÕA=Å?6²:,¬;+µ=/×JCä@AüGPñ@FûEQýDVü?[ÿCgÿFoÿLyÿK{ÿExÿMvÿWxúOoùJkØJbÓfVGÁøáÙû÷öøõÿþìÿÿîÿÿõÿÿýþÿýùÿù÷ÿõöýòöîåèÍÉÆ¯°ª§¡ª²¥¤¬32.10,21,43.77/::2>>4AA7LD9PI9SL:SL<TPOsq»ÒÍ}¶ol^Z{QNaB@E<9497+574891?<+D>(I>(K@,L@2I?6O<6F859830;35;1O4->@¨6>ª<+«@.§>+«>*¬9&º;,Ä:-Î;1Ä>5½8/½9-½7,Æ<1Ê<2Æ2(Ð7/â1)ä3+é4+ð/*ø.*ð/(Þ4#Í7Û1 Ù3%Ö8-Ö?6ÛLDÌC;ÐKBÆA8¿;,¼:*µ:*º?0½=2Ë@;ÝDFìKQí@DöFPÿJYüD\úAaÿHnÿOzÿKxÿP|ÿNwÿTuûNjîLcÿzÿKH¿~xüÑËÿööþüÿÿùÿÿùÿÿûÿÿüùÿûøÿúùÿöøÿó÷÷ëíàØÕÔÑÈÕÕÉËÕ;ÈÀ=:385.41*52+74-:70>;2A>5LB6TH:WK;TJ@XQXxwÖ¢«ö£¨ùìÝÅ«hhUReKIWEDV?<E?:4C>+E@*BC1?D=;DCC@UJM^NW`LXXLNCaJ:R>@,ª?-@,°A.±<*¶8)Â8+Î7.Ö92Ð83Ï72Ñ:3Ï60×=5Ò5,Ù;2Ù80ë0'ï0(ô/)÷,(÷-)í2)Ý6&Ï9!Ñ9$Ñ6$Ó7*Ñ7-ßJCç\UÈH=¸>3·=&¸;%»9)Â>1ÈB9ÏEBÓIGÓIIèDEïIMûQ\úM`öE_ûHhÿOvÿPyëZwö[zýVrúQhÿ[lóRbòO`óL^¾pl︵ÿìéÿüûùþÿúþÿýûüýøõÿú÷ÿûúÿôôøéììÞÞåÚÔïéÝùöçæðïÏÙØB>5?;2;7.95,62)73*<71B=7KA7SG7WJ9[MBWMVppÙ«ÿ«´ÿµÿ¬³û¬¯ò ¢ßÅtq¨`[]TVOqEAP@?=?@8@E>;DCFOTMki||i~ Xc°QO«A1§:#©:'<*±<*·9*½5'Ë7-Ø:1Ý:3Ü:7Þ;6ß<7â=7å@:ß;2ïKBóQFî6,ï,&ú*(û)(÷0-é4+Ø2$Ó6%Ç<'Ë=)Ð8*Ò6*Ó91ãNHÜNJÀ95·=%º<&¾9(Ä:/Ê@6ÚSMÊICÃF@âHFéOOíQUíMYøRføNhÿPoÿQuíWtü\xÿZtÿSiÿXiÿ[jùH\ÿMcªgaÒûÙ×ûóñ÷ÿýøÿÿýÿüÿù÷þùõÿ÷ôÿööïáááÓÐèÞÕþ÷çÿÿëïø÷ÖßÞGC7D@4@<1=9.95,84+;60@;5H?6NE6VG4YI<XMQhgͦõª²ú¯·ÿ³ºÿ´¸ÿ¯ù ë×yvÃpc©bZSQxBCW>9@QADdGLai°p¢¼t¢ÂfÈLnÓ>TØ>FÂ8-µ=$8&±8'¹:+Ã;-Î;1Ù?5à=6ß80×2,Ø3-æ?9ã:3Û4,×3)Ø8,Ö9*ñG:ö93÷))û*-ï--â4-Ù2*Ô0'Ì;*Ñ;*Ö=-Ø</Ù<3Ø=9êRQÕ?AÁ<)Â:*Á9)À8*Ä>3ÐMCËMA¿E:ÕHAÜNJßQPßLRñYeý^rúTlúPkÿJuÿVxÿUoÿ_pý_mõbläfjÓbd}WL¡zs´øèè÷ûú÷ÿÿþÿÿÿùýûûóýúõÿú÷øíëâ×ÑåÛÏÿúçÿÿæñöðÞãÝOI;LF8HB6E>4@91>7/>71A:4C@9LD7RE2WH5WLHc_v¾£è©¬ù°ý¯²ÿ®±þ©¬ù¢¥òéÝËpq±dh\XykPcJUµQYÏS[ðBcæF`×@QÍ3?åAHÞ>>ËA7ºE3¼A1ÁB3ËC5ÕE:Ø@5×90Ø4+Û4,Ø7/Ý:1Þ7/Ü5,×3)Ó6'Í4$Ò=)Õ>-òA9þ68ù,1ë12Ø/,Ù1.à44ê72ç92à:.×:+ÝE8éTMÖ@AàINÒ>4Ç7,Å;.Á<-½;-ÁB3ÁC4¼>/ÇD:ÏLDÔPKÔNMë^dÿiuùZnøRjÿRxýVpõkxîeoõaoîhsÓ{yqb_\Iyg[Ë«öàâüøùùÿÿÿþÿÿùÿûÿ÷ýþøÿÿúÿüöïæÝìåÕÿýäÿÿäôöëëíâSM=QK=MG9JD8F?5B;3A:4B:7AB<JG8QF0VG0UH?a]n¶¡Þ¥¢ùª¨ü«¬þ«ú¦ªô£§î¡¨ì§èâÕÆ
ªh¹RcàCN÷8?é?.ØH.ÂK+¼D)ÞO?Ý97â<@Õ4:ÃA3Ä>2Å9,Æ2&Ï2)Ô3)Ø4+Ü5-Ý?4Ù8.Ü8.×3)Ô4&Î5%Í:&È:$Å:'Ý4-ú68ÿ6<ò;=á98á99å58ý*1ô./ä1*Õ5'Ç3%ïaWÎ@>ÕFHæHEÏ81Æ9/¿=/»>,½@.¹:'¿<*·;/ÀF9ÇLDËKHç`dûitýbrúXmû]tâjsäâvvÿo~ïaqõ·MaH`]NÀ¤£øÛàÿ÷ûýþÿÿýÿÿ÷ÿúÿ÷øþôþþöÿÿöý÷ëøóàÿýäÿÿâýþðûüîXO@WN?TK<RI:MD5KB3I@1I@1FC:MG7RJ3VK7VMHb_t
µÞ£ö ü¥ÿ ¬ÿ¬ò¢§é«¥ï°¡ô©ý¢Þ¬¼¿kzÝ@K÷5@ë;>ÖEBá:BÓ>@ÊC?Ð>>ëBGì8Aâ9<Õ;9Ë@;ËE<ÅG;µ:+¼8,È5-Ô0.á32ã=-ß3%ç7(Û4!Î6È7"Ë8(Ñ5)Ó1,Ï7*Ê7%Ñ6$à2'í0.ì+0ê-4õ*.î.-ã5*Ô7&Å2 ÝN>ÚJBÔ@>àQSÓD@É90È9)Æ;(¾9&»>*·>-´:/¹=1½?1ÃA3ñmaíhaïiföpqÿl|ðckó`fõtoý{{ÿVmö~¥ThCadI½«ýåãÿ÷úüúýûÿÿüýÿäÿíæÿê÷ÿóÿÿòÿüïÿøçýõàþøàýýýÿÿÿ\PBZN@XL>WK=SG9QE7PD6QE7JF=OI9VK5WL8VMFb_p}«ÎÚæñ¥ò§ç¡ÜÛÞΪ
»ÈlÐG[ÝAEâ@>ã?@ä=DÞ:AÑAAÂ>9ÖKHâ?Bç:>Ú78Í<7Ê@6¿9.ÇG:¹;,½8)Ì8.Ü71ê;8Õ4*Ú6,Ý7+Ö=-Á8%¸;'»<-¾8/ì?;Û=2È:&È:$Ð7%Ô0&Ø1+Õ0.Ù0+Ø6+Î5%Í<'Ì;(ãLA×:5ðLMúdcîYUØD:Æ4'Ã7&º9&¶=,²=,¯;.²<.¶>.¿D5Ü\QëgbïihêcgåTcógp÷djüvuøprýG`ñtssQj@hoP˾ÿõíÿý÷ûÿúùÿûõüõØýÞÕòÖãõÝôùåý÷çûòáïãÓôé×üùôÿýø\PB[OAZN@YM?WK=VJ<UI;VJ<OH>SL<XM7YL9VLCa[gut¶½Ê×ÙÓ
Ây¹owµpºZí=dø4LæDBÖLBáEHö9MÜBDÎDAµ91ÐKDÝABà<=ÖA=ËG;Â8+½8)½<)½<)Å<*Ó;.Þ7.è71æ44è02í55à3/Î4,É91Ä22Ö=Bò14à5.É6&Ã;%Ç:&Í7(Õ=0Ô=2ÊB2Á:'Ä=)Ä;(Ì;*Û=4â66â-2Ô72Ü?8ÝE:ÕC6ÉA1º<-±<+¬<.«=0«=.<,¶B3ÓZOèheëikìfmûo|ðgoýgpÿwzöelþ=ZïfxwdP|bÍÉ®ÿùçÿÿñõÿñéúçÖçÔ´ß´´Ø²ÂܹÕâÆêìÖôíÛëÝÐíÜÒìâÙëáØ[N>ZM=ZM=YL<YL<XK;YL<ZM=TJ@XL<ZM:ZM:XNB[RWc^tsoy|²Æ
Ê¿xx®oo¥gf VSÅITü8Lÿ4AðA>ÞIBåDJö;PÔDCÅD>°:.ÊJAÌ73Í/,Ï@8¾D5Ã:(Â;(¿:'Á:&Ç8'Ö9*à5+æ4*ø-1ÿ07ÿ,4ÿ.4ú17ô/9þ0Dý'?ö'/é/0Ô6+Í:*Ñ8*á=3æ;3æ;3ÓK;ÉA1Á8(È9+Ï5+ä?9Ý++í57Õ4*Õ7,Ð8-È8-ØPD¾@2±9+¯;.<.®>0«<+<.ÆQGãgeðotör}ûs}÷pwÿnyÿpwõ[gÿ9ZìYl¥{gm´¸ÚÝÀ×æÉ¿Ø¸®É¨£½¼Á£Ç³Ì¤ÌÕ¸åàÍìÛÓäÌÊׯ¾Î½µZM=ZM=ZM=ZM=XK;YL<YL<ZM=ZL?[N>]N;\O<ZN@YNJ\RZ`Xgidrl}v¹È¿s«t¨c£?0½>5ß=8÷?=ø<;ð=@ëAJä?MÅ>8¶=2<.ÆH<Ö>9Ñ30ÐB8³:)¿8%Ã<)Ã:'Ç:(Î8'×4%ã2(ð91ï3*ô-(ý''ÿ'(ü$)ÿ#2ÿ :ÿ3ö&3é*1Ú,-Ù//í68ö37÷/2ö.0Ö92ßB;Í0)Ï2-Ù72å@<Ù0+ã73Õ<.Ì4'Ì:-È:0æ]SÀ;2½:0¹6,·2)´4'²7(²:,µ?5ßebóuyùwýzûu~ÿq~ÿitöUeÿ9\æO`zxbbux}nqisip±u¹~¾½¤¹¾À¨ÚÌÃ׿½Ã´¯¶§¢[K;[K;[K;[K;ZJ:[K;[K;\L<]K=^M=]N;^O<^Q@[OC\OI\QOaSlh]wo«|»¼¨y¥Áv¡»[Ô<9Å?4ÈI8ÚC8ö<?ý9Cë@HÏ@B»<3®:+ª;*ÅC6Ø:7à;9áJCÆD6À9&Ã:(É=,Ë:)Ð4'Ü4)ó>5î3,Ø9&ß3%é.%í,'ì*+ð(2ú"9ÿ9ð-;ô:GþJUî6Bð,:ù-9õ.3ì+,Ü41Þ97ÿ]\Ú86Ü=:Ù<5Ó6-Ð4'¿6$À8(Ã;/Ä;1ãVOÅ5-Õ>7Õ<4á<8Û>7Î;1¾8,º<0×\WóuxþùzüyÿpûcróPcÿ6YäM\v~W`~HmPyZsYfUj^w h¥m¯r·w¸wº{¯}§
»²£Ë¶±¬¦ª[K;[K;[K;[K;ZJ:[K;[K;\L<^K<_L=^M;^O<]N;^N>_O@`PAdN[bUqoi}v¢¢ÐämâJcÿ:MìGMËD>ÑF?êADô?FäDDÅB:¸>1©:)ª9)Â<1çB@ì<>ß=8æZMËC5¿6&È:,Î8*Ô1(ç:3ì51ê-)è45ð37÷29÷4<ì1<î3Fó.Jÿ2Yë<IÿYfÿZjò?Rð7Gã2:Ò72Á8(Ç2+æQKéTPØ@?ØC?Ë6/Î:,É8%°<%´<+³8)Á<3ØGBÒ3/è<8ç4/ó-.ï31á90Ò;0¼6*ÐQJòtuÿöw~ýzÿmù`rñNaÿ7YÞLWXg<[wDnRz
[~eziz¥oªpªmr³s¶q¹t±v¥}¹·¢ØÇ½²µÄ«ZK8ZK8ZK8ZK8ZK8[L9[L9\M:`J<_L=^M;^O<`Q<aP<aP<aO9gMPaSdmm}x}×üjmÿGNÿ'Oÿ9Rà@JÓBEÛBDßABÖB>Ã?3²<.©:)°?-ËA7á77å.2Þ52æRHìdVÈ>1É9.Ñ7-Û60å61é0.ô43ÿ&Cÿ#Bÿ>þ;ó"Aò*Nò'Tÿ7jü\høZhîM]à9KÞ9I¼,,¦7&E%µ:*ÑSEÅ@9Ä:7ÜNJÇ9/Ç8(Ç9%¥?(¦;'©5(ÈH?ÛGCÝ52ë40ò1,ÿ(-ú,,ë2-Ú:.Å7+ÅB:éljÿü}þz
ÿgyóZlëI^ÿ5VÕEOL_1]wG|als¨w}¨p~§k§i
¦m¬m±j¶n²s«}»¾£×˽ªµÉª]K7]K7]K7]K7^L8^L8^L8^L8]K?]M>[N=]R@^SA`P@cPBdNCmKIgWbqv¸¸»åyyùl[ñO\ëCPóDQì<Gã:?×<:Ì?6¾:-¦?,9*Æ@7Ð83Ù61Ü6*Û:&Ø:!ç?<çMCÉ<+Ï=.å@:ê16ó0>ù4Eü%*ý')ý''ø&'ò$(ñ)3è(7÷:NÿcmýX_ðJLÔ=6¿A2«B-23"§60ÇGDÄ44ÖBBØICË>4Ç4*Ï5-¹=1¶0'Ä4,ØC<áI>Û4,í0.ÿ.3ò12ó/0ò0.ä6-Ê8)¹=1ÝjeþøÿlÿZvÿNkù=^ñ>^¨LOHV5^Dv]z e~§k}¦j|¤h|¢e¡d}¦n~ªk}¬d²c³k¯t³¶epr]L8]L8]L8]L8^M9^M9^M9^M9_L;aP>\O>YPA[QH^SOeUViY\k]]miy¹
ÜÙ°³Ñ}ì~qÿaiòKS÷EQñ=Fã6:Ö;7ÇA5¹@/«=,´@3ÆG>¿4-Î70×9.Ù7(Þ9&Þ2.åG<ÕB2Ó;-ê?8î15ù5?ÿDRó/3í)+ð,-í++é-.ä-2òAKýN[åNSèGLá=>Õ:6Ã:0¹?4½D<´94©2,ÌFE×BDëSRÎ=8ÏA7Ò>4ÞA:á=>ç=>è:<íEBÝ<4Ú3+ê3/÷12ô02õ/0ó0.ä6-Ì:+´8,Ýjeÿûþi|ÿVqÿFhú;]éMe:8P[=cIs[vaz¢fx¡ewax`| bz£i{¨g{©`~_³k°s¡uqhKZU5D?_N<_N<_N<_N<^M;^M;^M;^M;`L3_O8ZN>YRL_X_qjzwmvkott}¨{Ï
èã´©w¬m[ç\Wö\\öLOí8?ç7:Û<8ËC7ºC/³=1«6,ÍXNÉPE¼9/Ì9/Û9.á5)â3.â>4ßC4à>/ä3+ð/0ô/6ÿQYÿZ^á46è:;ß33Û33Þ9=åFJÇ,2Ë24ß<?Ü17Ô/3Ô;=éX[õbj÷_kÊIDì^\õ[[×<:Ô?9ÜIAÖ=5×6.ú.:÷)6ô+5þAEÞ2.Û4,ã5.ï4/ö/2ø-0õ/.ç4-Ð<.±5)Õb]ÿÿxôfvúMiÿ7_ü:_ÇN]`<.ZcFgNu]ybx bt_u^w_| by£c|§by¨Z{ªZb«m¤t{mizj[l\_P=_P=_P=_P=^O<^O<^O<^O<dP5`O;[QH_Zarp~¥|z«zus}¸|ÂÆÉ¦Á»¬³Ì¶¡²s¯R@²B4ÚLHðJLì<?ä<;Ø?7È</¿<4²7/ÄUJÏeWÂQCÀ8,×6.ä3-ä2.à8/äB3à9)è1)ñ/-ñ01ï56ñRWøW]åBGèEJåDIõY\Ö@BÈ35ê=?ï:Aè.9óBLÿ`iÿeoú^kþYjê]VÞFCÕ23×85ãJDáJAÖ92ß82ü)8ÿ-:ÿ4@û=?à3-Ü5,ä3+ð50÷/2ù-0ö..é4-Ó=/³5)ËUQÿÿkð^qøIfÿ5a÷DdDDMG1V\Bf~Nt]zbu^oVpWt\y_x¡]y¤\w£Vy¥V~¨^¦fkubey]XlP]M=`P@_O?`P@aQA^N>bRBaQAcR@^QH^W^om
y{¤}¸tx¸nq¸uxÕϧ§ÁÃÀ±ØÑ¥áØ¡ßÖÖÌÄ¡µyaÄdVæ`]ëKMç:<æ::Þ63É83Á<5½K@¾WHÒdUÂ@3Ñ4-à3-â30â;3Ü8,á5)ê2(ï/*é2.ã4/Ù>BîRVéIQÿemÿckÿ`hÿekòY\ÿ<Dú0<ñ)6í3@ÿXbÿepÿcnüZiâGBÙ53Û11Ú51ÞA:Ö<4Û81ä84î7;ð6;ð69ä20Ü5-ß7,ç2+ô1-÷03ú.1÷//ê5.×=1¹4+ÅIGÿÿc{ôVmùDeÿ8cßMdc8/9C(QQ9]oGt]v\qWkPnSrXt\uWv Xt SrQsUnS]yFMd6@V/>T-YL<]P@^QA`SC`SC`SCaTD^QA\QOcYbqmxz£v{³mr¶`f°ouÁ
樤áÉÇÌäà³íé îçâۤʤ¤
ogYÆiböttèLOî?Dì8;Û<8Ó@9¹;/<.Ô`QÙWIÌ5*Ø4+å=<íJE×4+Ý2(å0'ä-'ß4,Ü>3Å1-ÞFEíQUíMWïMZøXbÿktçLRô-4ú.9ñ'5ÿCQðFOóTYÿ]díDKà72ê;8î<:â62Û:2×90ß82ë97ß;9ã:7æ95Ü3,Ú8-ß7,é1)÷0-ô23÷/1ö0/ë4.Ý?4Á6/ÎHIüu|ÿ[vÿLlý;`ðBc°LV[F5;C+JE1Qa=jTqVkOhJiLmTpXtVrSlNhJ`DUw;Kf3G^0Hb3Pj;UH8ZM=\O?_RB`SCaTD`SCaTD_Xjvrxw¡wy²jqµ\diqº
Ïâµ·çÎÍÝÛÙÌàÜ¿ÜÕ»Îĸ²§¥~zqri¢ibÛ~yõutø^^ñGHé=9â@;Í=4ÄB5º:-ÎI:Ð>/Ò9+áACû`\Ý@9à91æ5/â4-Ó5*Ä5'º2"Ê=3ÓAAÔ=DàDOñWaú`jäMTì:8ò;?ýBKÿR[Þ3;â8;øDGô38ë83ñ97ï64ä50ß<3Ü;1ã73ë54ä;8ç98è96ß4-Û9.Þ8*ç2)ô/)ð43ó11ô1/ë4.Ý<2Å4/âSWüjuõRmÿ:bÿ7bÜRiLF\TARM9NF3FT3]oGj
PiJfGgIkRnVrTjNcH_FYBUs=Tn?\qFWr?Xs@OC3UI9XL<]QAcWGbVFaUEk_Otoxvtv©jo¯]eem¶yÉۦϬ´Ù¶ºÝ¼½Ü¼¹Ö¶Ê°£Á©utykegvgd
`ZZRÖohÿzuÿigÿPJíD=ÜB:ÕG=¿7+Ç>.Ì=-Ó@.×=?Ô<;Ô;5Ü92æ93à70Ò;0ÇB3¾B(ÅD1Â91Ä57ÜIQèU_êY`ØGLÏ7,Þ:8é<@ç:@ã6:ì8;ù25ÿ,1î73ï31é-+å4.á=4à=4å95í55ì46ï26ï34â0,Ü8,Ý:+ã3&ð1)í53ð31ó1/ë4.Ù6-Í84ùfló[héIeÿ1aÿ7e¼IXW@0RM9[K;M@0>I+O_8c{GeFbAcEfMiSlPeK`G_H_H^|HaxLezQ\wB]xC@B7JE?TG?^M=aQ:`UCd^^pn|wqws¦hg¡^^¤gf´wuÉ
ßìÖ¡Ø¢Ø Õ ÑÊÃ|®lkqe\]oXR
UK¢XM»ZQÛphï{úêdcçSQÉ2+Ä6(À7%Ç:)Ó=/Õ9,Ô<.Ï7)Ú:.á90Û7-Ë:)À>(Ã:2ËB:É@8¾5-Æ=5×QHÛULÊD;Ï:"á7*ð,0û'6ÿ(@ÿ'Bÿ"@ÿ?ÿ:ÿ'<ó.8ç9:Û94Þ;4å95é62ì25é54â70Ù5)Û9*Ü9&ß8%â7#ì3.ð3-ï5)æ6)Û9.ÝABÿdtùJgÿ?bÿ6`ìGgv6678&EC4HB48G2FH Y_;csOdOaCb?hElPkHgGfIeIeJdHeGd}C\<aA69.??7KB;VH;[N;\TGechpnqkb`XX]`¥mo¼|}ÏÙÞÎÐÑÏÉÁµ~v]if[Y_]NvVG±ZSÔXZãggàuoô}ÿùngÅ7+Á:'¾:%Â9&Ë9*Ø8,Î6(Ñ>.Ë3%×7+Ö6*Í:*Â;'Á7-Ã9/Ç=3Ì?6ÎA8ÏB9ÐC:Ê=4Ò7%ä6/õ.5ý(:û&<ù%<ü":ÿ9ÿ 7ü'9ô5=æ::Û94Þ;4æ95é62ð37ì65ã60Ù5+Ù9)Ú9'Ý8%à7$ß5(á7(ß8(Ú8)Ô7.øW\ÿQhûBdÿ5_÷=b¸DYK)'-8(6=+C<)F@(W`1is_`~J`
@c@jIlPmJhHhKfLeKdGgHeFeEjJ.4(893B=:LC<QI<UPJdboii
baRRVWei³uxÉÕ××É
ÎÒÓÏ
¾§xsO\hYRSeKh\D§OKÝPYê_fãooäul÷|tørgÃ:*¿='¿='Ä;(Ê8)Ú6-Ñ9,Ç:)È;*Ñ;-Õ;/Í7)Ê;+É;/É;/É9.Æ6+Ï<2Ï<2Ð<2Ê6,Ö-&ê24ø.:ý-=ú0@ù0@û.=ÿ,;þ+:õ0:ë6;Ý54Û94ß:6æ95ë54ó49î66ä71Ø6+Õ8)Õ8'×8%Ø7%Ñ:%Ò='Ð@(Ñ>.Ø=8ÿ]kÿBbÿ9eÿ/[ÝQkc28933/6.4@,=<p^:¨oÄmaKaAiFqPpVnKhHiLiOf
JeIhHg
EiKnP(0#/4.764?<7GD;MLJ\^k_`~][WXfh²xzÑß
á×ÑÉÍÕ×϶~pkrPQhZMYhKeaFWJÉUVãX_îagïtlæaXÔD9É:*Æ;&È=(Î;+Õ7+Ó/&Ï9+Â=*¾;'Ë>-âL>Ð:,Í9+È9)Ç8(Ê8)Î8*Ò:-Õ;/Ú>2×9.è47ö7?ú2?ö-=í/;ë28ï05ó/3ò5;í6:á55Ý86Ü86á96ç77ë46ö5:ï79ã73×6,Ð8*Ï9*Ï9(Ð9(Æ:!Ä>#Ä@)Ë<.îIMÿOhÿ;cÿ2döAbBK>=8<7;C369>(K[,e¬Ê¦Ã
£qbJ`
?lEsRpVlKfFgJiNeJdGgHgFkMpR(0!).(/10783=>6FHCQT]Z\u[YdcwvÄ
ãñéØÑÆÎ
Òѽ|¡yq|ha[i^Lh]Kg_Hj`EuYA¦^OÖTTþR^êZRÕ<6Ù80Ø;,Ð9&Ñ:)Ø6)à3,Î1(É;-ÂA.½<)Ã7(ãOCÊ6*È9+Ê;*É:)Ê7'Í5'Ô8+Û9.Ø4*ä=4ö=Cñ1<ó/=ì1<ä5:ß77ðA>ô<:ê::å97à85Ý86à87æ::ë8;í9<ô5:î79â:7Ð8-Ç9+Ä;+Ä;)Ä;)Â;%¸7!¿>+Î93ÿWeÿ>\ú3\ú;f°HQT905C6G7:U.1QM2tXÃ{¾²~lYYwA`?kDlMjPgEcBgJfLhNgIgFmJqRu¡V/3$.1*00.45/:<.BD7MONUUa\Zrjh|¿ãïâ}Ì}Â
ÃÆÂ´
{yn~odbh\NXeKe]JpYIr\Gq\AWAÖWPþEMÜ94á51ã5.Þ6)Ô7$Ô9'Û5)ã2,Ã7(¾9(Á@-Â:*ÔB5Õ>3È:,¿<*Å9(Ç:)Ê8)Í5(Ô6+×3*á81é<6í6:î3:ì3;ç:@êLMù`[óPKæ95ß82ß82á85ä;8ä88è8;ë8<ë8<ñ48é77Ü:5È8-½9*¹<*·<*·<*¹<(¯8$°4(ÜFHÿNaô9VëGbÕJ_cE:ED08?-C5(O5&zwT³vÀu·
tMc<Sm=a?jDhHeKdCeFjMlPiOiKhHnLt¤Xx¨\:;+99/8939;0>A,CG0LM?RQMXXNecnxv
ÆÛÒ~¹}y«|µ
³~¤~vxmun`]k[NkZJb_Lh\Lq[M{\JXEªQAÑD;ã1/à40ã5.à2)Ý7'Ð9$Î;'Ô8)Ý5,¸=+³6$¿;,È8-èKDÕ<4Ã;-³<(Á9)Ä8)È9+Ï7,Õ7.Þ71é=9æ74ë97ì9<ë=?øXZúkgÔG@Ð72á<8á:2á83ã73æ66é69ê7;ë8>è7=ï79ç9:Ø=8Æ<1´9)<*ª;(©<(§<*¡:)ª8.éX_ôI\éG\ÆSZ YSIQ<KD1@<!AR(awF
`¢j´wwVeH?N1Se=eBjDgE`GfCiJlOnRlPkMkJrNx©Zyª[FC2FD8EE=DE7FI.JM.QP;VRF\\8]^Pkj|zx§º·zt ollgqlpkofkk^Uk[Ko\Kr]LuYNn^OmbP^O¢RI¹82Ð3*Û5)á6/à3,à6)Ô7$Ê="Ç?%Í<)Õ9,±A+«4 ¾:+Î7.à=8êMFÇC4©;$Å@1Å;.Ë=1ØA8àA;ã;8æ87è88ç:4ç:6õOOãKHÀ71Ã<6ÖA=ß;:â;3â94æ95ê88ë7:ì7<è7=ç6<ê69â88Ô=6À</®9(¦;'¡:' 9&:(<*E<îelîM_ÓGR§ZRmR?Q;K8'XM-o]x¼oyYXwQDN39B-<E0O]:gEmEgF^GkHnOlOkOrVrTrOw¦Uwª[t§XUL=UL=UL=UL=WN?YPA\SD^UFcZKcYOi^\relxku{mzuhri\e^]X\YR[WL_WJd[Jh[Hl]Fm_EdhQyUG¢UM²TH¨I5¨=)Ç9/à02Þ7.Ü8.Û7-Ø6+×7+Õ7+Ô8+Ô8+·=.ª5$®6%¾<.É6,Ô:0ÝI=ÍD4ÛHAÑA8ØC<ß;9é77î79å76ß>6ÇD:·9+±7(½?0Ç?3Û>7è88ó57æ7>æ8:å97ã:5á81å95æ:8æ89è:<Þ;<ÎA:·>3£<+<*:'8%>-3+ÒZ\ÑZ^¬QNZP]R^VK_ Vm)d³lyUYj@LV><B6>?1<>3;A3IX9c|EqKlGhJmTmSkJlGpHq¡Mv§UyªYn]]L_VG_VG_VG_VG^UF_VGaXIbYJe]Fe]Jf\Rg\Vi^\i^Zg\VbXOYWKSODQMAVPB[TB_XEe]Hh`KdeS\P¯ZWºBAÀ=5¾:.½9*Æ>0Ú6,Ú8-Ú8-×7+Õ7+Ô8+Ô8+Ò9+¹?0§6$£6!³>,Á<-Æ3)Ð<0ÕF8Þ45Ø22à::ê<=ï5:ë16æ68Ü86´9*¯5&8'µ<+ÈC4Ø?7æ95ï56ë7:ê88è96æ;4ã:3â;5ß:8Þ88Ú<;Ô@<»;2¥7(;*;)9&7$v9&>2¶PL®LIQK\QaV_V~[£µ§tUh:8J$=J09?18;4=>0;=2:@2HW8e~GtNpKmOqUoQlInIqMt£Ryª[nRYHNw=d[Ld[Ld[Ld[Ld[Le\Mf]Ng^Og`FiaJjbOi`Oi`Oh`Mh`KiaJc]MZTDOL;LI8NM;QP>TUCXYG^\OsWL³eaÎLNÝ8>Ø63¾=*«H+Ö6(Ö9*Ö9*Õ9*Ô8)Ò9)Ò9)Ò9)¹?2§:&7¤@(¶>-Ã9,Ê6,Ô=2ñ1<é4;å6;ä5:ç4:ç6<Ý9:Ç/,¬;)«<)ª;(¬9&¸9*Ð=3à;7è96ï56î64ê93æ;3á=4Ý>8Ù?=Ô>=ÆA:·<4¤6)9)<(;(9%
6%w:'@2¡SIRIYM\N^SaXeybCP6-:(1<.8>4>?7::0;<.:<19?1GV7gIuOsNpRrQqNnJsOw£Ty§\qW\D\LSzCg^Og^Og^Og^Og^Oh_Ph_Pi`QkbQjaPh_Nh`MiaLh`IhaGhaEf_LaZGWR?LK9FG5EI8EL<EN=QOCYPA{QC¹SNäEIä67Ì=/A'Ð7'Ò9)Ó:*Ó:*Ñ:)Ñ:)Ñ:)Ñ:)º<0¨=+8=#¬?*Á;/Ê3*Ù<5ñ8@ê@CÚ>?Í97Æ22È:8¹82«6,£>,£@+£@+¦=(¬9'»7*Ì70Ý@;ì95ë:4è;4â>4ÝC9ÒB:Å>:¾:8¢:-6'9):'=*<*9'}6$z5&L<QCXJZN]R\UZUU]8=F)9B12<46<8CF?EF8=<(:;-8:/7=/ET5fHuOsNqSqLpKqMx¤W«ctX_G`J^
NSzCi`Qi`Qi`Qi`Qi`Qi`Qi`Qi`Qj_[j_Yj`Wj`TjaRjaPjaPjbOh`Kg_J`[GQP<FI8AE6>F7<G7DH:AJ5RK1`LÛ^XëGHà>;Í=2Ë8(Í:*Í:*Ï<,Ñ;,Ñ;,Ñ;,Ð:+¿:3±=06 6®;)Ã9.Ú?:éGDäDFÌ>:°:0¥;.£=1<.=-?,<*>+@,?-¢=+©8*¶8,À;2Ø;2Ü?6ÜB8ÖB6ÎD9»<3ª5. 3,<,;*:*<*}:){:(z8(w5%8,NBNBSHXOTNYTYVR[0OY6=G.5@0IQDZ^MHJ2>? ;<.:<18>0FU6hJuOrMqSrJqMu¡R}¨`y¤_cJaJfP_PTyEi`Qi`Qi`Qi`QjaRjaRjaRjaRk_ak__k`ZkaWkaUkaUkaWkaXlaMjbOe^KYVCMK<DF8AE6=C59E1DI2RD*eP¼TIî^]íHLç>AÈ:,È9+È9+Ê8+Í;.Ï;/Ï;/Ï;/É:6½=4°</µA2ÎJ>ßJDçHDáB>ÐEBµ?5A/G3F4B2B0wC.9,:*<,<+<,9*9-£;.´8.º<0»=/¸=.7)¢8+8,90=.;,:*~;+z;,x:+s8*r7)B9J>L?SJQMRP\Xi``o|QAO+O^?boSOX=AE*<?"9:,9;09?1ET5hJvPsNqSq¡MpNy§\z¥^fM\EhPcI^PRwDi`Qi`Qi`Qi`QjaRjaRjaRjaRk`\kaXkaUkbQkbQkbSkaWkaXnbRkbQkbQd]MYSCNK<GE6CA2:J/RA-MB¨E?°:6ãa_õdgíRXØNDÏB9ÑD;ÖG?ÚJBÝJCÞKDàKEçMOÝML×NHÜMGáFDæBAäB@áC@ÒGD³>5A1E2C3
@1>0z?190:1;/</;,:+:,:-9.:.:- :,9)9):+;,:,8*|6*{7*x8,w9,o5)r:-I<J<RDWNPMVRaWueUQ`9EV,Zm@cuKL^89F(=E09=.9:,8:/:@2BQ2c|EtNsNqSmLu¦Wy§_iQ[DdLfJgG]MRtBi`Qi`Qi`Qi`QkbSkbSkbSkbSlbVlcRldOleKleKldOlcRlbVnbTkbSlcTi`QaZJVO?NH8HB27J*mF5¸GKÆ3=É<BÈLJäjiÙX\ÔKEÎC>ÑFAÎ@<ÒC?ÔC@ØDBÙECà?DßEGàHGãCEì?Cí>Cå??ÛB=Ó>@µ82?3>0:/8073:4;4:3|<2{=2y;.z</y;,x:+~:/9.8,9*8';*<*~=+8,}5)|4(z4*v3*u7,o5*t>2QBQ?XHSHRMUQw`PBL3L[<arN]sELd47L#1?%<D97;:;<.8:/:@2>M.[t=pJsNrTq¢Qu¥YkS]GaKcIfHdC\~LPr@i`QjaRjaRkbSjaRjaRjaRjaRkbSkbSkbSkbSlcTlcTlcTlcTq_QscVndXicUgdUfaN]XBQK1NB(lP;cW¤LH¼ILÉFKÐHJÓIIÓGJÏ??ÔC>ÌC9ÆG8ÈH=ÔDCÞ>FâBDáCDâDCãEDâDAáB?â@=ä@>ÌC=±:2;1>2}B4~>49382
<-;,;-:,9-9-~:/~:/}90}90}90|90|90z:0y9/w9.w8/t8.r6,p6+n4)l3(n5*y@5TLQJOLPNRJ_NgcFYiE^wMRi?Ma<FS59A)69&>?1@>23;05;/;=/?C,ZfBpTrRrQz cu^`I]FaJdMdM_
HXzHJl:i`QjaRjaRkbSjaRjaRjaRjaRkbSkbSkbSkbSlcTlcTlcTlcTrbSl^QndZkdZnj_
srxq^NV>CE/L?.Y=/`8.l:1yC9
LA¨SL·KHÉCBÖB@Ô@<ÔE?×FCÛEFßCDßCDßEEÞFCÝEBÙD>ÚC<ÛD=ÔE?¾B:9/;-A2~>2:190;,;,:,9-9-~:/~:/~:/}90}90{8/{8/{;1y;0x:/x:/t8.s7-q5+o5*m4)l3(j4(u?3PIQLSNVP[Qu^LiiO^mNG[8AR2DS6FS9?I19=,;=/9;-5<46<2;=0=@+R^:hLpPu¡TxadM[D[D`IbKaJ^GTvDFh6haQibRibRjcSibRibRibRibRkbSkbSkbSkbSlcTlcTlcTlcTqeYoe[mf^~yµ²«¸´«®§qQUD?H5:G3=J89D3:@2=A3Q;.JCµMNÒEKÛ@DÝCCÝEBÜD?ÞDFÞDFÜDCÚDC×FAÔE=ÑG=ÑG=×@9ÉC:ª>2<.@0>.;-;.;-:,9+9-~:/~:/}:1}:1z:1y90x8/v7.x90u9/u9/s9.q6.p5-n3+l3*j4*h2(g3(q=2LGRKVOZPs\N_VERWC@L65A-2>*6B.?H5@I6<E28A04=,4:65:49;0;>+KV4d|HsSx¤WpY[~D]F^G`IaJ`I^GQuEAe5haQibRibRjcSibRibRibRibRkbSkbSkbSkbSlcTlcTlcTlcTmd[mi`¶¶´ÑÑÑíëìïëèåÝÛØº°}c^KCH4>J6>F7=>8>966@5K61KLÅbeÌTUÙOMâHFçAAÞDFÞDFÝCEÜBBÚDCÔE?ÐF<ÐG=Þ?9ÏB9·B89+>/>-<,=+:,9+9-}9.~:/}:1}:1}:1y:1x90t8.r8-r8-q8-p7,o6+o6-n5,l3*i3)i5*g3(d2'm;0KHSKXOo\M[UEFJ;9A22:-47036/06,2:-9D4=J89F41@+/53162780;>-DO/ayGtXsT`KVyA[~F[~F_J_J^I]HOoF?_6icSicSicSicSicSicSicSicSkbSlcTlcTmdUmdUmdUmdUmdUifaÃÅÄéíîõùüþþÿÿþüýøõþãÐÞʲ§ efGGJ/HC0J92N66=?<LDBkiÖ¯ªà¤Äe_ÙOOéBIÚEGÚDFÛACÚ>AÚ>?ÙA@ÓB=ÐA;ß@:Ï@8·A79-=/>-=,=*9-~8,}9.|8-|90|90z:1z:1w<4u:2q8/p7.m7-l8-l8-l8-l5.p92j5-g2*e3*_/%`0&h8.NI
TMrXKRL<;D34A04<14:0775664350/6.0;-7D39H52D.-3/.3-45-:<.>H-`wKv_lRYzETu@XyDZ{F_K_K]~I^JMhG9T3icSicSicSicSicSicSicSicSkbSlcTlcTmdUmdUmdUneVneVrts©®Úßâôüþûÿÿýÿþÿþúÿÿø÷þßçñÎÌØ°ªdnKGJ/JG6I@7TJK|{µ°¬ßÜÓÿõêÿÚÐØzzÌKPÎQMÉHCÒFEØDDÖ=?Ø@?ÕA?ÓB=Ù>9ÐC<¹B:<2<0>.=-=-9-}9.}9.{8/~;2{;2{;2z;4p:0o9/l8-k7,i7,i7,h8,h8,m80l7/j8/d2)c3)^/%^/%l=3}VQlOGMA58:,/:*2=/5=27:179668338119..9+2?.7E49H57>6.4*/1&57)>H0e{UxhaPVtBTr@VtBWuCZxF]{I^|JZxFGZF/B.gdSgdSgdSgdSgdSgdSgdSgdSkbSlcTlcTmdUmdUneVofWpgXv{¦®±ÔÞàòüþ÷ÿÿûÿúúüñö÷éñÿçïüàçñÏÆÌ¨yTZ@EL:AL>|v¸¶ÚÐÏðìéö÷ïÿúðÿóê굯¼eT·UH½MBÃD>ËA>ÐB@ÑC?ÎC>Ô@<ËD@³@;<4<2=2=1=/~:/}9.|90{8/|<3{;2y:3x92m80l7/i7.h6-h8.g8.g8.g8.i70g5.h70e4-c4,]1(]1(rF=YLFA81;8/69.4:.5;/69.57,39/39/19.19,.9+/:,3>.9D4;C44:,13&13%=F1mcriNuFOl<Pm=Pm=Ro?XuE]zJ_|LSp@:F<%1'gdSgdSgdSgdSgdSgdSgdSgdSkbSlcTlcTmdUmdUneVpgXqhYipx£ÊÕÙëöøóþúùÿöûÿîúüçûöðÿöìÿñáæÑ¾´¢neVWYNisk«¯¡âÙÒþêìÿòöÿûú÷þööÿóûÿóÿÝÃËm«RBºK@ÂG?ÉE@ÈE=ÆC;ÒD@ÇC?«;7;6<4<4<3=1~:/}9.|90{8/z:1x92v70u6/k90j8/i9/h8.f7-f7-d8-d8-g6/j92i81m>6m>6e90}QHvKB5:349239/36-57,35*35*46)-8(-8(-8(/7(08)/7*08+2:-9B-<C1:<.13%>G4fz_YxVAg>Jg9Nk=Kh:Mj<VsE[xJ\yKIf8175"(&heVheVheVheVheVheVheVheVheVkdZlc\meXidPmlXghc©«ÉÎÑíîðýûüÿþüÿþùùüó÷ýóøùóøúì÷ùáØÜ»¤ªclOivbÅÅÃëëéøøöúúøþþüþþüþþüþþüîÿÿÿýüÝ©¯UMÁH=ÊF:ÉD;ÅE<ÂI4¶K7F3E5C6@4:17/~92|91z7/w7.w7.w8/u6-p4*i81h70h70g6/f4-i70i70h6/k4/m80k;/j@0hI7kXGxgjgV4:039/28.28.17-06,06,/5+/4./4./4./4.05/.3-.3-05//:24@67C74A0<I7UcLIW>ES9Jd?Ke>Id;Kf=VqH\vQYrR=V8(-1$)-heVheVheVheVheVheVheVheVheVkdZlc\meXmhTlkWtup¤§°ÌÖØõúýþÿÿÿýþÿþúþýøô÷îíóçñõçóöåððØÑÒ³¦¦m°·¯ÜÜÚööôýýûþþüþþüþþüþþüþþüüÿÿÿûúÿûóÿÚʸyg£J:¿QDÂH=ÇC7ÁH=¦?6A:@:@9{?7z>6w<4v;3t;2s:1p:0p:0m9.k7,m82l71k60i70i70g6/h70j92i=4h<1iB3fE2iP<obOt\]K28.28.17-06,17-06,06,/5+.3-.3-.3-.3-.3--2,-2,.3-*5-,8.1=16B4:G5?L86D->L3F^>Jb@H`<F_8UmI^vVTkO2I/',0$)-heVheVheVheVheVheVheVheVheVkdZlc\meXkiTnp[|~y¯³¼ÝçéûÿÿüýÿÿþÿÿÿûúúòèëàÞäÖçìÖëïØêêÒ×ÓºÆÁ¼°ÐÍÈáàÞññïüüúþþüýýûþþüþþüþþüþþüÿùüÿÿýøÿûóÿôýüèÊ¥¢WD³O?Å@9ÃD>°<<::>=@>tC>mE=q?6q?6p>5o?5m>4k<2h<1h<1q62p62m61i70j92f:1e:1f>4aD6dI8cJ6_K3aR;ojTmAJ528.28.17-06,17-06,06,/5+.3-.3-.3-.3--2,,1+,1+-2,,6.*4+,6-/:,1<,5@/2>*5A-;M3DV<H[=K^@XkMbtZPbL+<*%*-"'*heVheVheVheVheVheVheVheVjdVkdZlc\lfXmkVjmXovo§®ÚãèùþÿýþÿþýûÿþùõõëæêÛâé׿ìÐèëÐçåÎÜÕÃÚÐÆêßÛùíïÿõûýýûÿÿýþþüþþüþþüþþüþþüþþüÿûúÿÿýóÿÿîÿÿóÿúÿÿïìȲs[µN?µK>³H@¢<8<8
@9uC8nF:q?8q?8q?8p?8qB:m>6j>5k?6r73p62m82i81e:1c?3aA4^A3XK8g[E_S;ZS7[W<oqYjt\1?(4:039/28.28.17-06,06,/5+-2,-2,-2,-2,,1+*/)*/),1+*4,*4,+5,,6+-7,4?18C36A12?-9F2AO8IW>WeN`mYKXG)5)(..%++heVheVheVheVifWifWifWifWkeWle[md]mgYnmXkpZmwo¥ÇÐÕðõùýþÿÿþüÿÿ÷ùùíòöåèðÛëðÐçêÍäßÌÞÔÊçÙØøéìÿõùÿúÿþþüþþüþþüþþüþþüþþüþþüþþüýÿùýÿþýþÿþýÿÿýÿÿüöÿþìÿôÚ×]DWAO>A1
@1y@/rA0t=8u>9t?9t?9r@9p?8o>7n=6l:3m<5j>5e?4aA4aG8M:)F5#LN6HH.[Z>_^@\_Bsy_MW?0>'6<25;14:04:04:039/28.28.16016005//4.-2,,1+,1++0*,3,+2++2+-4,-4,1809A6@H=8C34?.5A-BN8Q]IZeUDNC-7.)/+(.*heVheVheVheVifWifWifWifWkeWmd[md]khYkmWjr[lyp¥ªÊÓÚñöúýþÿÿþúþþôùúêðõßäìÔÝáÀÚÚÀÞØÊæÛÙõéíÿôúÿùüÿüüþþüþþüþþüþþüþþüþþüþþüþþüöÿüýÿþÿúÿÿ÷ÿÿøÿÿúúÿÿöøÿðÿüãýåÍʨdMP:zF0xE0p@,tB9sA8o?5n?5m>4j>3j>3i=2eA5dB6aD6[D4WF4aVBQK5HC->G,>D(DG*abCmmQkoV>C-9B-9?58>47=37=38>48>47=37=36;55:449349316005/-2,+0**/)*/)*/),1+/4.,1+160=B<?L;<I74A-2@)CP<MZIAMA0<2.5.,3,gdUgdUifWifWifWifWifWifWldWmd[md]khYjnWhrZeuk¤¨ÉÒÙðõûüýÿÿÿûÿÿöÿÿðôùâãìÑÖ׸ÐιÜÕÍðåéÿöþÿýÿÿþüþÿùþþüþþüþþüþþüþþüþþüþþüþþüúÿÿýþÿÿþüÿýùÿûõÿýøþþüýÿþþúùÿýùÿûñÿòáäϼº¡{ieTtP@iH7cB1dE3bC1aD2aD2`E2[J8[J8WJ7RJ5PK5qs[aeLEK1<F+@I,CH*MN/xw[`^GGF2?@.9?59?58>47=38>48>48>49?5:?99>88=78=77<65:4382160.3/,1-+0,,1-,1--10/321548G4?N9<K46E.7F/?N;:H9.</-4,+2*fcTgdUifWjgXifWifWifWifWldWmd[md]khYimVgs[fvl©ÔÝäõúÿýþÿÿþúýýñüýëðõÞÜåÈÐϳǯÓÌÆîåêÿùÿÿþÿýÿúûÿöþþüþþüþþüþþüþþüþþüþþüþþüÿúÿþþÿ÷ÿùôÿòõÿóûÿúÿüÿÿúÿÿúÿÿüÿüýÿúýöÿÿóÿÿïÿûìÿöëÿíÕűbP8[I1[K2[M3\N4]O5VP:TO9QO8KM5MQ8ZcHEO4=J.AK0GP3IL/[Z<ieJ^YCZUBLI8<B8<B8;A7:@68>49?5:@6;A7;@::?9:?99>8:?9:?99>89>86;7273.3/-10-10-10-12-12):'7I3<N4:L27I1;M79J8.>1.5-,3+ZgM]iQckThkXghVifWkeWmeZjgVkg\jf]hfYgjUdp\n}x¨¹ÃÚáçôùüúÿùûÿñøùéóòÞêçÔÚÕÂÌ¿®½±¥Ç¼ºâØàûõÿÿüÿüýÿüýÿþþþþþþþþþÿþüÿþüÿüùÿýúÿþúÿýüÿüýÿþÿþüýÿýüÿûøÿòêÿòéÿûÿÿþÿþÿûüýÿþþÿÿýÿÿþòÿþäúøß¸´SN0QK+UO/TO1SO2QP4QM2PP6KO6EM5GP5@I*CJ(HN*RS1TU5]]AZZBYW@[Y@YX<UT6MG1HC0B?0??5;>58@58C57D3:B78@58@5:B7:B7:B7;C8>F;9D<9D68A06<2284/;/1D&=T&Be-B^6=S><M;?Q9I\>FZ>1H.,3+*1)ZgM]iQckThmYjkYliZmgYog\khWjf[ie\hfYehSdp\v
£´¾ÓÚàóøûøýùóöëìíÝÞÝÉÒϼÅÀµ¥É¼³ÚÏÍïåíý÷ÿÿüÿüýÿýÿþþþþþþþþþþÿþüÿþüÿýúÿüùÿüøÿýüÿûüÿþÿÿýþÿþýÿùöéÜÔõçÞÿûÿÿÿýþÿûüþýýþÿÿþÿÿþòÿüâýûä·³QL/RL,UO/UP2TP3PO3QM2NN4KO6HP8HQ6EN/KR0U[7`kA`ovUQU:OO7PN7SQ8XT9XR<QL9HE6AA7;>59A67B47D3:B79A69A6:B7:B7:B7<D9>F;=H@>I;?H7=C9<B>5A5=P2Vm?Z}EQmE;Q<2C1>P8PcEQeI:Q7180-4,YgM]iQdnVjo[mn\mk\nhZoi]liXieZie\igZfiTdp\t~§±ÊÓÜìô÷ñ÷óéìáÝÞÎÏ̹ÆÁ®½¶¤ÐóãÖÍóççÿöþÿùÿÿüÿüýÿýÿþþþþþþþþþþÿþüþýûÿýúÿüùþùõÿüûýùúþüýÿþÿÿýüÿú÷øëãýïæÿûÿÿÿýþÿûüþýüýÿÿþÿÿýñÿûÞÿÿê»¶ TN4UN1UO/VQ3TP3NM1OK0MM3KO6JR:KT9NW8U\:djF£m°vhqRKO6KJ5OJ6TM:UO9RM:LI:EE;=@79A67B45B1;C8:B7:B7;C8;C8;C8=E:?G<=H@>I;>G6=C9:@<6B6=P2Qh:Tw?Lh@3I4+<*6H0L_APdH:Q7,3+&-%
\ No newline at end of file
diff --git a/testimgint1_4.ppm b/testimgint1_4.ppm
new file mode 100644
index 0000000..c4eda85
--- /dev/null
+++ b/testimgint1_4.ppm
@@ -0,0 +1,4 @@
+P6
+57 38
+255
+0/-51.72.92,80-80-80-80-5-*4,)5-*5-*1.'41*63,96/B<0H@3JA2MA1YB4C3«?2ÀF;æCHñAD÷:@Ù?=³@-°?-¦?,@*>.=+=,?+?6¸B4±E9_>/;5572/62/41,.0-0/-5,-=13yD@`l±XTPGbopubcSYSa,,,0/-2.+3.*2-*2-*2-*2-*2-*1,)3.+3.+41,41,52-850<5-@7.C9/I=1JG6fA/;*¢E6ÊE>è@?ò;=ÁB3ª?-¨?, ?.?+>-=,<-=.B3ÂA;ªPHPF<@6494043.02--3/02/21/3/.P5*sTY|~»YXJ>fDCUMVQQYNaXQ,-/---.-+/+(.*).*)/+*/+*/+*0,+1-,1-,1-*2.+1-*40-:2/=4/?4.E80J=5V93r7/;1¦A5ÇD:ÙF?ªC2@.=-=-=,<,;-<0B7H;¶OJ¡}mhseKI=77-01+/0+.0-//-00.00.:/7jhiÄv¶hoiyxj{k`Z@,03./1....-+-+,+)*+)*+)*+)**(),*+/-./+*.*)0,+3/.;23<21<1/@2/?82A83X6-;.>4A3C6?3?-;-<.;-
9)9+>5
IAKE¨nc¥
|yZfR?E710+2)*1++1++1-,1-,6,-cqMºÆ§²«g~bOO312,32-74/72.7/,3--/-.,+0/(//)+.-+/0*///2.+70*=3*?6->5.<1-<1/D1+B0.D,*\4,x>0:3?2A3<1>.<.;+w;0v>/C:MB\X~x¨^bWpS>D:.-+-)*1(-/*0+,10,+^cLl¨u°}¨w~y`r\?A4671872=:5?:6?74;629527327./50-41,43.540;62@7.G:1G=4C90?61?61D65M34A9.K8*m61==A;=7B1
;.<,{>,¨KFG>tM<VFxwX§xh~
¡{pxpasYGD39.*./)1-*=&,H@5clQm^rerjw ttqZsUD;4893=<7B?:D?;FA;F?9F?7D;4B92B92<7194.96/@9/F<0M@0M?4H;2B90?;2\:8EK@7¤EAD6¥=2¤E3ª@2©<AD@y=2¶:DÔ@>ªVLjeG
kPæOVÿ+Iý;UôL]äWgØclÐ`lÐQfÁL_DKR3.E=2cZ9y`sdxf¤{|YrRURC671;:5B?:GB>HC=LE=MC9L@4H>2D<1A:2<71<8-C;0K?/O?/M=0F:.A:0A?3¨EHÌ17 <%°=+¥:0¶A8¨</»?5Ô<1÷.4â=7æ42Ö6*¾NC]HÖ[Vè>AÑFAô>Jü5Hþ9Uÿ;`ÿ?mûArÿFjùTr»WalLA~u©«¨«³µ¾¼¿ÚÒÏÙÏ×§©¦`w][eJ10.762<<4BB8JH<NL7PPHb`xWNQH?@A96=82>71>;6F?5P?-A>-D65>;4h;5«;-¡:'«>*»9+©;,¬>-·?/Á;/Ñ7+Þ7.ô.+Ú7&Ù6#Ë=1ÚFBñADÒA><.ÇG<ó@FøDMýAYÿBjýIxÿKwùVuóJknnÓ»¯îëòþäýÿóüýøõöíðÒÎÍ74/52+:70@=4OE9TK<ecqÖÚ||®`^vECH<;@B<,G@-EB;I?G@IHLB8B;ª?->+¸9*Í9/È91Ç9/Î:0Ñ7-è1)ð/*ò/)Ö7"Ö5#Ó9/ÜMEÅE:»<)»<-ÈA;ÛIJïDJüK]úEdÿNwûUyýSnù\mß`iÙÿööýüÿÿûúÿûøÿñôêßÝäâÕÐÙÔC?4<8/84+>93MC7WJ:a\p欶þ®µû ãvtµbXGDWD@=[OSs§f¾IR³<(:(º;,Ì9/Ý:3Ú72ä=7Ý90äD8ñ91ú**ì1,Ö2&Ê<(Ó:,Ú?:×EE½<'Á9+ÎH?ÅIAßKGæOTøWiþQoÿTwÿXoý\kíWc§unóÞÛ÷ÿýÿüýýúõûðîåØÐÿüèæìèPJ<IC7B;3A:4GC8SG1[T[Ωªü¬¯ü¥©óåÍuw UgØHQåDIÇA8àB?Ï>9Â@2Ë=1Ô7.Ù5,Û:0Ú6,Ô4&Ì9%Û;/ü47ç55á55ò21Ü6*ßK?ÖDEÔ=6Ã;/½@.½>-ÃE9ÎMHôdmúXmû[sëtxôftÈbaOßÂÄýûþÿúÿúÿöÿþ÷ôîàÿÿãööêXO@TK<NE6LC4JF:VK5]V]Ãì¥ø¦ç¤èÚÁnä=Dâ?BÙ=AÌB?è=CØ:9È?7¿A3Ä7-ß63Ý7+Ý7'Ã8#Æ8,Ú91Ë8&Ý2(à-0å/,Õ8'ÔC2ÝD?æTTÍ:0Á:'·>-´<.¾@2éf^ïijóboöllþbo¶[iFãÑÇÿüùúþýßýåôýìÿøè÷ïÚþýùZN>YM=WK;WK;SK>YL9ZRPsr¶Ð
Àqs¬¤Ymù7OáFAí>KÒDBÁB9Ô97ÌC9Á9)¾;'Í:*â6,ó04ô02á34æ2>í/1Ë8(Ñ9+Ý<2ÊB2Å9(×:1ã03Ö71Ò>2ÇC6¯;,¬<.®=-Ú_Xïlr÷nxÿpwûNb½~yxa×ÖºãñØÃÚ¾¢Í»ÔäãÎêÙÑßÑÈZM<ZM<XK:ZM<\L=^O<[OC]RVh`
yº|³¥i½>5ÝC9ö<?âAG¸<2¸@2×96ËC7Á:'È;)Õ5'ì7.ç2'ô*&õ&.ÿ8ò.:ç6<ó08ô-0Ü:5Ý>:Ý;8×4+Ç8(Ç:0ÔJ@È;2Ë80¼:,ÊOH÷xüyÿkxÿE`¶mdpXhpczlµw»¤´Î½µ¯¥¤ZK8ZK8ZK8\M:^K<_N<_P=aP>cQ_uqºòZiÿ9PÓCCæAEÑB<¯;,»=/ç9:âH@ÏG9Ì8,ß6/í1/ü,<ý(<ð,Dü/XùS_ñIZÛ4>´;*ÍE9ÓD@ÑA9Ê9(«<(¹=1Ø?:ë51ù-.Þ7.Å@7øz{üzýdvùA[VEiPh~¥p©m¬oµnyɰ §¹]L8]L8]L8]L8^M=[O?^RFfSOkZd|¹§¸çwsôP[ñALÝ:;Ã?2>-Ç<5Õ7.Ú9%äA:Ñ=/ê86û7Eö*-õ)*ì)/ó=LôT\ß@=º?0§8-¹>9×CCÐA9Ò91Ï:6Ý>:Ü;3ò00ô02ë2-Â:,î{xþw
ÿQnôAaqM?jPz¢f{£g}¡c}¦j}a²p¥[gg_N<_N<_N<_N<`N6\SNqlxqt|ªÒ¥Â¶|ÏSIëGHä:;È@2´91ÉYMÃ?3Ý6-â70á?0ì1,ú9<ôNRå<?åBEÓ:=à:>ã4;ðW\ù_kàRNÞ@?ÜG@Ø93û+9ü7>Ý4-ê5.ù.2î1-Â8+çtqûj{ÿAcÓCZWQ9mVwbr[w_y¤_x§Yªd~las]\O>^Q@_RA`SBaTNnjwy²mq¸ÜÆÃ¼äÞ¢ØÑ¬xÃe[ìRTè:;Í<7¸G9ÐVIÕ4,å>8Ü6*è0(ã60ÚACóS[úZdø]cú2<ô1?ùU^üXaá<8â64Ù<3â94è8:å63Ý6-ð0+÷03ñ1.Ì9/ädeþWsû?bEHCG0bwLpVjOqYtVoOgKNh8G^4UH8]P@bUEdWGpksv«cj²|Ë¥«ÛÆÇÙËÅDz¦°yxthbÐoiübbîE@ÐB8Ã>/Ð=-âFGÜ;3ã60Ì:-Â=,Ë;;åMYèSYã:7öCIä7;ù59î73é30ß<3è64ê67æ40Ü8,ì1(ñ33ï2.Ò80ò_gûBdêCaaK=RG5LZ7g
IeFjSjN`G[|E]tHZuB@@6TG>^SAjgrol`` qrÂáÓÓ˱n_drWL¸YSãtmözxÛKCÁ8&É:*Õ9,Ò9+Ú8-Ç<)Å;1Æ<2ÎD:ÏF<Ù7(ø*6ÿ'?ÿ!<ÿ#9í6;Ý:5ç85ì44Þ6-Ú9'Þ7$ç5+ã7)áB>ÿQjÿ:a;F8<+BA-_h=g~RcBkKjIfKdIeFcC/4-A<8OJDabwYYfh³~×
ÖÌÕÅ}xxUS^bG¹SQèagìqi×K>Ã<(Ì9)Ô6+Ä;)Ô@2Í9+É:,Ê8+Ò;0Ò:/é24ù/=ó1<ø/9õ1;â66Þ95é77ò59Ý6.Ò9)Ô9'Ê<$Ì?-÷MVÿ:dÜB\F678:-de;¥¾
s]fCqSjIiNf
IhGlN-0'34/@B7TT`b_Ôê~ÍÇÆzndbd_Km\H[DêQTàA=Û7-Ñ8&Ý5,Æ7)À=+ÔB5Ç9+Ç:)Ì6(×6,â92ð5<ì2=êFGïB>ä86á96å99ë8<î68Ö92¿:)½<)¸:$Ç=3ÿG^î@akC;><0[J8²o±~YuEeAhKeDhLiKjIt¢WA?2??5EG/RPC]]Qzw¢
Èyv£xt§yqob\n[Ll\Mu^N¤L@Ø7/á4.Ý5(Ì<$Õ9*³:'Æ:-âE>¸=+Ã;-Ï;1Þ;6ç98é:7ïLMÔIDÙ;8á:4æ66ê7;è7=è8:Í=4®;)¥:&:*ÌOMçHZ£]SHG3R^6v\bWdHGT6iDcHiHlPnQrOv©ZZQBZQB[RC_VGd[Jj_]qeij^`ZWNYSGaYFi^Hp_O¯RK³?0Ë80Û7-Ù7,Õ7+Ô8+²:*±9(Ê7-ÓD6Ù;8à<:í49â96¹;-´;*Ð@5í76é6:å95â92ã99Ü<<¸<2<*8&:,ÁUUVO_VpI`Rd:>D6<>1AM7jHlKnTlJq¡Mu¦W]Lf]Nf]Nf]Ng^OiaLiaNiaLhaG`[HOL;JK9ORA^THUQß;<¹@+Ô8)Õ9*Ò9)Ñ:)°<-;"º<-Ñ80ï7?Ü9:Ø58Á61§>+§<(¼:,Ý;6î85ç<4Ú@8Í=<®<19(<(8%?/SGZN]VcmJ6A08?7>>29;.>J4mKqPqOsOz¦[bJXHi`Qi`Qi`Qi`Qj_]j`WjaRjaRiaL]XEFI8?E7AI4wT>ÛVQàA>Ë9*Ì:+Ï;-Ñ;-¾;3¤;(ÈB7âE@ÍB?¡@0A1@-;+=,;+¬:/É<2É?4¶</6-<,:+|:*u7(D:PFUO]YdoE@M1U^I@C(9;.>J4nLqPp Lz¦[hOdMY~Ji`Qi`QkbSkbSlbXldQldQlbVnbThaQWQAHE4MG/¬BBÉIHæ^`ÒG@ÒE>×FAÛGCáGIÝIGçACáB?Ä>;A2=0<2;3=1};-;,:/9,:);,8*{5)v6,q9,M?UHSPn]MP`;YoA;L*:@49;.<H2g
ErQr£RjR`IeGWyGi`QkbSjaRjaRkbSkbSlcTlcTqaTldYpm^lfPSK4yK>A=©HBÀHGÐB>ÎE=ÙCDáCDàECÞC?ßB=ÄA9:0?381;,:,9-~:/}90|90z:0x:/t8.p6+l3(p:.QJRN[LbiJNd>HW89A,=>04<1<?,arFrSs\]FbK`IOq?haQjcSibRibRkbSkbSlcTlcTnf[þÎÉÃxHM9<G6=>6V?7·PSØJIàEAÞDFÜDCÖE@ÑG=ÔA: >1?.;,:,9-~:/}:1y:1v7.s9.r8-p5-l3*i3)k7,OIZO\UE@G74:,6>/<G65A-284:</Vg=tU`I\E`I^GIj=icSicSicSicSkbSmdUmdUmdUßãäúþÿÿýúîçË¢NQ6K>6XSP¼©£ì¶¬ÚUXÓIGØBCØ@?ÓB=Õ@:©>4
=.=,9-|8-}:1{;2s:1m7-l8-j8-l7/g5,a1'd5+~QKSG94?/5;168516/1=/7F307046)Q`?oZUuCWwE\|J\|J>V<gdSgdSgdSgdSkbSmdUmdUpgXÞéëöÿúùûí÷úéåßÅ~hQYL´°§ôææûúõüëáÕsºK@ÉD?ÊC=ÎC>¤=8<3=1~:/{8/{;2w81j8/i7.f7-d8-i70i81e6.qE<A>767/58-57,08+08+.9+2=-9B146(TbIWzPNk=Ol>ZwIVsE,6.heVheVheVheVhdXmd[khUÉÑÔúúüÿþúõøïõ÷êååÉtááßûûùþþüþþüúÿÿç·ºTFÃI>ÀH8C6A7;3z;2u9/s9.o6+j81i70h6/h70j92j@2jUBtq^39/17-17-/5+/4./4..3-.3-.:04@2BO;AO6Ic@Hb;YsNF_B&+/heVheVheVheVjdXmd[mlXëóöþþþûûóäèÙèìÓâÝÇÓËÀìãäúúøþþüþþüþþüÿüýôÿýñêØ»xe½G=¨?<?<qE<q?8p?8n?7i=4q62l71f;2c?3bM<_O8fbIV`H39/17-17-/5+-2,-2,,1+,1+*4,-7,2=-5@/;J3HX=]mS<J9%++heVheVifWifWkeYmf\knYÜãéþþþüüðíòÜâåÈáÙÎôèêÿøüþþüþþüþþüþþüûÿüÿûÿÿüýÿýêß·¦lXE3uB/t?9q?8o>7m>6i>5cA5_J9L?,DH/XX<jmR=G/7=36<26<25;1382271/4.,1+*1*+2+.5.9@89F57D0N[I8D8+1-gdUifWifWifWldYmf\hpY}àçíþþþþÿñêðÖÏͶãÛÙÿúÿþÿúþþüþþüþþüþþüþýÿûÿ÷ýÿ÷ÿýÿÿüÿÿûòèÝËÊ´¦¨xaH2^H1^J2XM9QL6Z\DJS8@J/NN2ieLJI5:@69?58>49?5:?99>88=75:4051,1--10/325G19K39K53D4-4,\hPfkUjhYnfYkg[ieZemXäìïùüóìíÛØÓÀÅ·ªÝÒÖþøÿüýÿþþþÿþüÿýúÿýùÿüûÿýþÿüùøêáÿýÿýÿüþýÿÿþëØÖ½RK.UO/QP4PN5IO5EN1KQ/agC]`CTT<VU9OJ6CA49?58C59A69A6:B7=E:<F;:B54>5AU0Kk<:M:EX<?V:-4,[iPgoXlm]nhZkg[ieZemX
ÚãêìñëÖÕû©ÚÌÁøíñÿüÿüþýþþþÿþüÿýúÿúöþúùÿýþÿüùûíäÿýþýÿüþþÿÿûçÝÛÆTM1VO2PO1MK2LR8LU8^dBªsxaKM7SL:SN:IG:;A76A3;C8;C8;C8>F;>H=<D77A8H\7PpA/B/AT8E\@)0(
\ No newline at end of file
diff --git a/testimgint1_8.ppm b/testimgint1_8.ppm
new file mode 100644
index 0000000..11dca13
--- /dev/null
+++ b/testimgint1_8.ppm
@@ -0,0 +1,4 @@
+P6
+29 19
+255
+0/-50,4/,4/,2-*3.+30+74/B:/J>0dC2¥A2âBBá=;®?,@+>-=-¬B5F;:5232./1.5//uKLkj¤SNdci_\VX-.0.-+,*+,*+,*+.,-0,+2.-<20A4.H94w9.¦A5³C7>,=,;,A8¤TKsGK<0/+/.,0/-PMF§~wwWV:45/:728302012,.10,32.?5,B8/>3/F21K4,;4?6>0<-C8M@xc mfFJ<1,)1+-NO?yh¥vkg@>29:4C@;GB<I?5D<1<71=9.L?/J<1@<1>A?1§?4¬@3Â::¾:8ÃG?bMé?Hù>QïKcçLlÔJanE?m£±¹¬wuX[F43/==3OI9kllgIDJ>;6H@3C?<a?6¨=+º;,¹;/Å;0â4+å3'Ô8+ÛFB½=0ØDB÷ESþHpýRtÚ]kèÎÍÿóýþôóÎËÆ°·¯EA5=82OF7wy °ýÜihKQ¸WhÈA=¼=.Ö8/Ý82Ø:.ð50â3.Û7-ÚEAÅ;.ÃC6ÖKHøYmû_têhp¶þüÿýúõ÷ðÞëîçYM?SG9SJ9ljÜϽfå@DÍB?Ø=;Á=0Ô7.é3/Ô51×6,Ú6-Ò9+Û<6ÖA:»=.³=/èfdøksÛns£¨éñäÌçÈñè×îçá[K;[K;^M=^PEqgºpÛ?@ä@A·=0Ú?:É=,ã5,õ,2ù'@ð@KÝ34×?:Ó:2½;-Ø=8×6.à`]þp|ÑRYx^zk´u²¸£¢ª^M;^M;]P@kalxy§¹éJNÔ<7¼C8Ó9-Þ>2ó6:ñ7:æ9?å@DÒKHÓECÖ?8é6:æ5/ò00×XQÿ\t£IKr[x`z¨`
¦oYi^[N>aTDlhqvº°°ÒÎÇukçWVÑB:ÎB5à=8Þ6-×CAðV^ñ8>ôGMæ74á:4è66å4*ò21ÝMLøFhcG;bzJjOkN\yCPj;A>5^Z[ccÔÑ´n\RÎa^å`YÇ:(Ï9*Ñ;,È:0Ð@7í04ú)<ò09â96ç53Ø9&Ù9)öGX°;NEG1w\iHiJfHhJ780JKComÊ|¯sgkm^K¼LAß8/Ô8)¿:+Í?3É:,à93ì<?âC@â96è8;Þ95´;*º@3ÞK[PI6yYcxQgFiJlNv¦Z`WHbYJh_PkaWXUFXUBWLÅ=1Ø8*Ò9)ª;(Ê<0à::Ú65¯<*Õ;3è96Û<8·;39(H=\QdsHBI7=D2mLoOpSWHi`QjaRkaWkbSg^MHI9kJ9ÛONÎ@6Õ@9ÈA;ÝB>²@6?0<.:,¬<0:,9+v8+NAXPTb>CK4;B0nMqTdKTyFjaRjaRkbSlcTumbjZJnC<¦GC×FCÞDDÙD>±?5<0:,~:/y9/u9.p6+l6*SL`XE?M4:A/6<0gJdMaJIj=gdSgdSlcTneV²·ºûýøÚØ¿[ZH¯¤¢ï½¶ÎWOÐB>¼?9<0}9.z:1m9.h8,i70g80RD;4:.28.2?.39-ZtMSp@[xH1B2heVheVkeYy{pëïòõöîèêÔµ¶¨õõóþþüöîëËq°D:?9u<5o:2l71f:1eE6gbN28.06,.3--2,/90;G3EZ;NbG%*-heVifWlfZtqîòõô÷æÝÚÉý÷÷þþüþþüþþþÿþùáÆ»«t{UHeD5]F6TN8JN3VXB8>47=36;5271-2.1628G2=K:+2+akSliZjfZwzéïï×ÔÃÜÑÍýüÿþþþÿüùþüýýôïþþþÿýöxTO2LN6OV5r~VRP9KH79A4:B7<D9=E8=L5AZ:CW<*1)
\ No newline at end of file
diff --git a/tjbench.c b/tjbench.c
new file mode 100644
index 0000000..f28780d
--- /dev/null
+++ b/tjbench.c
@@ -0,0 +1,898 @@
+/*
+ * Copyright (C)2009-2011 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:
+ *
+ * - 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.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <errno.h>
+#include <cdjpeg.h>
+#include "./bmp.h"
+#include "./tjutil.h"
+#include "./turbojpeg.h"
+
+
+#define _throw(op, err) { \
+ printf("ERROR in line %d while %s:\n%s\n", __LINE__, op, err); \
+ retval=-1; goto bailout;}
+#define _throwunix(m) _throw(m, strerror(errno))
+#define _throwtj(m) _throw(m, tjGetErrorStr())
+#define _throwbmp(m) _throw(m, bmpgeterr())
+
+enum {YUVENCODE=1, YUVDECODE};
+int flags=TJFLAG_NOREALLOC, decomponly=0, yuv=0, quiet=0, dotile=0,
+ pf=TJPF_BGR;
+char *ext="ppm";
+const char *pixFormatStr[TJ_NUMPF]=
+{
+ "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "GRAY"
+};
+const char *subNameLong[TJ_NUMSAMP]=
+{
+ "4:4:4", "4:2:2", "4:2:0", "GRAY", "4:4:0"
+};
+const char *subName[NUMSUBOPT]={"444", "422", "420", "GRAY", "440"};
+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;
+
+
+char *sigfig(double val, int figs, char *buf, int len)
+{
+ char format[80];
+ int digitsafterdecimal=figs-(int)ceil(log10(fabs(val)));
+ if(digitsafterdecimal<1) snprintf(format, 80, "%%.0f");
+ else snprintf(format, 80, "%%.%df", digitsafterdecimal);
+ snprintf(buf, len, format, val);
+ return buf;
+}
+
+
+/* Custom DCT filter which produces a negative of the image */
+int dummyDCTFilter(short *coeffs, tjregion arrayRegion, tjregion planeRegion,
+ int componentIndex, int transformIndex, tjtransform *transform)
+{
+ int i;
+ for(i=0; i<arrayRegion.w*arrayRegion.h; i++) coeffs[i]=-coeffs[i];
+ return 0;
+}
+
+
+/* Decompression test */
+int decomptest(unsigned char *srcbuf, unsigned char **jpegbuf,
+ unsigned long *jpegsize, unsigned char *dstbuf, int w, int h,
+ int subsamp, int jpegqual, char *filename, int tilew, int tileh)
+{
+ char tempstr[1024], sizestr[20]="\0", qualstr[6]="\0", *ptr;
+ FILE *file=NULL; tjhandle handle=NULL;
+ int row, col, i, dstbufalloc=0, retval=0;
+ double start, elapsed;
+ int ps=tjPixelSize[pf];
+ int yuvsize=tjBufSizeYUV(w, h, subsamp), bufsize;
+ int scaledw=(yuv==YUVDECODE)? w : TJSCALED(w, sf);
+ int scaledh=(yuv==YUVDECODE)? h : TJSCALED(h, sf);
+ int pitch=scaledw*ps;
+ int ntilesw=(w+tilew-1)/tilew, ntilesh=(h+tileh-1)/tileh;
+ unsigned char *dstptr, *dstptr2;
+
+ if(jpegqual>0)
+ {
+ snprintf(qualstr, 6, "_Q%d", jpegqual);
+ qualstr[5]=0;
+ }
+
+ if((handle=tjInitDecompress())==NULL)
+ _throwtj("executing tjInitDecompress()");
+
+ bufsize=(yuv==YUVDECODE? yuvsize:pitch*h);
+ if(dstbuf==NULL)
+ {
+ if((dstbuf=(unsigned char *)malloc(bufsize)) == NULL)
+ _throwunix("allocating image buffer");
+ dstbufalloc=1;
+ }
+ /* Set the destination buffer to gray so we know whether the decompressor
+ attempted to write to it */
+ memset(dstbuf, 127, bufsize);
+
+ /* Execute once to preload cache */
+ if(yuv==YUVDECODE)
+ {
+ if(tjDecompressToYUV(handle, jpegbuf[0], jpegsize[0], dstbuf, flags)==-1)
+ _throwtj("executing tjDecompressToYUV()");
+ }
+ else if(tjDecompress2(handle, jpegbuf[0], jpegsize[0], dstbuf, scaledw,
+ pitch, scaledh, pf, flags)==-1)
+ _throwtj("executing tjDecompress2()");
+
+ /* Benchmark */
+ for(i=0, start=gettime(); (elapsed=gettime()-start)<benchtime; i++)
+ {
+ int tile=0;
+ if(yuv==YUVDECODE)
+ {
+ if(tjDecompressToYUV(handle, jpegbuf[0], jpegsize[0], dstbuf, flags)==-1)
+ _throwtj("executing tjDecompressToYUV()");
+ }
+ else for(row=0, dstptr=dstbuf; row<ntilesh; row++, dstptr+=pitch*tileh)
+ {
+ for(col=0, dstptr2=dstptr; col<ntilesw; col++, tile++, dstptr2+=ps*tilew)
+ {
+ int width=dotile? min(tilew, w-col*tilew):scaledw;
+ int height=dotile? min(tileh, h-row*tileh):scaledh;
+ if(tjDecompress2(handle, jpegbuf[tile], jpegsize[tile], dstptr2, width,
+ pitch, height, pf, flags)==-1)
+ _throwtj("executing tjDecompress2()");
+ }
+ }
+ }
+
+ if(tjDestroy(handle)==-1) _throwtj("executing tjDestroy()");
+ handle=NULL;
+
+ if(quiet)
+ {
+ printf("%s\n",
+ sigfig((double)(w*h)/1000000.*(double)i/elapsed, 4, tempstr, 1024));
+ }
+ else
+ {
+ printf("D--> Frame rate: %f fps\n", (double)i/elapsed);
+ printf(" Dest. throughput: %f Megapixels/sec\n",
+ (double)(w*h)/1000000.*(double)i/elapsed);
+ }
+ if(yuv==YUVDECODE)
+ {
+ snprintf(tempstr, 1024, "%s_%s%s.yuv", filename, subName[subsamp],
+ qualstr);
+ if((file=fopen(tempstr, "wb"))==NULL)
+ _throwunix("opening YUV image for output");
+ if(fwrite(dstbuf, yuvsize, 1, file)!=1)
+ _throwunix("writing YUV image");
+ fclose(file); file=NULL;
+ }
+ else
+ {
+ if(sf.num!=1 || sf.denom!=1)
+ snprintf(sizestr, 20, "%d_%d", sf.num, sf.denom);
+ else if(tilew!=w || tileh!=h)
+ snprintf(sizestr, 20, "%dx%d", tilew, tileh);
+ else snprintf(sizestr, 20, "full");
+ if(decomponly)
+ snprintf(tempstr, 1024, "%s_%s.%s", filename, sizestr, ext);
+ else
+ snprintf(tempstr, 1024, "%s_%s%s_%s.%s", filename, subName[subsamp],
+ qualstr, sizestr, ext);
+ if(savebmp(tempstr, dstbuf, scaledw, scaledh, pf,
+ (flags&TJFLAG_BOTTOMUP)!=0)==-1)
+ _throwbmp("saving bitmap");
+ ptr=strrchr(tempstr, '.');
+ snprintf(ptr, 1024-(ptr-tempstr), "-err.%s", ext);
+ if(srcbuf && sf.num==1 && sf.denom==1)
+ {
+ if(!quiet) printf("Compression error written to %s.\n", tempstr);
+ if(subsamp==TJ_GRAYSCALE)
+ {
+ int index, index2;
+ for(row=0, index=0; row<h; row++, index+=pitch)
+ {
+ for(col=0, index2=index; col<w; col++, index2+=ps)
+ {
+ int rindex=index2+tjRedOffset[pf];
+ int gindex=index2+tjGreenOffset[pf];
+ int bindex=index2+tjBlueOffset[pf];
+ int y=(int)((double)srcbuf[rindex]*0.299
+ + (double)srcbuf[gindex]*0.587
+ + (double)srcbuf[bindex]*0.114 + 0.5);
+ if(y>255) y=255; if(y<0) y=0;
+ dstbuf[rindex]=abs(dstbuf[rindex]-y);
+ dstbuf[gindex]=abs(dstbuf[gindex]-y);
+ dstbuf[bindex]=abs(dstbuf[bindex]-y);
+ }
+ }
+ }
+ else
+ {
+ for(row=0; row<h; row++)
+ for(col=0; col<w*ps; col++)
+ dstbuf[pitch*row+col]
+ =abs(dstbuf[pitch*row+col]-srcbuf[pitch*row+col]);
+ }
+ if(savebmp(tempstr, dstbuf, w, h, pf,
+ (flags&TJFLAG_BOTTOMUP)!=0)==-1)
+ _throwbmp("saving bitmap");
+ }
+ }
+
+ bailout:
+ if(file) {fclose(file); file=NULL;}
+ if(handle) {tjDestroy(handle); handle=NULL;}
+ if(dstbuf && dstbufalloc) {free(dstbuf); dstbuf=NULL;}
+ return retval;
+}
+
+
+void dotestyuv(unsigned char *srcbuf, int w, int h, int subsamp,
+ char *filename)
+{
+ char tempstr[1024], tempstr2[80];
+ FILE *file=NULL; tjhandle handle=NULL;
+ unsigned char *dstbuf=NULL;
+ double start, elapsed;
+ int i, retval=0, ps=tjPixelSize[pf];
+ int yuvsize=0;
+
+ yuvsize=tjBufSizeYUV(w, h, subsamp);
+ if((dstbuf=(unsigned char *)malloc(yuvsize)) == NULL)
+ _throwunix("allocating image buffer");
+
+ if(!quiet)
+ printf(">>>>> %s (%s) <--> YUV %s <<<<<\n", pixFormatStr[pf],
+ (flags&TJFLAG_BOTTOMUP)? "Bottom-up":"Top-down", subNameLong[subsamp]);
+
+ if(quiet==1)
+ printf("%s\t%s\t%s\tN/A\t", pixFormatStr[pf],
+ (flags&TJFLAG_BOTTOMUP)? "BU":"TD", subNameLong[subsamp]);
+
+ if((handle=tjInitCompress())==NULL)
+ _throwtj("executing tjInitCompress()");
+
+ /* Execute once to preload cache */
+ if(tjEncodeYUV2(handle, srcbuf, w, 0, h, pf, dstbuf, subsamp, flags)==-1)
+ _throwtj("executing tjEncodeYUV2()");
+
+ /* Benchmark */
+ for(i=0, start=gettime(); (elapsed=gettime()-start)<benchtime; i++)
+ {
+ if(tjEncodeYUV2(handle, srcbuf, w, 0, h, pf, dstbuf, subsamp, flags)==-1)
+ _throwtj("executing tjEncodeYUV2()");
+ }
+
+ if(tjDestroy(handle)==-1) _throwtj("executing tjDestroy()");
+ handle=NULL;
+
+ if(quiet==1) printf("%-4d %-4d\t", w, h);
+ if(quiet)
+ {
+ printf("%s%c%s%c",
+ sigfig((double)(w*h)/1000000.*(double)i/elapsed, 4, tempstr, 1024),
+ quiet==2? '\n':'\t',
+ sigfig((double)(w*h*ps)/(double)yuvsize, 4, tempstr2, 80),
+ quiet==2? '\n':'\t');
+ }
+ else
+ {
+ printf("\n%s size: %d x %d\n", "Image", w, h);
+ printf("C--> Frame rate: %f fps\n", (double)i/elapsed);
+ printf(" Output image size: %d bytes\n", yuvsize);
+ printf(" Compression ratio: %f:1\n",
+ (double)(w*h*ps)/(double)yuvsize);
+ printf(" Source throughput: %f Megapixels/sec\n",
+ (double)(w*h)/1000000.*(double)i/elapsed);
+ printf(" Output bit stream: %f Megabits/sec\n",
+ (double)yuvsize*8./1000000.*(double)i/elapsed);
+ }
+ snprintf(tempstr, 1024, "%s_%s.yuv", filename, subName[subsamp]);
+ if((file=fopen(tempstr, "wb"))==NULL)
+ _throwunix("opening reference image");
+ if(fwrite(dstbuf, yuvsize, 1, file)!=1)
+ _throwunix("writing reference image");
+ fclose(file); file=NULL;
+ if(!quiet) printf("Reference image written to %s\n", tempstr);
+
+ bailout:
+ if(file) {fclose(file); file=NULL;}
+ if(dstbuf) {free(dstbuf); dstbuf=NULL;}
+ if(handle) {tjDestroy(handle); handle=NULL;}
+ return;
+}
+
+
+void dotest(unsigned char *srcbuf, int w, int h, int subsamp, int jpegqual,
+ char *filename)
+{
+ char tempstr[1024], tempstr2[80];
+ FILE *file=NULL; tjhandle handle=NULL;
+ unsigned char **jpegbuf=NULL, *tmpbuf=NULL, *srcptr, *srcptr2;
+ double start, elapsed;
+ int totaljpegsize=0, row, col, i, tilew=w, tileh=h, retval=0;
+ unsigned long *jpegsize=NULL;
+ int ps=tjPixelSize[pf], ntilesw=1, ntilesh=1, pitch=w*ps;
+
+ if(yuv==YUVENCODE) {dotestyuv(srcbuf, w, h, subsamp, filename); return;}
+
+ if((tmpbuf=(unsigned char *)malloc(pitch*h)) == NULL)
+ _throwunix("allocating temporary image buffer");
+
+ if(!quiet)
+ printf(">>>>> %s (%s) <--> JPEG %s Q%d <<<<<\n", pixFormatStr[pf],
+ (flags&TJFLAG_BOTTOMUP)? "Bottom-up":"Top-down", subNameLong[subsamp],
+ jpegqual);
+
+ for(tilew=dotile? 8:w, tileh=dotile? 8:h; ; tilew*=2, tileh*=2)
+ {
+ if(tilew>w) tilew=w; if(tileh>h) tileh=h;
+ ntilesw=(w+tilew-1)/tilew; ntilesh=(h+tileh-1)/tileh;
+
+ if((jpegbuf=(unsigned char **)malloc(sizeof(unsigned char *)
+ *ntilesw*ntilesh))==NULL)
+ _throwunix("allocating JPEG tile array");
+ memset(jpegbuf, 0, sizeof(unsigned char *)*ntilesw*ntilesh);
+ if((jpegsize=(unsigned long *)malloc(sizeof(unsigned long)
+ *ntilesw*ntilesh))==NULL)
+ _throwunix("allocating JPEG size array");
+ memset(jpegsize, 0, sizeof(unsigned long)*ntilesw*ntilesh);
+
+ if((flags&TJFLAG_NOREALLOC)!=0)
+ for(i=0; i<ntilesw*ntilesh; i++)
+ {
+ if((jpegbuf[i]=(unsigned char *)malloc(tjBufSize(tilew, tileh,
+ subsamp)))==NULL)
+ _throwunix("allocating JPEG tiles");
+ }
+
+ /* Compression test */
+ if(quiet==1)
+ printf("%s\t%s\t%s\t%d\t", pixFormatStr[pf],
+ (flags&TJFLAG_BOTTOMUP)? "BU":"TD", subNameLong[subsamp], jpegqual);
+ for(i=0; i<h; i++)
+ memcpy(&tmpbuf[pitch*i], &srcbuf[w*ps*i], w*ps);
+ if((handle=tjInitCompress())==NULL)
+ _throwtj("executing tjInitCompress()");
+
+ /* Execute once to preload cache */
+ if(tjCompress2(handle, srcbuf, tilew, pitch, tileh, pf, &jpegbuf[0],
+ &jpegsize[0], subsamp, jpegqual, flags)==-1)
+ _throwtj("executing tjCompress2()");
+
+ /* Benchmark */
+ for(i=0, start=gettime(); (elapsed=gettime()-start)<benchtime; i++)
+ {
+ int tile=0;
+ totaljpegsize=0;
+ for(row=0, srcptr=srcbuf; row<ntilesh; row++, srcptr+=pitch*tileh)
+ {
+ for(col=0, srcptr2=srcptr; col<ntilesw; col++, tile++,
+ srcptr2+=ps*tilew)
+ {
+ int width=min(tilew, w-col*tilew);
+ int height=min(tileh, h-row*tileh);
+ if(tjCompress2(handle, srcptr2, width, pitch, height, pf,
+ &jpegbuf[tile], &jpegsize[tile], subsamp, jpegqual, flags)==-1)
+ _throwtj("executing tjCompress()2");
+ totaljpegsize+=jpegsize[tile];
+ }
+ }
+ }
+
+ if(tjDestroy(handle)==-1) _throwtj("executing tjDestroy()");
+ handle=NULL;
+
+ if(quiet==1) printf("%-4d %-4d\t", tilew, tileh);
+ if(quiet)
+ {
+ printf("%s%c%s%c",
+ sigfig((double)(w*h)/1000000.*(double)i/elapsed, 4, tempstr, 1024),
+ quiet==2? '\n':'\t',
+ sigfig((double)(w*h*ps)/(double)totaljpegsize, 4, tempstr2, 80),
+ quiet==2? '\n':'\t');
+ }
+ else
+ {
+ printf("\n%s size: %d x %d\n", dotile? "Tile":"Image", tilew,
+ tileh);
+ printf("C--> Frame rate: %f fps\n", (double)i/elapsed);
+ printf(" Output image size: %d bytes\n", totaljpegsize);
+ printf(" Compression ratio: %f:1\n",
+ (double)(w*h*ps)/(double)totaljpegsize);
+ printf(" Source throughput: %f Megapixels/sec\n",
+ (double)(w*h)/1000000.*(double)i/elapsed);
+ printf(" Output bit stream: %f Megabits/sec\n",
+ (double)totaljpegsize*8./1000000.*(double)i/elapsed);
+ }
+ if(tilew==w && tileh==h)
+ {
+ snprintf(tempstr, 1024, "%s_%s_Q%d.jpg", filename, subName[subsamp],
+ jpegqual);
+ if((file=fopen(tempstr, "wb"))==NULL)
+ _throwunix("opening reference image");
+ if(fwrite(jpegbuf[0], jpegsize[0], 1, file)!=1)
+ _throwunix("writing reference image");
+ fclose(file); file=NULL;
+ if(!quiet) printf("Reference image written to %s\n", tempstr);
+ }
+
+ /* Decompression test */
+ if(decomptest(srcbuf, jpegbuf, jpegsize, tmpbuf, w, h, subsamp, jpegqual,
+ filename, tilew, tileh)==-1)
+ goto bailout;
+
+ for(i=0; i<ntilesw*ntilesh; i++)
+ {
+ if(jpegbuf[i]) free(jpegbuf[i]); jpegbuf[i]=NULL;
+ }
+ free(jpegbuf); jpegbuf=NULL;
+ free(jpegsize); jpegsize=NULL;
+
+ if(tilew==w && tileh==h) break;
+ }
+
+ bailout:
+ if(file) {fclose(file); file=NULL;}
+ if(jpegbuf)
+ {
+ for(i=0; i<ntilesw*ntilesh; i++)
+ {
+ if(jpegbuf[i]) free(jpegbuf[i]); jpegbuf[i]=NULL;
+ }
+ free(jpegbuf); jpegbuf=NULL;
+ }
+ if(jpegsize) {free(jpegsize); jpegsize=NULL;}
+ if(tmpbuf) {free(tmpbuf); tmpbuf=NULL;}
+ if(handle) {tjDestroy(handle); handle=NULL;}
+ return;
+}
+
+
+void dodecomptest(char *filename)
+{
+ FILE *file=NULL; tjhandle handle=NULL;
+ unsigned char **jpegbuf=NULL, *srcbuf=NULL;
+ unsigned long *jpegsize=NULL, srcsize, totaljpegsize;
+ tjtransform *t=NULL;
+ int w=0, h=0, subsamp=-1, _w, _h, _tilew, _tileh,
+ _ntilesw, _ntilesh, _subsamp;
+ char *temp=NULL, tempstr[80], tempstr2[80];
+ int row, col, i, tilew, tileh, ntilesw=1, ntilesh=1, retval=0;
+ double start, elapsed;
+ int ps=tjPixelSize[pf], tile;
+
+ if((file=fopen(filename, "rb"))==NULL)
+ _throwunix("opening file");
+ if(fseek(file, 0, SEEK_END)<0 || (srcsize=ftell(file))<0)
+ _throwunix("determining file size");
+ if((srcbuf=(unsigned char *)malloc(srcsize))==NULL)
+ _throwunix("allocating memory");
+ if(fseek(file, 0, SEEK_SET)<0)
+ _throwunix("setting file position");
+ if(fread(srcbuf, srcsize, 1, file)<1)
+ _throwunix("reading JPEG data");
+ fclose(file); file=NULL;
+
+ temp=strrchr(filename, '.');
+ if(temp!=NULL) *temp='\0';
+
+ if((handle=tjInitTransform())==NULL)
+ _throwtj("executing tjInitTransform()");
+ if(tjDecompressHeader2(handle, srcbuf, srcsize, &w, &h, &subsamp)==-1)
+ _throwtj("executing tjDecompressHeader2()");
+
+ if(quiet==1)
+ {
+ printf("All performance values in Mpixels/sec\n\n");
+ printf("Bitmap\tBitmap\tJPEG\t%s %s \tXform\tComp\tDecomp\n",
+ dotile? "Tile ":"Image", dotile? "Tile ":"Image");
+ printf("Format\tOrder\tSubsamp\tWidth Height\tPerf \tRatio\tPerf\n\n");
+ }
+ else if(!quiet)
+ {
+ printf(">>>>> JPEG %s --> %s (%s) <<<<<\n", subNameLong[subsamp],
+ pixFormatStr[pf], (flags&TJFLAG_BOTTOMUP)? "Bottom-up":"Top-down");
+ }
+
+ for(tilew=dotile? 16:w, tileh=dotile? 16:h; ; tilew*=2, tileh*=2)
+ {
+ if(tilew>w) tilew=w; if(tileh>h) tileh=h;
+ ntilesw=(w+tilew-1)/tilew; ntilesh=(h+tileh-1)/tileh;
+
+ if((jpegbuf=(unsigned char **)malloc(sizeof(unsigned char *)
+ *ntilesw*ntilesh))==NULL)
+ _throwunix("allocating JPEG tile array");
+ memset(jpegbuf, 0, sizeof(unsigned char *)*ntilesw*ntilesh);
+ if((jpegsize=(unsigned long *)malloc(sizeof(unsigned long)
+ *ntilesw*ntilesh))==NULL)
+ _throwunix("allocating JPEG size array");
+ memset(jpegsize, 0, sizeof(unsigned long)*ntilesw*ntilesh);
+
+ if((flags&TJFLAG_NOREALLOC)!=0)
+ for(i=0; i<ntilesw*ntilesh; i++)
+ {
+ if((jpegbuf[i]=(unsigned char *)malloc(tjBufSize(tilew, tileh,
+ subsamp)))==NULL)
+ _throwunix("allocating JPEG tiles");
+ }
+
+ _w=w; _h=h; _tilew=tilew; _tileh=tileh;
+ if(!quiet)
+ {
+ printf("\n%s size: %d x %d", dotile? "Tile":"Image", _tilew,
+ _tileh);
+ if(sf.num!=1 || sf.denom!=1)
+ printf(" --> %d x %d", TJSCALED(_w, sf), TJSCALED(_h, sf));
+ printf("\n");
+ }
+ else if(quiet==1)
+ {
+ printf("%s\t%s\t%s\t", pixFormatStr[pf],
+ (flags&TJFLAG_BOTTOMUP)? "BU":"TD", subNameLong[subsamp]);
+ printf("%-4d %-4d\t", tilew, tileh);
+ }
+
+ _subsamp=subsamp;
+ if(dotile || xformop!=TJXOP_NONE || xformopt!=0 || customFilter)
+ {
+ if((t=(tjtransform *)malloc(sizeof(tjtransform)*ntilesw*ntilesh))
+ ==NULL)
+ _throwunix("allocating image transform array");
+
+ if(xformop==TJXOP_TRANSPOSE || xformop==TJXOP_TRANSVERSE
+ || xformop==TJXOP_ROT90 || xformop==TJXOP_ROT270)
+ {
+ _w=h; _h=w; _tilew=tileh; _tileh=tilew;
+ }
+
+ if(xformopt&TJXOPT_GRAY) _subsamp=TJ_GRAYSCALE;
+ if(xformop==TJXOP_HFLIP || xformop==TJXOP_ROT180)
+ _w=_w-(_w%tjMCUWidth[_subsamp]);
+ if(xformop==TJXOP_VFLIP || xformop==TJXOP_ROT180)
+ _h=_h-(_h%tjMCUHeight[_subsamp]);
+ if(xformop==TJXOP_TRANSVERSE || xformop==TJXOP_ROT90)
+ _w=_w-(_w%tjMCUHeight[_subsamp]);
+ if(xformop==TJXOP_TRANSVERSE || xformop==TJXOP_ROT270)
+ _h=_h-(_h%tjMCUWidth[_subsamp]);
+ _ntilesw=(_w+_tilew-1)/_tilew;
+ _ntilesh=(_h+_tileh-1)/_tileh;
+
+ for(row=0, tile=0; row<_ntilesh; row++)
+ {
+ for(col=0; col<_ntilesw; col++, tile++)
+ {
+ t[tile].r.w=min(_tilew, _w-col*_tilew);
+ t[tile].r.h=min(_tileh, _h-row*_tileh);
+ t[tile].r.x=col*_tilew;
+ t[tile].r.y=row*_tileh;
+ t[tile].op=xformop;
+ t[tile].options=xformopt|TJXOPT_TRIM;
+ t[tile].customFilter=customFilter;
+ if(t[tile].options&TJXOPT_NOOUTPUT && jpegbuf[tile])
+ {
+ free(jpegbuf[tile]); jpegbuf[tile]=NULL;
+ }
+ }
+ }
+
+ start=gettime();
+ if(tjTransform(handle, srcbuf, srcsize, _ntilesw*_ntilesh, jpegbuf,
+ jpegsize, t, flags)==-1)
+ _throwtj("executing tjTransform()");
+ elapsed=gettime()-start;
+
+ free(t); t=NULL;
+
+ for(tile=0, totaljpegsize=0; tile<_ntilesw*_ntilesh; tile++)
+ totaljpegsize+=jpegsize[tile];
+
+ if(quiet)
+ {
+ printf("%s%c%s%c",
+ sigfig((double)(w*h)/1000000./elapsed, 4, tempstr, 80),
+ quiet==2? '\n':'\t',
+ sigfig((double)(w*h*ps)/(double)totaljpegsize, 4, tempstr2, 80),
+ quiet==2? '\n':'\t');
+ }
+ else if(!quiet)
+ {
+ printf("X--> Frame rate: %f fps\n", 1.0/elapsed);
+ printf(" Output image size: %lu bytes\n", totaljpegsize);
+ printf(" Compression ratio: %f:1\n",
+ (double)(w*h*ps)/(double)totaljpegsize);
+ printf(" Source throughput: %f Megapixels/sec\n",
+ (double)(w*h)/1000000./elapsed);
+ printf(" Output bit stream: %f Megabits/sec\n",
+ (double)totaljpegsize*8./1000000./elapsed);
+ }
+ }
+ else
+ {
+ if(quiet==1) printf("N/A\tN/A\t");
+ jpegsize[0]=srcsize;
+ memcpy(jpegbuf[0], srcbuf, srcsize);
+ }
+
+ if(w==tilew) _tilew=_w;
+ if(h==tileh) _tileh=_h;
+ if(!(xformopt&TJXOPT_NOOUTPUT))
+ {
+ if(decomptest(NULL, jpegbuf, jpegsize, NULL, _w, _h, _subsamp, 0,
+ filename, _tilew, _tileh)==-1)
+ goto bailout;
+ }
+ else if(quiet==1) printf("N/A\n");
+
+ for(i=0; i<ntilesw*ntilesh; i++)
+ {
+ free(jpegbuf[i]); jpegbuf[i]=NULL;
+ }
+ free(jpegbuf); jpegbuf=NULL;
+ if(jpegsize) {free(jpegsize); jpegsize=NULL;}
+
+ if(tilew==w && tileh==h) break;
+ }
+
+ bailout:
+ if(file) {fclose(file); file=NULL;}
+ if(jpegbuf)
+ {
+ for(i=0; i<ntilesw*ntilesh; i++)
+ {
+ if(jpegbuf[i]) free(jpegbuf[i]); jpegbuf[i]=NULL;
+ }
+ free(jpegbuf); jpegbuf=NULL;
+ }
+ if(jpegsize) {free(jpegsize); jpegsize=NULL;}
+ if(srcbuf) {free(srcbuf); srcbuf=NULL;}
+ if(t) {free(t); t=NULL;}
+ if(handle) {tjDestroy(handle); handle=NULL;}
+ return;
+}
+
+
+void usage(char *progname)
+{
+ int i;
+ printf("USAGE: %s\n", progname);
+ printf(" <Inputfile (BMP|PPM)> <%% Quality> [options]\n\n");
+ printf(" %s\n", progname);
+ printf(" <Inputfile (JPG)> [options]\n\n");
+ printf("Options:\n\n");
+ printf("-alloc = Dynamically allocate JPEG image buffers\n");
+ printf("-bmp = Generate output images in Windows Bitmap format (default=PPM)\n");
+ printf("-bottomup = Test bottom-up compression/decompression\n");
+ printf("-tile = Test performance of the codec when the image is encoded as separate\n");
+ printf(" tiles of varying sizes.\n");
+ printf("-forcemmx, -forcesse, -forcesse2, -forcesse3 =\n");
+ printf(" Force MMX, SSE, SSE2, or SSE3 code paths in the underlying codec\n");
+ printf("-rgb, -bgr, -rgbx, -bgrx, -xbgr, -xrgb =\n");
+ printf(" Test the specified color conversion path in the codec (default: BGR)\n");
+ printf("-fastupsample = Use fast, inaccurate upsampling code to perform 4:2:2 and 4:2:0\n");
+ printf(" YUV decoding in libjpeg decompressor\n");
+ printf("-quiet = Output results in tabular rather than verbose format\n");
+ printf("-yuvencode = Encode RGB input as planar YUV rather than compressing as JPEG\n");
+ printf("-yuvdecode = Decode JPEG image to planar YUV rather than RGB\n");
+ printf("-scale M/N = scale down the width/height of the decompressed JPEG image by a\n");
+ printf(" factor of M/N (M/N = ");
+ for(i=0; i<nsf; i++)
+ {
+ printf("%d/%d", scalingfactors[i].num, scalingfactors[i].denom);
+ if(nsf==2 && i!=nsf-1) printf(" or ");
+ else if(nsf>2)
+ {
+ if(i!=nsf-1) printf(", ");
+ if(i==nsf-2) printf("or ");
+ }
+ }
+ printf(")\n");
+ printf("-hflip, -vflip, -transpose, -transverse, -rot90, -rot180, -rot270 =\n");
+ printf(" Perform the corresponding lossless transform prior to\n");
+ printf(" decompression (these options are mutually exclusive)\n");
+ 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\n");
+ printf("NOTE: If the quality is specified as a range (e.g. 90-100), a separate\n");
+ printf("test will be performed for all quality values in the range.\n\n");
+ exit(1);
+}
+
+
+int main(int argc, char *argv[])
+{
+ unsigned char *srcbuf=NULL; int w, h, i, j;
+ int minqual=-1, maxqual=-1; char *temp;
+ int minarg=2; int retval=0;
+
+ if((scalingfactors=tjGetScalingFactors(&nsf))==NULL || nsf==0)
+ _throwtj("executing tjGetScalingFactors()");
+
+ if(argc<minarg) usage(argv[0]);
+
+ temp=strrchr(argv[1], '.');
+ if(temp!=NULL)
+ {
+ if(!strcasecmp(temp, ".bmp")) ext="bmp";
+ if(!strcasecmp(temp, ".jpg") || !strcasecmp(temp, ".jpeg")) decomponly=1;
+ }
+
+ printf("\n");
+
+ if(argc>minarg)
+ {
+ for(i=minarg; i<argc; i++)
+ {
+ if(!strcasecmp(argv[i], "-yuvencode"))
+ {
+ printf("Testing YUV planar encoding\n\n");
+ yuv=YUVENCODE; maxqual=minqual=100;
+ }
+ if(!strcasecmp(argv[i], "-yuvdecode"))
+ {
+ printf("Testing YUV planar decoding\n\n");
+ yuv=YUVDECODE;
+ }
+ }
+ }
+
+ if(!decomponly && yuv!=YUVENCODE)
+ {
+ minarg=3;
+ if(argc<minarg) usage(argv[0]);
+ if((minqual=atoi(argv[2]))<1 || minqual>100)
+ {
+ puts("ERROR: Quality must be between 1 and 100.");
+ exit(1);
+ }
+ if((temp=strchr(argv[2], '-'))!=NULL && strlen(temp)>1
+ && sscanf(&temp[1], "%d", &maxqual)==1 && maxqual>minqual && maxqual>=1
+ && maxqual<=100) {}
+ else maxqual=minqual;
+ }
+
+ if(argc>minarg)
+ {
+ for(i=minarg; i<argc; i++)
+ {
+ if(!strcasecmp(argv[i], "-tile"))
+ {
+ dotile=1; xformopt|=TJXOPT_CROP;
+ }
+ if(!strcasecmp(argv[i], "-forcesse3"))
+ {
+ printf("Forcing SSE3 code\n\n");
+ flags|=TJFLAG_FORCESSE3;
+ }
+ if(!strcasecmp(argv[i], "-forcesse2"))
+ {
+ printf("Forcing SSE2 code\n\n");
+ flags|=TJFLAG_FORCESSE2;
+ }
+ if(!strcasecmp(argv[i], "-forcesse"))
+ {
+ printf("Forcing SSE code\n\n");
+ flags|=TJFLAG_FORCESSE;
+ }
+ if(!strcasecmp(argv[i], "-forcemmx"))
+ {
+ printf("Forcing MMX code\n\n");
+ flags|=TJFLAG_FORCEMMX;
+ }
+ if(!strcasecmp(argv[i], "-fastupsample"))
+ {
+ printf("Using fast upsampling code\n\n");
+ flags|=TJFLAG_FASTUPSAMPLE;
+ }
+ if(!strcasecmp(argv[i], "-rgb")) pf=TJPF_RGB;
+ if(!strcasecmp(argv[i], "-rgbx")) pf=TJPF_RGBX;
+ if(!strcasecmp(argv[i], "-bgr")) pf=TJPF_BGR;
+ if(!strcasecmp(argv[i], "-bgrx")) pf=TJPF_BGRX;
+ if(!strcasecmp(argv[i], "-xbgr")) pf=TJPF_XBGR;
+ if(!strcasecmp(argv[i], "-xrgb")) pf=TJPF_XRGB;
+ if(!strcasecmp(argv[i], "-bottomup")) flags|=TJFLAG_BOTTOMUP;
+ if(!strcasecmp(argv[i], "-quiet")) quiet=1;
+ if(!strcasecmp(argv[i], "-qq")) quiet=2;
+ if(!strcasecmp(argv[i], "-scale") && i<argc-1)
+ {
+ int temp1=0, temp2=0, match=0;
+ if(sscanf(argv[++i], "%d/%d", &temp1, &temp2)==2)
+ {
+ for(j=0; j<nsf; j++)
+ {
+ if(temp1==scalingfactors[j].num && temp2==scalingfactors[j].denom)
+ {
+ sf=scalingfactors[j];
+ match=1; break;
+ }
+ }
+ if(!match) usage(argv[0]);
+ }
+ else usage(argv[0]);
+ }
+ if(!strcasecmp(argv[i], "-hflip")) xformop=TJXOP_HFLIP;
+ if(!strcasecmp(argv[i], "-vflip")) xformop=TJXOP_VFLIP;
+ if(!strcasecmp(argv[i], "-transpose")) xformop=TJXOP_TRANSPOSE;
+ if(!strcasecmp(argv[i], "-transverse")) xformop=TJXOP_TRANSVERSE;
+ if(!strcasecmp(argv[i], "-rot90")) xformop=TJXOP_ROT90;
+ if(!strcasecmp(argv[i], "-rot180")) xformop=TJXOP_ROT180;
+ if(!strcasecmp(argv[i], "-rot270")) xformop=TJXOP_ROT270;
+ if(!strcasecmp(argv[i], "-grayscale")) xformopt|=TJXOPT_GRAY;
+ if(!strcasecmp(argv[i], "-custom")) customFilter=dummyDCTFilter;
+ if(!strcasecmp(argv[i], "-nooutput")) xformopt|=TJXOPT_NOOUTPUT;
+ if(!strcasecmp(argv[i], "-benchtime") && i<argc-1)
+ {
+ double temp=atof(argv[++i]);
+ if(temp>0.0) benchtime=temp;
+ else usage(argv[0]);
+ }
+ if(!strcmp(argv[i], "-?")) usage(argv[0]);
+ if(!strcasecmp(argv[i], "-alloc")) flags&=(~TJFLAG_NOREALLOC);
+ if(!strcasecmp(argv[i], "-bmp")) ext="bmp";
+ }
+ }
+
+ if((sf.num!=1 || sf.denom!=1) && dotile)
+ {
+ printf("Disabling tiled compression/decompression tests, because those tests do not\n");
+ printf("work when scaled decompression is enabled.\n");
+ dotile=0;
+ }
+
+ if(yuv && dotile)
+ {
+ printf("Disabling tiled compression/decompression tests, because those tests do not\n");
+ printf("work when YUV encoding or decoding is enabled.\n\n");
+ dotile=0;
+ }
+
+ if(!decomponly)
+ {
+ if(loadbmp(argv[1], &srcbuf, &w, &h, pf, (flags&TJFLAG_BOTTOMUP)!=0)==-1)
+ _throwbmp("loading bitmap");
+ temp=strrchr(argv[1], '.');
+ if(temp!=NULL) *temp='\0';
+ }
+
+ if(quiet==1 && !decomponly)
+ {
+ printf("All performance values in Mpixels/sec\n\n");
+ printf("Bitmap\tBitmap\tJPEG\tJPEG\t%s %s \tComp\tComp\tDecomp\n",
+ dotile? "Tile ":"Image", dotile? "Tile ":"Image");
+ printf("Format\tOrder\tSubsamp\tQual\tWidth Height\tPerf \tRatio\tPerf\n\n");
+ }
+
+ if(decomponly)
+ {
+ dodecomptest(argv[1]);
+ printf("\n");
+ goto bailout;
+ }
+ for(i=maxqual; i>=minqual; i--)
+ dotest(srcbuf, w, h, TJ_GRAYSCALE, i, argv[1]);
+ printf("\n");
+ for(i=maxqual; i>=minqual; i--)
+ dotest(srcbuf, w, h, TJ_420, i, argv[1]);
+ printf("\n");
+ for(i=maxqual; i>=minqual; i--)
+ dotest(srcbuf, w, h, TJ_422, i, argv[1]);
+ printf("\n");
+ for(i=maxqual; i>=minqual; i--)
+ dotest(srcbuf, w, h, TJ_444, i, argv[1]);
+ printf("\n");
+
+ bailout:
+ if(srcbuf) free(srcbuf);
+ return retval;
+}
diff --git a/tjunittest.c b/tjunittest.c
new file mode 100644
index 0000000..3a57347
--- /dev/null
+++ b/tjunittest.c
@@ -0,0 +1,647 @@
+/*
+ * Copyright (C)2009-2011 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:
+ *
+ * - 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.
+ */
+
+/*
+ * This program tests the various code paths in the TurboJPEG C Wrapper
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+#include "./tjutil.h"
+#include "./turbojpeg.h"
+#ifdef _WIN32
+ #include <time.h>
+ #define random() rand()
+#endif
+
+
+void usage(char *progName)
+{
+ printf("\nUSAGE: %s [options]\n", progName);
+ printf("Options:\n");
+ printf("-yuv = test YUV encoding/decoding support\n");
+ printf("-alloc = test automatic buffer allocation\n");
+ exit(1);
+}
+
+
+#define _throwtj() {printf("TurboJPEG ERROR:\n%s\n", tjGetErrorStr()); \
+ bailout();}
+#define _tj(f) {if((f)==-1) _throwtj();}
+#define _throw(m) {printf("ERROR: %s\n", m); bailout();}
+
+const char *subNameLong[TJ_NUMSAMP]=
+{
+ "4:4:4", "4:2:2", "4:2:0", "GRAY", "4:4:0"
+};
+const char *subName[TJ_NUMSAMP]={"444", "422", "420", "GRAY", "440"};
+
+const char *pixFormatStr[TJ_NUMPF]=
+{
+ "RGB", "BGR", "RGBX", "BGRX", "XBGR", "XRGB", "Grayscale"
+};
+
+const int alphaOffset[TJ_NUMPF] = {-1, -1, 3, 3, 0, 0, -1};
+
+const int _3byteFormats[]={TJPF_RGB, TJPF_BGR};
+const int _4byteFormats[]={TJPF_RGBX, TJPF_BGRX, TJPF_XBGR, TJPF_XRGB};
+const int _onlyGray[]={TJPF_GRAY};
+const int _onlyRGB[]={TJPF_RGB};
+
+enum {YUVENCODE=1, YUVDECODE};
+int yuv=0, alloc=0;
+
+int exitStatus=0;
+#define bailout() {exitStatus=-1; goto bailout;}
+
+
+void initBuf(unsigned char *buf, int w, int h, int pf, int flags)
+{
+ int roffset=tjRedOffset[pf];
+ int goffset=tjGreenOffset[pf];
+ int boffset=tjBlueOffset[pf];
+ int ps=tjPixelSize[pf];
+ int index, row, col, halfway=16;
+
+ memset(buf, 0, w*h*ps);
+ if(pf==TJPF_GRAY)
+ {
+ for(row=0; row<h; row++)
+ {
+ for(col=0; col<w; col++)
+ {
+ if(flags&TJFLAG_BOTTOMUP) index=(h-row-1)*w+col;
+ else index=row*w+col;
+ if(((row/8)+(col/8))%2==0) buf[index]=(row<halfway)? 255:0;
+ else buf[index]=(row<halfway)? 76:226;
+ }
+ }
+ }
+ else
+ {
+ for(row=0; row<h; row++)
+ {
+ for(col=0; col<w; col++)
+ {
+ if(flags&TJFLAG_BOTTOMUP) index=(h-row-1)*w+col;
+ else index=row*w+col;
+ if(((row/8)+(col/8))%2==0)
+ {
+ if(row<halfway)
+ {
+ buf[index*ps+roffset]=255;
+ buf[index*ps+goffset]=255;
+ buf[index*ps+boffset]=255;
+ }
+ }
+ else
+ {
+ buf[index*ps+roffset]=255;
+ if(row>=halfway) buf[index*ps+goffset]=255;
+ }
+ }
+ }
+ }
+}
+
+
+#define checkval(v, cv) { \
+ if(v<cv-1 || v>cv+1) { \
+ printf("\nComp. %s at %d,%d should be %d, not %d\n", \
+ #v, row, col, cv, v); \
+ retval=0; exitStatus=-1; goto bailout; \
+ }}
+
+#define checkval0(v) { \
+ if(v>1) { \
+ printf("\nComp. %s at %d,%d should be 0, not %d\n", #v, row, col, v); \
+ retval=0; exitStatus=-1; goto bailout; \
+ }}
+
+#define checkval255(v) { \
+ if(v<254) { \
+ printf("\nComp. %s at %d,%d should be 255, not %d\n", #v, row, col, v); \
+ retval=0; exitStatus=-1; goto bailout; \
+ }}
+
+
+int checkBuf(unsigned char *buf, int w, int h, int pf, int subsamp,
+ tjscalingfactor sf, int flags)
+{
+ int roffset=tjRedOffset[pf];
+ int goffset=tjGreenOffset[pf];
+ int boffset=tjBlueOffset[pf];
+ int aoffset=alphaOffset[pf];
+ int ps=tjPixelSize[pf];
+ int index, row, col, retval=1;
+ int halfway=16*sf.num/sf.denom;
+ int blocksize=8*sf.num/sf.denom;
+
+ for(row=0; row<h; row++)
+ {
+ for(col=0; col<w; col++)
+ {
+ unsigned char r, g, b, a;
+ if(flags&TJFLAG_BOTTOMUP) index=(h-row-1)*w+col;
+ else index=row*w+col;
+ r=buf[index*ps+roffset];
+ g=buf[index*ps+goffset];
+ b=buf[index*ps+boffset];
+ a=aoffset>=0? buf[index*ps+aoffset]:0xFF;
+ if(((row/blocksize)+(col/blocksize))%2==0)
+ {
+ if(row<halfway)
+ {
+ checkval255(r); checkval255(g); checkval255(b);
+ }
+ else
+ {
+ checkval0(r); checkval0(g); checkval0(b);
+ }
+ }
+ else
+ {
+ if(subsamp==TJSAMP_GRAY)
+ {
+ if(row<halfway)
+ {
+ checkval(r, 76); checkval(g, 76); checkval(b, 76);
+ }
+ else
+ {
+ checkval(r, 226); checkval(g, 226); checkval(b, 226);
+ }
+ }
+ else
+ {
+ if(row<halfway)
+ {
+ checkval255(r); checkval0(g); checkval0(b);
+ }
+ else
+ {
+ checkval255(r); checkval255(g); checkval0(b);
+ }
+ }
+ }
+ checkval255(a);
+ }
+ }
+
+ bailout:
+ if(retval==0)
+ {
+ printf("\n");
+ for(row=0; row<h; row++)
+ {
+ for(col=0; col<w; col++)
+ {
+ printf("%.3d/%.3d/%.3d ", buf[(row*w+col)*ps+roffset],
+ buf[(row*w+col)*ps+goffset], buf[(row*w+col)*ps+boffset]);
+ }
+ printf("\n");
+ }
+ }
+ return retval;
+}
+
+
+#define PAD(v, p) ((v+(p)-1)&(~((p)-1)))
+
+int checkBufYUV(unsigned char *buf, int w, int h, int subsamp)
+{
+ int row, col;
+ int hsf=tjMCUWidth[subsamp]/8, vsf=tjMCUHeight[subsamp]/8;
+ int pw=PAD(w, hsf), ph=PAD(h, vsf);
+ int cw=pw/hsf, ch=ph/vsf;
+ int ypitch=PAD(pw, 4), uvpitch=PAD(cw, 4);
+ int retval=1;
+ int halfway=16;
+
+ for(row=0; row<ph; row++)
+ {
+ for(col=0; col<pw; col++)
+ {
+ unsigned char y=buf[ypitch*row+col];
+ if(((row/8)+(col/8))%2==0)
+ {
+ if(row<halfway) checkval255(y) else checkval0(y);
+ }
+ else
+ {
+ if(row<halfway) checkval(y, 76) else checkval(y, 226);
+ }
+ }
+ }
+ if(subsamp!=TJSAMP_GRAY)
+ {
+ halfway=16/vsf;
+ for(row=0; row<ch; row++)
+ {
+ for(col=0; col<cw; col++)
+ {
+ unsigned char u=buf[ypitch*ph + (uvpitch*row+col)],
+ v=buf[ypitch*ph + uvpitch*ch + (uvpitch*row+col)];
+ if(((row*vsf/8)+(col*hsf/8))%2==0)
+ {
+ checkval(u, 128); checkval(v, 128);
+ }
+ else
+ {
+ if(row<halfway)
+ {
+ checkval(u, 85); checkval255(v);
+ }
+ else
+ {
+ checkval0(u); checkval(v, 149);
+ }
+ }
+ }
+ }
+ }
+
+ bailout:
+ if(retval==0)
+ {
+ for(row=0; row<ph; row++)
+ {
+ for(col=0; col<pw; col++)
+ printf("%.3d ", buf[ypitch*row+col]);
+ printf("\n");
+ }
+ printf("\n");
+ for(row=0; row<ch; row++)
+ {
+ for(col=0; col<cw; col++)
+ printf("%.3d ", buf[ypitch*ph + (uvpitch*row+col)]);
+ printf("\n");
+ }
+ printf("\n");
+ for(row=0; row<ch; row++)
+ {
+ for(col=0; col<cw; col++)
+ printf("%.3d ", buf[ypitch*ph + uvpitch*ch + (uvpitch*row+col)]);
+ printf("\n");
+ }
+ printf("\n");
+ }
+
+ return retval;
+}
+
+
+void writeJPEG(unsigned char *jpegBuf, unsigned long jpegSize, char *filename)
+{
+ FILE *file=fopen(filename, "wb");
+ if(!file || fwrite(jpegBuf, jpegSize, 1, file)!=1)
+ {
+ printf("ERROR: Could not write to %s.\n%s\n", filename, strerror(errno));
+ bailout();
+ }
+
+ bailout:
+ if(file) fclose(file);
+}
+
+
+void compTest(tjhandle handle, unsigned char **dstBuf,
+ unsigned long *dstSize, int w, int h, int pf, char *basename,
+ int subsamp, int jpegQual, int flags)
+{
+ char tempStr[1024]; unsigned char *srcBuf=NULL;
+ double t;
+
+ if(yuv==YUVENCODE)
+ printf("%s %s -> %s YUV ... ", pixFormatStr[pf],
+ (flags&TJFLAG_BOTTOMUP)? "Bottom-Up":"Top-Down ", subNameLong[subsamp]);
+ else
+ printf("%s %s -> %s Q%d ... ", pixFormatStr[pf],
+ (flags&TJFLAG_BOTTOMUP)? "Bottom-Up":"Top-Down ", subNameLong[subsamp],
+ jpegQual);
+
+ if((srcBuf=(unsigned char *)malloc(w*h*tjPixelSize[pf]))==NULL)
+ _throw("Memory allocation failure");
+ initBuf(srcBuf, w, h, pf, flags);
+ if(*dstBuf && *dstSize>0) memset(*dstBuf, 0, *dstSize);
+
+ t=gettime();
+ if(yuv==YUVENCODE)
+ {
+ _tj(tjEncodeYUV2(handle, srcBuf, w, 0, h, pf, *dstBuf, subsamp, flags));
+ }
+ else
+ {
+ if(!alloc)
+ {
+ flags|=TJFLAG_NOREALLOC;
+ *dstSize=(yuv==YUVENCODE? tjBufSizeYUV(w, h, subsamp)
+ : tjBufSize(w, h, subsamp));
+ }
+ _tj(tjCompress2(handle, srcBuf, w, 0, h, pf, dstBuf, dstSize, subsamp,
+ jpegQual, flags));
+ }
+ t=gettime()-t;
+
+ if(yuv==YUVENCODE)
+ snprintf(tempStr, 1024, "%s_enc_%s_%s_%s.yuv", basename, pixFormatStr[pf],
+ (flags&TJFLAG_BOTTOMUP)? "BU":"TD", subName[subsamp]);
+ else
+ snprintf(tempStr, 1024, "%s_enc_%s_%s_%s_Q%d.jpg", basename,
+ pixFormatStr[pf], (flags&TJFLAG_BOTTOMUP)? "BU":"TD", subName[subsamp],
+ jpegQual);
+ writeJPEG(*dstBuf, *dstSize, tempStr);
+ if(yuv==YUVENCODE)
+ {
+ if(checkBufYUV(*dstBuf, w, h, subsamp)) printf("Passed.");
+ else printf("FAILED!");
+ }
+ else printf("Done.");
+ printf(" %f ms\n Result in %s\n", t*1000., tempStr);
+
+ bailout:
+ if(srcBuf) free(srcBuf);
+}
+
+
+void _decompTest(tjhandle handle, unsigned char *jpegBuf,
+ unsigned long jpegSize, int w, int h, int pf, char *basename, int subsamp,
+ int flags, tjscalingfactor sf)
+{
+ unsigned char *dstBuf=NULL;
+ int _hdrw=0, _hdrh=0, _hdrsubsamp=-1; double t;
+ int scaledWidth=TJSCALED(w, sf);
+ int scaledHeight=TJSCALED(h, sf);
+ unsigned long dstSize=0;
+
+ if(yuv==YUVENCODE) return;
+
+ if(yuv==YUVDECODE)
+ printf("JPEG -> YUV %s ... ", subName[subsamp]);
+ else
+ {
+ printf("JPEG -> %s %s ", pixFormatStr[pf],
+ (flags&TJFLAG_BOTTOMUP)? "Bottom-Up":"Top-Down ");
+ if(sf.num!=1 || sf.denom!=1)
+ printf("%d/%d ... ", sf.num, sf.denom);
+ else printf("... ");
+ }
+
+ _tj(tjDecompressHeader2(handle, jpegBuf, jpegSize, &_hdrw, &_hdrh,
+ &_hdrsubsamp));
+ if(_hdrw!=w || _hdrh!=h || _hdrsubsamp!=subsamp)
+ _throw("Incorrect JPEG header");
+
+ if(yuv==YUVDECODE) dstSize=tjBufSizeYUV(w, h, subsamp);
+ else dstSize=scaledWidth*scaledHeight*tjPixelSize[pf];
+ if((dstBuf=(unsigned char *)malloc(dstSize))==NULL)
+ _throw("Memory allocation failure");
+ memset(dstBuf, 0, dstSize);
+
+ t=gettime();
+ if(yuv==YUVDECODE)
+ {
+ _tj(tjDecompressToYUV(handle, jpegBuf, jpegSize, dstBuf, flags));
+ }
+ else
+ {
+ _tj(tjDecompress2(handle, jpegBuf, jpegSize, dstBuf, scaledWidth, 0,
+ scaledHeight, pf, flags));
+ }
+ t=gettime()-t;
+
+ if(yuv==YUVDECODE)
+ {
+ if(checkBufYUV(dstBuf, w, h, subsamp)) printf("Passed.");
+ else printf("FAILED!");
+ }
+ else
+ {
+ if(checkBuf(dstBuf, scaledWidth, scaledHeight, pf, subsamp, sf, flags))
+ printf("Passed.");
+ else printf("FAILED!");
+ }
+ printf(" %f ms\n", t*1000.);
+
+ bailout:
+ if(dstBuf) free(dstBuf);
+}
+
+
+void decompTest(tjhandle handle, unsigned char *jpegBuf,
+ unsigned long jpegSize, int w, int h, int pf, char *basename, int subsamp,
+ int flags)
+{
+ int i, n=0;
+ tjscalingfactor *sf=tjGetScalingFactors(&n), sf1={1, 1};
+ if(!sf || !n) _throwtj();
+
+ if((subsamp==TJSAMP_444 || subsamp==TJSAMP_GRAY) && !yuv)
+ {
+ for(i=0; i<n; i++)
+ _decompTest(handle, jpegBuf, jpegSize, w, h, pf, basename, subsamp,
+ flags, sf[i]);
+ }
+ else
+ _decompTest(handle, jpegBuf, jpegSize, w, h, pf, basename, subsamp, flags,
+ sf1);
+
+ bailout:
+ printf("\n");
+}
+
+
+void doTest(int w, int h, const int *formats, int nformats, int subsamp,
+ char *basename)
+{
+ tjhandle chandle=NULL, dhandle=NULL;
+ unsigned char *dstBuf=NULL;
+ unsigned long size=0; int pfi, pf, i;
+
+ if(!alloc)
+ {
+ size=(yuv==YUVENCODE? tjBufSizeYUV(w, h, subsamp)
+ : tjBufSize(w, h, subsamp));
+ if((dstBuf=(unsigned char *)tjAlloc(size))==NULL)
+ _throw("Memory allocation failure.");
+ }
+
+ if((chandle=tjInitCompress())==NULL || (dhandle=tjInitDecompress())==NULL)
+ _throwtj();
+
+ for(pfi=0; pfi<nformats; pfi++)
+ {
+ for(i=0; i<2; i++)
+ {
+ int flags=0;
+ if(i==1)
+ {
+ if(yuv==YUVDECODE) goto bailout;
+ else flags|=TJFLAG_BOTTOMUP;
+ }
+ pf=formats[pfi];
+ compTest(chandle, &dstBuf, &size, w, h, pf, basename, subsamp, 100,
+ flags);
+ decompTest(dhandle, dstBuf, size, w, h, pf, basename, subsamp,
+ flags);
+ }
+ }
+
+ bailout:
+ if(chandle) tjDestroy(chandle);
+ if(dhandle) tjDestroy(dhandle);
+
+ if(dstBuf) tjFree(dstBuf);
+}
+
+
+void bufSizeTest(void)
+{
+ int w, h, i, subsamp;
+ unsigned char *srcBuf=NULL, *jpegBuf=NULL;
+ tjhandle handle=NULL;
+ unsigned long jpegSize=0;
+
+ if((handle=tjInitCompress())==NULL) _throwtj();
+
+ printf("Buffer size regression test\n");
+ for(subsamp=0; subsamp<TJ_NUMSAMP; subsamp++)
+ {
+ for(w=1; w<48; w++)
+ {
+ int maxh=(w==1)? 2048:48;
+ for(h=1; h<maxh; h++)
+ {
+ if(h%100==0) printf("%.4d x %.4d\b\b\b\b\b\b\b\b\b\b\b", w, h);
+ if((srcBuf=(unsigned char *)malloc(w*h*4))==NULL)
+ _throw("Memory allocation failure");
+ if(!alloc)
+ {
+ if((jpegBuf=(unsigned char *)tjAlloc(tjBufSize(w, h, subsamp)))
+ ==NULL)
+ _throw("Memory allocation failure");
+ jpegSize=tjBufSize(w, h, subsamp);
+ }
+
+ for(i=0; i<w*h*4; i++)
+ {
+ if(random()<RAND_MAX/2) srcBuf[i]=0;
+ else srcBuf[i]=255;
+ }
+
+ _tj(tjCompress2(handle, srcBuf, w, 0, h, TJPF_BGRX, &jpegBuf,
+ &jpegSize, subsamp, 100, alloc? 0:TJFLAG_NOREALLOC));
+ free(srcBuf); srcBuf=NULL;
+ tjFree(jpegBuf); jpegBuf=NULL;
+
+ if((srcBuf=(unsigned char *)malloc(h*w*4))==NULL)
+ _throw("Memory allocation failure");
+ if(!alloc)
+ {
+ if((jpegBuf=(unsigned char *)tjAlloc(tjBufSize(h, w, subsamp)))
+ ==NULL)
+ _throw("Memory allocation failure");
+ jpegSize=tjBufSize(h, w, subsamp);
+ }
+
+ for(i=0; i<h*w*4; i++)
+ {
+ if(random()<RAND_MAX/2) srcBuf[i]=0;
+ else srcBuf[i]=255;
+ }
+
+ _tj(tjCompress2(handle, srcBuf, h, 0, w, TJPF_BGRX, &jpegBuf,
+ &jpegSize, subsamp, 100, alloc? 0:TJFLAG_NOREALLOC));
+ free(srcBuf); srcBuf=NULL;
+ tjFree(jpegBuf); jpegBuf=NULL;
+ }
+ }
+ }
+ printf("Done. \n");
+
+ bailout:
+ if(srcBuf) free(srcBuf);
+ if(jpegBuf) free(jpegBuf);
+ if(handle) tjDestroy(handle);
+}
+
+
+int main(int argc, char *argv[])
+{
+ int doyuv=0, i;
+ #ifdef _WIN32
+ srand((unsigned int)time(NULL));
+ #endif
+ if(argc>1)
+ {
+ for(i=1; i<argc; i++)
+ {
+ if(!strcasecmp(argv[i], "-yuv")) doyuv=1;
+ if(!strcasecmp(argv[i], "-alloc")) alloc=1;
+ if(!strncasecmp(argv[i], "-h", 2) || !strcasecmp(argv[i], "-?"))
+ usage(argv[0]);
+ }
+ }
+ if(alloc) printf("Testing automatic buffer allocation\n");
+ if(doyuv) {yuv=YUVENCODE; alloc=0;}
+ doTest(35, 39, _3byteFormats, 2, TJSAMP_444, "test");
+ doTest(39, 41, _4byteFormats, 4, TJSAMP_444, "test");
+ if(doyuv)
+ {
+ doTest(41, 35, _3byteFormats, 2, TJSAMP_422, "test");
+ doTest(35, 39, _4byteFormats, 4, TJSAMP_422, "test");
+ doTest(39, 41, _3byteFormats, 2, TJSAMP_420, "test");
+ doTest(41, 35, _4byteFormats, 4, TJSAMP_420, "test");
+ doTest(35, 39, _3byteFormats, 2, TJSAMP_440, "test");
+ doTest(39, 41, _4byteFormats, 4, TJSAMP_440, "test");
+ }
+ doTest(35, 39, _onlyGray, 1, TJSAMP_GRAY, "test");
+ doTest(39, 41, _3byteFormats, 2, TJSAMP_GRAY, "test");
+ doTest(41, 35, _4byteFormats, 4, TJSAMP_GRAY, "test");
+ if(!doyuv) bufSizeTest();
+ if(doyuv)
+ {
+ yuv=YUVDECODE;
+ doTest(48, 48, _onlyRGB, 1, TJSAMP_444, "test_yuv0");
+ doTest(35, 39, _onlyRGB, 1, TJSAMP_444, "test_yuv1");
+ doTest(48, 48, _onlyRGB, 1, TJSAMP_422, "test_yuv0");
+ doTest(39, 41, _onlyRGB, 1, TJSAMP_422, "test_yuv1");
+ doTest(48, 48, _onlyRGB, 1, TJSAMP_420, "test_yuv0");
+ doTest(41, 35, _onlyRGB, 1, TJSAMP_420, "test_yuv1");
+ doTest(48, 48, _onlyRGB, 1, TJSAMP_440, "test_yuv0");
+ doTest(35, 39, _onlyRGB, 1, TJSAMP_440, "test_yuv1");
+ doTest(48, 48, _onlyRGB, 1, TJSAMP_GRAY, "test_yuv0");
+ doTest(35, 39, _onlyRGB, 1, TJSAMP_GRAY, "test_yuv1");
+ doTest(48, 48, _onlyGray, 1, TJSAMP_GRAY, "test_yuv0");
+ doTest(39, 41, _onlyGray, 1, TJSAMP_GRAY, "test_yuv1");
+ }
+
+ return exitStatus;
+}
diff --git a/tjutil.c b/tjutil.c
new file mode 100644
index 0000000..6618d15
--- /dev/null
+++ b/tjutil.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+#ifdef _WIN32
+
+#include <windows.h>
+
+static double getfreq(void)
+{
+ LARGE_INTEGER freq;
+ if(!QueryPerformanceFrequency(&freq)) return 0.0;
+ return (double)freq.QuadPart;
+}
+
+static double f=-1.0;
+
+double gettime(void)
+{
+ LARGE_INTEGER t;
+ if(f<0.0) f=getfreq();
+ if(f==0.0) return (double)GetTickCount()/1000.;
+ else
+ {
+ QueryPerformanceCounter(&t);
+ return (double)t.QuadPart/f;
+ }
+}
+
+#else
+
+#include <stdlib.h>
+#include <sys/time.h>
+
+double gettime(void)
+{
+ struct timeval tv;
+ if(gettimeofday(&tv, NULL)<0) return 0.0;
+ else return (double)tv.tv_sec+((double)tv.tv_usec/1000000.);
+}
+
+#endif
diff --git a/tjutil.h b/tjutil.h
new file mode 100644
index 0000000..bdad348
--- /dev/null
+++ b/tjutil.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+#ifdef _WIN32
+ #ifndef __MINGW32__
+ #include <stdio.h>
+ #define snprintf(str, n, format, ...) \
+ _snprintf_s(str, n, _TRUNCATE, format, __VA_ARGS__)
+ #endif
+ #define strcasecmp stricmp
+ #define strncasecmp strnicmp
+#endif
+
+#ifndef min
+ #define min(a,b) ((a)<(b)?(a):(b))
+#endif
+
+#ifndef max
+ #define max(a,b) ((a)>(b)?(a):(b))
+#endif
+
+extern double gettime(void);
diff --git a/transupp.c b/transupp.c
index 5c31416..2513691 100644
--- a/transupp.c
+++ b/transupp.c
@@ -1022,7 +1022,7 @@
case JXFORM_FLIP_H:
if (info->trim)
trim_right_edge(info, srcinfo->output_width);
- if (info->y_crop_offset != 0)
+ if (info->y_crop_offset != 0 || info->slow_hflip)
need_workspace = TRUE;
/* do_flip_h_no_crop doesn't need a workspace array */
break;
@@ -1448,7 +1448,7 @@
src_coef_arrays, dst_coef_arrays);
break;
case JXFORM_FLIP_H:
- if (info->y_crop_offset != 0)
+ if (info->y_crop_offset != 0 || info->slow_hflip)
do_flip_h(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
src_coef_arrays, dst_coef_arrays);
else
diff --git a/transupp.h b/transupp.h
index 7c16c19..122d448 100644
--- a/transupp.h
+++ b/transupp.h
@@ -128,6 +128,13 @@
boolean trim; /* if TRUE, trim partial MCUs as needed */
boolean force_grayscale; /* if TRUE, convert color image to grayscale */
boolean crop; /* if TRUE, crop source image */
+ boolean slow_hflip; /* For best performance, the JXFORM_FLIP_H transform
+ normally modifies the source coefficients in place.
+ Setting this to TRUE will instead use a slower,
+ double-buffered algorithm, which leaves the source
+ coefficients in tact (necessary if other transformed
+ images must be generated from the same set of
+ coefficients. */
/* Crop parameters: application need not set these unless crop is TRUE.
* These can be filled in by jtransform_parse_crop_spec().
diff --git a/turbojpeg-jni.c b/turbojpeg-jni.c
new file mode 100644
index 0000000..25cca7d
--- /dev/null
+++ b/turbojpeg-jni.c
@@ -0,0 +1,682 @@
+/*
+ * Copyright (C)2011 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:
+ *
+ * - 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.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+#include "turbojpeg.h"
+#include <jni.h>
+#include "java/org_libjpegturbo_turbojpeg_TJCompressor.h"
+#include "java/org_libjpegturbo_turbojpeg_TJDecompressor.h"
+#include "java/org_libjpegturbo_turbojpeg_TJ.h"
+
+#define _throw(msg) { \
+ jclass _exccls=(*env)->FindClass(env, "java/lang/Exception"); \
+ if(!_exccls) goto bailout; \
+ (*env)->ThrowNew(env, _exccls, msg); \
+ goto bailout; \
+}
+
+#define bailif0(f) {if(!(f)) goto bailout;}
+
+#define gethandle() \
+ jclass _cls=(*env)->GetObjectClass(env, obj); \
+ jfieldID _fid; \
+ if(!_cls) goto bailout; \
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "handle", "J")); \
+ handle=(tjhandle)(jlong)(*env)->GetLongField(env, obj, _fid); \
+
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSize
+ (JNIEnv *env, jclass cls, jint width, jint height, jint jpegSubsamp)
+{
+ jint retval=(jint)tjBufSize(width, height, jpegSubsamp);
+ if(retval==-1) _throw(tjGetErrorStr());
+
+ bailout:
+ return retval;
+}
+
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV
+ (JNIEnv *env, jclass cls, jint width, jint height, jint subsamp)
+{
+ jint retval=(jint)tjBufSizeYUV(width, height, subsamp);
+ if(retval==-1) _throw(tjGetErrorStr());
+
+ bailout:
+ return retval;
+}
+
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_init
+ (JNIEnv *env, jobject obj)
+{
+ jclass cls;
+ jfieldID fid;
+ tjhandle handle;
+
+ if((handle=tjInitCompress())==NULL)
+ _throw(tjGetErrorStr());
+
+ bailif0(cls=(*env)->GetObjectClass(env, obj));
+ bailif0(fid=(*env)->GetFieldID(env, cls, "handle", "J"));
+ (*env)->SetLongField(env, obj, fid, (jlong)handle);
+
+ bailout:
+ return;
+}
+
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIII_3BIII
+ (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch,
+ jint height, jint pf, jbyteArray dst, jint jpegSubsamp, jint jpegQual,
+ jint flags)
+{
+ tjhandle handle=0;
+ unsigned long jpegSize=0; jsize arraySize=0;
+ unsigned char *srcBuf=NULL, *jpegBuf=NULL;
+
+ gethandle();
+
+ if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF || width<1 || height<1
+ || pitch<0)
+ _throw("Invalid argument in compress()");
+ if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
+ _throw("Mismatch between Java and C API");
+
+ arraySize=(pitch==0)? width*tjPixelSize[pf]*height:pitch*height;
+ if((*env)->GetArrayLength(env, src)<arraySize)
+ _throw("Source buffer is not large enough");
+ jpegSize=tjBufSize(width, height, jpegSubsamp);
+ if((*env)->GetArrayLength(env, dst)<(jsize)jpegSize)
+ _throw("Destination buffer is not large enough");
+
+ bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
+ bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
+
+ if(tjCompress2(handle, srcBuf, width, pitch, height, pf, &jpegBuf,
+ &jpegSize, jpegSubsamp, jpegQual, flags|TJFLAG_NOREALLOC)==-1)
+ {
+ (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0);
+ (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
+ jpegBuf=srcBuf=NULL;
+ _throw(tjGetErrorStr());
+ }
+
+ bailout:
+ if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0);
+ if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
+ return (jint)jpegSize;
+}
+
+JNIEXPORT jint JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3IIIII_3BIII
+ (JNIEnv *env, jobject obj, jintArray src, jint width, jint pitch,
+ jint height, jint pf, jbyteArray dst, jint jpegSubsamp, jint jpegQual,
+ jint flags)
+{
+ tjhandle handle=0;
+ unsigned long jpegSize=0; jsize arraySize=0;
+ unsigned char *srcBuf=NULL, *jpegBuf=NULL;
+
+ gethandle();
+
+ if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF || width<1 || height<1
+ || pitch<0)
+ _throw("Invalid argument in compress()");
+ if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
+ _throw("Mismatch between Java and C API");
+ if(tjPixelSize[pf]!=sizeof(jint))
+ _throw("Pixel format must be 32-bit when compressing from an integer buffer.");
+
+ arraySize=(pitch==0)? width*height:pitch*height;
+ if((*env)->GetArrayLength(env, src)<arraySize)
+ _throw("Source buffer is not large enough");
+ jpegSize=tjBufSize(width, height, jpegSubsamp);
+ if((*env)->GetArrayLength(env, dst)<(jsize)jpegSize)
+ _throw("Destination buffer is not large enough");
+
+ bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
+ bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
+
+ if(tjCompress2(handle, srcBuf, width, pitch*sizeof(jint), height, pf,
+ &jpegBuf, &jpegSize, jpegSubsamp, jpegQual, flags|TJFLAG_NOREALLOC)==-1)
+ {
+ (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0);
+ (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
+ jpegBuf=srcBuf=NULL;
+ _throw(tjGetErrorStr());
+ }
+
+ bailout:
+ if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, jpegBuf, 0);
+ if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
+ return (jint)jpegSize;
+}
+
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII
+ (JNIEnv *env, jobject obj, jbyteArray src, jint width, jint pitch,
+ jint height, jint pf, jbyteArray dst, jint subsamp, jint flags)
+{
+ tjhandle handle=0;
+ jsize arraySize=0;
+ unsigned char *srcBuf=NULL, *dstBuf=NULL;
+
+ gethandle();
+
+ if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF || width<1 || height<1
+ || pitch<0)
+ _throw("Invalid argument in encodeYUV()");
+ if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
+ _throw("Mismatch between Java and C API");
+
+ arraySize=(pitch==0)? width*tjPixelSize[pf]*height:pitch*height;
+ if((*env)->GetArrayLength(env, src)<arraySize)
+ _throw("Source buffer is not large enough");
+ if((*env)->GetArrayLength(env, dst)
+ <(jsize)tjBufSizeYUV(width, height, subsamp))
+ _throw("Destination buffer is not large enough");
+
+ bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
+ bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
+
+ if(tjEncodeYUV2(handle, srcBuf, width, pitch, height, pf, dstBuf, subsamp,
+ flags)==-1)
+ {
+ (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
+ (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
+ dstBuf=srcBuf=NULL;
+ _throw(tjGetErrorStr());
+ }
+
+ bailout:
+ if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
+ if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
+ return;
+}
+
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BII
+ (JNIEnv *env, jobject obj, jintArray src, jint width, jint pitch,
+ jint height, jint pf, jbyteArray dst, jint subsamp, jint flags)
+{
+ tjhandle handle=0;
+ jsize arraySize=0;
+ unsigned char *srcBuf=NULL, *dstBuf=NULL;
+
+ gethandle();
+
+ if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF || width<1 || height<1
+ || pitch<0)
+ _throw("Invalid argument in compress()");
+ if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
+ _throw("Mismatch between Java and C API");
+ if(tjPixelSize[pf]!=sizeof(jint))
+ _throw("Pixel format must be 32-bit when encoding from an integer buffer.");
+
+ arraySize=(pitch==0)? width*height:pitch*height;
+ if((*env)->GetArrayLength(env, src)<arraySize)
+ _throw("Source buffer is not large enough");
+ if((*env)->GetArrayLength(env, dst)
+ <(jsize)tjBufSizeYUV(width, height, subsamp))
+ _throw("Destination buffer is not large enough");
+
+ bailif0(srcBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
+ bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
+
+ if(tjEncodeYUV2(handle, srcBuf, width, pitch*sizeof(jint), height, pf,
+ dstBuf, subsamp, flags)==-1)
+ {
+ (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
+ (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
+ dstBuf=srcBuf=NULL;
+ _throw(tjGetErrorStr());
+ }
+
+ bailout:
+ if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
+ if(srcBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, srcBuf, 0);
+ return;
+}
+
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy
+ (JNIEnv *env, jobject obj)
+{
+ tjhandle handle=0;
+
+ gethandle();
+
+ if(tjDestroy(handle)==-1) _throw(tjGetErrorStr());
+ (*env)->SetLongField(env, obj, _fid, 0);
+
+ bailout:
+ return;
+}
+
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_init
+ (JNIEnv *env, jobject obj)
+{
+ jclass cls;
+ jfieldID fid;
+ tjhandle handle;
+
+ if((handle=tjInitDecompress())==NULL) _throw(tjGetErrorStr());
+
+ bailif0(cls=(*env)->GetObjectClass(env, obj));
+ bailif0(fid=(*env)->GetFieldID(env, cls, "handle", "J"));
+ (*env)->SetLongField(env, obj, fid, (jlong)handle);
+
+ bailout:
+ return;
+}
+
+JNIEXPORT jobjectArray JNICALL Java_org_libjpegturbo_turbojpeg_TJ_getScalingFactors
+ (JNIEnv *env, jclass cls)
+{
+ jclass sfcls=NULL; jfieldID fid=0;
+ tjscalingfactor *sf=NULL; int n=0, i;
+ jobject sfobj=NULL;
+ jobjectArray sfjava=NULL;
+
+ if((sf=tjGetScalingFactors(&n))==NULL || n==0)
+ _throw(tjGetErrorStr());
+
+ bailif0(sfcls=(*env)->FindClass(env, "org/libjpegturbo/turbojpeg/TJScalingFactor"));
+ bailif0(sfjava=(jobjectArray)(*env)->NewObjectArray(env, n, sfcls, 0));
+
+ for(i=0; i<n; i++)
+ {
+ bailif0(sfobj=(*env)->AllocObject(env, sfcls));
+ bailif0(fid=(*env)->GetFieldID(env, sfcls, "num", "I"));
+ (*env)->SetIntField(env, sfobj, fid, sf[i].num);
+ bailif0(fid=(*env)->GetFieldID(env, sfcls, "denom", "I"));
+ (*env)->SetIntField(env, sfobj, fid, sf[i].denom);
+ (*env)->SetObjectArrayElement(env, sfjava, i, sfobj);
+ }
+
+ bailout:
+ return sfjava;
+}
+
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressHeader
+ (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize)
+{
+ tjhandle handle=0;
+ unsigned char *jpegBuf=NULL;
+ int width=0, height=0, jpegSubsamp=-1;
+
+ gethandle();
+
+ if((*env)->GetArrayLength(env, src)<jpegSize)
+ _throw("Source buffer is not large enough");
+
+ bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
+
+ if(tjDecompressHeader2(handle, jpegBuf, (unsigned long)jpegSize,
+ &width, &height, &jpegSubsamp)==-1)
+ {
+ (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
+ _throw(tjGetErrorStr());
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0); jpegBuf=NULL;
+
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I"));
+ (*env)->SetIntField(env, obj, _fid, jpegSubsamp);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I"));
+ (*env)->SetIntField(env, obj, _fid, width);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I"));
+ (*env)->SetIntField(env, obj, _fid, height);
+
+ bailout:
+ return;
+}
+
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIII
+ (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst,
+ jint width, jint pitch, jint height, jint pf, jint flags)
+{
+ tjhandle handle=0;
+ jsize arraySize=0;
+ unsigned char *jpegBuf=NULL, *dstBuf=NULL;
+
+ gethandle();
+
+ if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF)
+ _throw("Invalid argument in decompress()");
+ if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
+ _throw("Mismatch between Java and C API");
+
+ if((*env)->GetArrayLength(env, src)<jpegSize)
+ _throw("Source buffer is not large enough");
+ arraySize=(pitch==0)? width*tjPixelSize[pf]*height:pitch*height;
+ if((*env)->GetArrayLength(env, dst)<arraySize)
+ _throw("Destination buffer is not large enough");
+
+ bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
+ bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
+
+ if(tjDecompress2(handle, jpegBuf, (unsigned long)jpegSize, dstBuf, width,
+ pitch, height, pf, flags)==-1)
+ {
+ (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
+ (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
+ dstBuf=jpegBuf=NULL;
+ _throw(tjGetErrorStr());
+ }
+
+ bailout:
+ if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
+ if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
+ return;
+}
+
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIII
+ (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jintArray dst,
+ jint width, jint pitch, jint height, jint pf, jint flags)
+{
+ tjhandle handle=0;
+ jsize arraySize=0;
+ unsigned char *jpegBuf=NULL, *dstBuf=NULL;
+
+ gethandle();
+
+ if(pf<0 || pf>=org_libjpegturbo_turbojpeg_TJ_NUMPF)
+ _throw("Invalid argument in decompress()");
+ if(org_libjpegturbo_turbojpeg_TJ_NUMPF!=TJ_NUMPF)
+ _throw("Mismatch between Java and C API");
+ if(tjPixelSize[pf]!=sizeof(jint))
+ _throw("Pixel format must be 32-bit when decompressing to an integer buffer.");
+
+ if((*env)->GetArrayLength(env, src)<jpegSize)
+ _throw("Source buffer is not large enough");
+ arraySize=(pitch==0)? width*height:pitch*height;
+ if((*env)->GetArrayLength(env, dst)<arraySize)
+ _throw("Destination buffer is not large enough");
+
+ bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
+ bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
+
+ if(tjDecompress2(handle, jpegBuf, (unsigned long)jpegSize, dstBuf, width,
+ pitch*sizeof(jint), height, pf, flags)==-1)
+ {
+ (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
+ (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
+ dstBuf=jpegBuf=NULL;
+ _throw(tjGetErrorStr());
+ }
+
+ bailout:
+ if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
+ if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
+ return;
+}
+
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV
+ (JNIEnv *env, jobject obj, jbyteArray src, jint jpegSize, jbyteArray dst,
+ jint flags)
+{
+ tjhandle handle=0;
+ unsigned char *jpegBuf=NULL, *dstBuf=NULL;
+ int jpegSubsamp=-1, jpegWidth=0, jpegHeight=0;
+
+ gethandle();
+
+ if((*env)->GetArrayLength(env, src)<jpegSize)
+ _throw("Source buffer is not large enough");
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I"));
+ jpegSubsamp=(int)(*env)->GetIntField(env, obj, _fid);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I"));
+ jpegWidth=(int)(*env)->GetIntField(env, obj, _fid);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I"));
+ jpegHeight=(int)(*env)->GetIntField(env, obj, _fid);
+ if((*env)->GetArrayLength(env, dst)
+ <(jsize)tjBufSizeYUV(jpegWidth, jpegHeight, jpegSubsamp))
+ _throw("Destination buffer is not large enough");
+
+ bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, src, 0));
+ bailif0(dstBuf=(*env)->GetPrimitiveArrayCritical(env, dst, 0));
+
+ if(tjDecompressToYUV(handle, jpegBuf, (unsigned long)jpegSize, dstBuf,
+ flags)==-1)
+ {
+ (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
+ (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
+ dstBuf=jpegBuf=NULL;
+ _throw(tjGetErrorStr());
+ }
+
+ bailout:
+ if(dstBuf) (*env)->ReleasePrimitiveArrayCritical(env, dst, dstBuf, 0);
+ if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, src, jpegBuf, 0);
+ return;
+}
+
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_init
+ (JNIEnv *env, jobject obj)
+{
+ jclass cls;
+ jfieldID fid;
+ tjhandle handle;
+
+ if((handle=tjInitTransform())==NULL) _throw(tjGetErrorStr());
+
+ bailif0(cls=(*env)->GetObjectClass(env, obj));
+ bailif0(fid=(*env)->GetFieldID(env, cls, "handle", "J"));
+ (*env)->SetLongField(env, obj, fid, (jlong)handle);
+
+ bailout:
+ return;
+}
+
+typedef struct _JNICustomFilterParams
+{
+ JNIEnv *env;
+ jobject tobj;
+ jobject cfobj;
+} JNICustomFilterParams;
+
+static int JNICustomFilter(short *coeffs, tjregion arrayRegion,
+ tjregion planeRegion, int componentIndex, int transformIndex,
+ tjtransform *transform)
+{
+ JNICustomFilterParams *params=(JNICustomFilterParams *)transform->data;
+ JNIEnv *env=params->env;
+ jobject tobj=params->tobj, cfobj=params->cfobj;
+ jobject arrayRegionObj, planeRegionObj, bufobj, borobj;
+ jclass cls; jmethodID mid; jfieldID fid;
+
+ bailif0(bufobj=(*env)->NewDirectByteBuffer(env, coeffs,
+ sizeof(short)*arrayRegion.w*arrayRegion.h));
+ bailif0(cls=(*env)->FindClass(env, "java/nio/ByteOrder"));
+ bailif0(mid=(*env)->GetStaticMethodID(env, cls, "nativeOrder",
+ "()Ljava/nio/ByteOrder;"));
+ bailif0(borobj=(*env)->CallStaticObjectMethod(env, cls, mid));
+ bailif0(cls=(*env)->GetObjectClass(env, bufobj));
+ bailif0(mid=(*env)->GetMethodID(env, cls, "order",
+ "(Ljava/nio/ByteOrder;)Ljava/nio/ByteBuffer;"));
+ (*env)->CallObjectMethod(env, bufobj, mid, borobj);
+ bailif0(mid=(*env)->GetMethodID(env, cls, "asShortBuffer",
+ "()Ljava/nio/ShortBuffer;"));
+ bailif0(bufobj=(*env)->CallObjectMethod(env, bufobj, mid));
+
+ bailif0(cls=(*env)->FindClass(env, "java/awt/Rectangle"));
+ bailif0(arrayRegionObj=(*env)->AllocObject(env, cls));
+ bailif0(fid=(*env)->GetFieldID(env, cls, "x", "I"));
+ (*env)->SetIntField(env, arrayRegionObj, fid, arrayRegion.x);
+ bailif0(fid=(*env)->GetFieldID(env, cls, "y", "I"));
+ (*env)->SetIntField(env, arrayRegionObj, fid, arrayRegion.y);
+ bailif0(fid=(*env)->GetFieldID(env, cls, "width", "I"));
+ (*env)->SetIntField(env, arrayRegionObj, fid, arrayRegion.w);
+ bailif0(fid=(*env)->GetFieldID(env, cls, "height", "I"));
+ (*env)->SetIntField(env, arrayRegionObj, fid, arrayRegion.h);
+
+ bailif0(planeRegionObj=(*env)->AllocObject(env, cls));
+ bailif0(fid=(*env)->GetFieldID(env, cls, "x", "I"));
+ (*env)->SetIntField(env, planeRegionObj, fid, planeRegion.x);
+ bailif0(fid=(*env)->GetFieldID(env, cls, "y", "I"));
+ (*env)->SetIntField(env, planeRegionObj, fid, planeRegion.y);
+ bailif0(fid=(*env)->GetFieldID(env, cls, "width", "I"));
+ (*env)->SetIntField(env, planeRegionObj, fid, planeRegion.w);
+ bailif0(fid=(*env)->GetFieldID(env, cls, "height", "I"));
+ (*env)->SetIntField(env, planeRegionObj, fid, planeRegion.h);
+
+ bailif0(cls=(*env)->GetObjectClass(env, cfobj));
+ bailif0(mid=(*env)->GetMethodID(env, cls, "customFilter",
+ "(Ljava/nio/ShortBuffer;Ljava/awt/Rectangle;Ljava/awt/Rectangle;IILorg/libjpegturbo/turbojpeg/TJTransform;)V"));
+ (*env)->CallVoidMethod(env, cfobj, mid, bufobj, arrayRegionObj,
+ planeRegionObj, componentIndex, transformIndex, tobj);
+
+ return 0;
+
+ bailout:
+ return -1;
+}
+
+JNIEXPORT jintArray JNICALL Java_org_libjpegturbo_turbojpeg_TJTransformer_transform
+ (JNIEnv *env, jobject obj, jbyteArray jsrcBuf, jint jpegSize,
+ jobjectArray dstobjs, jobjectArray tobjs, jint flags)
+{
+ tjhandle handle=0; int i;
+ unsigned char *jpegBuf=NULL, **dstBufs=NULL; jsize n=0;
+ unsigned long *dstSizes=NULL; tjtransform *t=NULL;
+ jbyteArray *jdstBufs=NULL;
+ int jpegWidth=0, jpegHeight=0, jpegSubsamp;
+ jintArray jdstSizes=0; jint *dstSizesi=NULL;
+ JNICustomFilterParams *params=NULL;
+
+ gethandle();
+
+ if((*env)->GetArrayLength(env, jsrcBuf)<jpegSize)
+ _throw("Source buffer is not large enough");
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegWidth", "I"));
+ jpegWidth=(int)(*env)->GetIntField(env, obj, _fid);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegHeight", "I"));
+ jpegHeight=(int)(*env)->GetIntField(env, obj, _fid);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "jpegSubsamp", "I"));
+ jpegSubsamp=(int)(*env)->GetIntField(env, obj, _fid);
+
+ n=(*env)->GetArrayLength(env, dstobjs);
+ if(n!=(*env)->GetArrayLength(env, tobjs))
+ _throw("Mismatch between size of transforms array and destination buffers array");
+
+ if((dstBufs=(unsigned char **)malloc(sizeof(unsigned char *)*n))==NULL)
+ _throw("Memory allocation failure");
+ if((jdstBufs=(jbyteArray *)malloc(sizeof(jbyteArray)*n))==NULL)
+ _throw("Memory allocation failure");
+ if((dstSizes=(unsigned long *)malloc(sizeof(unsigned long)*n))==NULL)
+ _throw("Memory allocation failure");
+ if((t=(tjtransform *)malloc(sizeof(tjtransform)*n))==NULL)
+ _throw("Memory allocation failure");
+ if((params=(JNICustomFilterParams *)malloc(sizeof(JNICustomFilterParams)*n))
+ ==NULL)
+ _throw("Memory allocation failure");
+ for(i=0; i<n; i++)
+ {
+ dstBufs[i]=NULL; jdstBufs[i]=NULL; dstSizes[i]=0;
+ memset(&t[i], 0, sizeof(tjtransform));
+ memset(¶ms[i], 0, sizeof(JNICustomFilterParams));
+ }
+
+ for(i=0; i<n; i++)
+ {
+ jobject tobj, cfobj;
+
+ bailif0(tobj=(*env)->GetObjectArrayElement(env, tobjs, i));
+ bailif0(_cls=(*env)->GetObjectClass(env, tobj));
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "op", "I"));
+ t[i].op=(*env)->GetIntField(env, tobj, _fid);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "options", "I"));
+ t[i].options=(*env)->GetIntField(env, tobj, _fid);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "x", "I"));
+ t[i].r.x=(*env)->GetIntField(env, tobj, _fid);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "y", "I"));
+ t[i].r.y=(*env)->GetIntField(env, tobj, _fid);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "width", "I"));
+ t[i].r.w=(*env)->GetIntField(env, tobj, _fid);
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "height", "I"));
+ t[i].r.h=(*env)->GetIntField(env, tobj, _fid);
+
+ bailif0(_fid=(*env)->GetFieldID(env, _cls, "cf",
+ "Lorg/libjpegturbo/turbojpeg/TJCustomFilter;"));
+ cfobj=(*env)->GetObjectField(env, tobj, _fid);
+ if(cfobj)
+ {
+ params[i].env=env;
+ params[i].tobj=tobj;
+ params[i].cfobj=cfobj;
+ t[i].customFilter=JNICustomFilter;
+ t[i].data=(void *)¶ms[i];
+ }
+ }
+
+ bailif0(jpegBuf=(*env)->GetPrimitiveArrayCritical(env, jsrcBuf, 0));
+ for(i=0; i<n; i++)
+ {
+ int w=jpegWidth, h=jpegHeight;
+ if(t[i].r.w!=0) w=t[i].r.w;
+ if(t[i].r.h!=0) h=t[i].r.h;
+ bailif0(jdstBufs[i]=(*env)->GetObjectArrayElement(env, dstobjs, i));
+ if((*env)->GetArrayLength(env, jdstBufs[i])<tjBufSize(w, h, jpegSubsamp))
+ _throw("Destination buffer is not large enough");
+ bailif0(dstBufs[i]=(*env)->GetPrimitiveArrayCritical(env, jdstBufs[i], 0));
+ }
+
+ if(tjTransform(handle, jpegBuf, jpegSize, n, dstBufs, dstSizes, t,
+ flags|TJFLAG_NOREALLOC)==-1)
+ {
+ (*env)->ReleasePrimitiveArrayCritical(env, jsrcBuf, jpegBuf, 0);
+ jpegBuf=NULL;
+ for(i=0; i<n; i++)
+ {
+ (*env)->ReleasePrimitiveArrayCritical(env, jdstBufs[i], dstBufs[i], 0);
+ dstBufs[i]=NULL;
+ }
+ _throw(tjGetErrorStr());
+ }
+
+ jdstSizes=(*env)->NewIntArray(env, n);
+ bailif0(dstSizesi=(*env)->GetIntArrayElements(env, jdstSizes, 0));
+ for(i=0; i<n; i++) dstSizesi[i]=(int)dstSizes[i];
+
+ bailout:
+ if(jpegBuf) (*env)->ReleasePrimitiveArrayCritical(env, jsrcBuf, jpegBuf, 0);
+ if(dstBufs)
+ {
+ for(i=0; i<n; i++)
+ {
+ if(dstBufs[i] && jdstBufs && jdstBufs[i])
+ (*env)->ReleasePrimitiveArrayCritical(env, jdstBufs[i], dstBufs[i], 0);
+ }
+ free(dstBufs);
+ }
+ if(jdstBufs) free(jdstBufs);
+ if(dstSizes) free(dstSizes);
+ if(dstSizesi) (*env)->ReleaseIntArrayElements(env, jdstSizes, dstSizesi, 0);
+ if(t) free(t);
+ return jdstSizes;
+}
+
+JNIEXPORT void JNICALL Java_org_libjpegturbo_turbojpeg_TJDecompressor_destroy
+ (JNIEnv *env, jobject obj)
+{
+ Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy(env, obj);
+}
diff --git a/turbojpeg-mapfile b/turbojpeg-mapfile
index aa0b658..bd1ac71 100755
--- a/turbojpeg-mapfile
+++ b/turbojpeg-mapfile
@@ -21,3 +21,18 @@
tjDecompressToYUV;
tjEncodeYUV;
} TURBOJPEG_1.0;
+
+TURBOJPEG_1.2
+{
+ global:
+ tjAlloc;
+ tjBufSize;
+ tjBufSizeYUV;
+ tjCompress2;
+ tjDecompress2;
+ tjEncodeYUV2;
+ tjFree;
+ tjGetScalingFactors;
+ tjInitTransform;
+ tjTransform;
+} TURBOJPEG_1.1;
diff --git a/turbojpeg-mapfile.jni b/turbojpeg-mapfile.jni
new file mode 100755
index 0000000..9c046ce
--- /dev/null
+++ b/turbojpeg-mapfile.jni
@@ -0,0 +1,55 @@
+TURBOJPEG_1.0
+{
+ global:
+ tjInitCompress;
+ tjCompress;
+ TJBUFSIZE;
+ tjInitDecompress;
+ tjDecompressHeader;
+ tjDecompress;
+ tjDestroy;
+ tjGetErrorStr;
+ local:
+ *;
+};
+
+TURBOJPEG_1.1
+{
+ global:
+ TJBUFSIZEYUV;
+ tjDecompressHeader2;
+ tjDecompressToYUV;
+ tjEncodeYUV;
+} TURBOJPEG_1.0;
+
+TURBOJPEG_1.2
+{
+ global:
+ tjAlloc;
+ tjBufSize;
+ tjBufSizeYUV;
+ tjCompress2;
+ tjDecompress2;
+ tjEncodeYUV2;
+ tjFree;
+ tjGetScalingFactors;
+ tjInitTransform;
+ tjTransform;
+ Java_org_libjpegturbo_turbojpeg_TJ_bufSize;
+ Java_org_libjpegturbo_turbojpeg_TJ_bufSizeYUV;
+ Java_org_libjpegturbo_turbojpeg_TJ_getScalingFactors;
+ Java_org_libjpegturbo_turbojpeg_TJCompressor_init;
+ Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3BIIII_3BIII;
+ Java_org_libjpegturbo_turbojpeg_TJCompressor_compress___3IIIII_3BIII;
+ Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3BIIII_3BII;
+ Java_org_libjpegturbo_turbojpeg_TJCompressor_encodeYUV___3IIIII_3BII;
+ Java_org_libjpegturbo_turbojpeg_TJCompressor_destroy;
+ Java_org_libjpegturbo_turbojpeg_TJDecompressor_init;
+ Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressHeader;
+ Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3BIIIII;
+ Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompress___3BI_3IIIIII;
+ Java_org_libjpegturbo_turbojpeg_TJDecompressor_decompressToYUV;
+ Java_org_libjpegturbo_turbojpeg_TJDecompressor_destroy;
+ Java_org_libjpegturbo_turbojpeg_TJTransformer_init;
+ Java_org_libjpegturbo_turbojpeg_TJTransformer_transform;
+} TURBOJPEG_1.1;
diff --git a/turbojpeg.c b/turbojpeg.c
new file mode 100644
index 0000000..9fc60ce
--- /dev/null
+++ b/turbojpeg.c
@@ -0,0 +1,1089 @@
+/*
+ * Copyright (C)2009-2011 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:
+ *
+ * - 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.
+ */
+
+/* TurboJPEG/OSS: this implements the TurboJPEG API using libjpeg-turbo */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <jinclude.h>
+#define JPEG_INTERNALS
+#include <jpeglib.h>
+#include <jerror.h>
+#include <setjmp.h>
+#include "./turbojpeg.h"
+#include "./tjutil.h"
+#include "transupp.h"
+
+extern void jpeg_mem_dest_tj(j_compress_ptr, unsigned char **,
+ unsigned long *, boolean);
+extern void jpeg_mem_src_tj(j_decompress_ptr, unsigned char *, unsigned long);
+
+#define PAD(v, p) ((v+(p)-1)&(~((p)-1)))
+
+
+/* Error handling (based on example in example.c) */
+
+static char errStr[JMSG_LENGTH_MAX]="No error";
+
+struct my_error_mgr
+{
+ struct jpeg_error_mgr pub;
+ jmp_buf setjmp_buffer;
+};
+typedef struct my_error_mgr *my_error_ptr;
+
+static void my_error_exit(j_common_ptr cinfo)
+{
+ my_error_ptr myerr=(my_error_ptr)cinfo->err;
+ (*cinfo->err->output_message)(cinfo);
+ longjmp(myerr->setjmp_buffer, 1);
+}
+
+/* Based on output_message() in jerror.c */
+
+static void my_output_message(j_common_ptr cinfo)
+{
+ (*cinfo->err->format_message)(cinfo, errStr);
+}
+
+
+/* Global structures, macros, etc. */
+
+enum {COMPRESS=1, DECOMPRESS=2};
+
+typedef struct _tjinstance
+{
+ struct jpeg_compress_struct cinfo;
+ struct jpeg_decompress_struct dinfo;
+ struct my_error_mgr jerr;
+ int init;
+} tjinstance;
+
+static const int pixelsize[TJ_NUMSAMP]={3, 3, 3, 1, 3};
+
+static const JXFORM_CODE xformtypes[TJ_NUMXOP]=
+{
+ JXFORM_NONE, JXFORM_FLIP_H, JXFORM_FLIP_V, JXFORM_TRANSPOSE,
+ JXFORM_TRANSVERSE, JXFORM_ROT_90, JXFORM_ROT_180, JXFORM_ROT_270
+};
+
+#define NUMSF 4
+static const tjscalingfactor sf[NUMSF]={
+ {1, 1},
+ {1, 2},
+ {1, 4},
+ {1, 8}
+};
+
+#define _throw(m) {snprintf(errStr, JMSG_LENGTH_MAX, "%s", m); \
+ retval=-1; goto bailout;}
+#define getinstance(handle) tjinstance *this=(tjinstance *)handle; \
+ 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;
+
+static int getPixelFormat(int pixelSize, int flags)
+{
+ if(pixelSize==1) return TJPF_GRAY;
+ if(pixelSize==3)
+ {
+ if(flags&TJ_BGR) return TJPF_BGR;
+ else return TJPF_RGB;
+ }
+ if(pixelSize==4)
+ {
+ if(flags&TJ_ALPHAFIRST)
+ {
+ if(flags&TJ_BGR) return TJPF_XBGR;
+ else return TJPF_XRGB;
+ }
+ else
+ {
+ if(flags&TJ_BGR) return TJPF_BGRX;
+ else return TJPF_RGBX;
+ }
+ }
+ return -1;
+}
+
+static int setCompDefaults(struct jpeg_compress_struct *cinfo,
+ int pixelFormat, int subsamp, int jpegQual)
+{
+ int retval=0;
+
+ switch(pixelFormat)
+ {
+ case TJPF_GRAY:
+ cinfo->in_color_space=JCS_GRAYSCALE; break;
+ #if JCS_EXTENSIONS==1
+ case TJPF_RGB:
+ cinfo->in_color_space=JCS_EXT_RGB; break;
+ case TJPF_BGR:
+ cinfo->in_color_space=JCS_EXT_BGR; break;
+ case TJPF_RGBX:
+ cinfo->in_color_space=JCS_EXT_RGBX; break;
+ case TJPF_BGRX:
+ cinfo->in_color_space=JCS_EXT_BGRX; break;
+ case TJPF_XRGB:
+ cinfo->in_color_space=JCS_EXT_XRGB; break;
+ case TJPF_XBGR:
+ cinfo->in_color_space=JCS_EXT_XBGR; break;
+ #else
+ case TJPF_RGB:
+ if(RGB_RED==0 && RGB_GREEN==1 && RGB_BLUE==2 && RGB_PIXELSIZE==3)
+ {
+ cinfo->in_color_space=JCS_RGB; break;
+ }
+ default:
+ _throw("Unsupported pixel format");
+ #endif
+ }
+
+ cinfo->input_components=tjPixelSize[pixelFormat];
+ jpeg_set_defaults(cinfo);
+ if(jpegQual>=0)
+ {
+ jpeg_set_quality(cinfo, jpegQual, TRUE);
+ if(jpegQual>=96) cinfo->dct_method=JDCT_ISLOW;
+ else cinfo->dct_method=JDCT_FASTEST;
+ }
+ if(subsamp==TJSAMP_GRAY)
+ jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
+ else
+ jpeg_set_colorspace(cinfo, JCS_YCbCr);
+
+ cinfo->comp_info[0].h_samp_factor=tjMCUWidth[subsamp]/8;
+ cinfo->comp_info[1].h_samp_factor=1;
+ cinfo->comp_info[2].h_samp_factor=1;
+ cinfo->comp_info[0].v_samp_factor=tjMCUHeight[subsamp]/8;
+ cinfo->comp_info[1].v_samp_factor=1;
+ cinfo->comp_info[2].v_samp_factor=1;
+
+ #if JCS_EXTENSIONS!=1
+ bailout:
+ #endif
+ return retval;
+}
+
+static int setDecompDefaults(struct jpeg_decompress_struct *dinfo,
+ int pixelFormat)
+{
+ int retval=0;
+
+ switch(pixelFormat)
+ {
+ case TJPF_GRAY:
+ dinfo->out_color_space=JCS_GRAYSCALE; break;
+ #if JCS_EXTENSIONS==1
+ case TJPF_RGB:
+ dinfo->out_color_space=JCS_EXT_RGB; break;
+ case TJPF_BGR:
+ dinfo->out_color_space=JCS_EXT_BGR; break;
+ case TJPF_RGBX:
+ dinfo->out_color_space=JCS_EXT_RGBX; break;
+ case TJPF_BGRX:
+ dinfo->out_color_space=JCS_EXT_BGRX; break;
+ case TJPF_XRGB:
+ dinfo->out_color_space=JCS_EXT_XRGB; break;
+ case TJPF_XBGR:
+ dinfo->out_color_space=JCS_EXT_XBGR; break;
+ #else
+ case TJPF_RGB:
+ if(RGB_RED==0 && RGB_GREEN==1 && RGB_BLUE==2 && RGB_PIXELSIZE==3)
+ {
+ dinfo->out_color_space=JCS_RGB; break;
+ }
+ default:
+ _throw("Unsupported pixel format");
+ #endif
+ }
+
+ #if JCS_EXTENSIONS!=1
+ bailout:
+ #endif
+ return retval;
+}
+
+
+static int getSubsamp(j_decompress_ptr dinfo)
+{
+ int retval=-1, i, k;
+ for(i=0; i<NUMSUBOPT; i++)
+ {
+ if(dinfo->num_components==pixelsize[i])
+ {
+ if(dinfo->comp_info[0].h_samp_factor==tjMCUWidth[i]/8
+ && dinfo->comp_info[0].v_samp_factor==tjMCUHeight[i]/8)
+ {
+ int match=0;
+ for(k=1; k<dinfo->num_components; k++)
+ {
+ if(dinfo->comp_info[k].h_samp_factor==1
+ && dinfo->comp_info[k].v_samp_factor==1)
+ match++;
+ }
+ if(match==dinfo->num_components-1)
+ {
+ retval=i; break;
+ }
+ }
+ }
+ }
+ return retval;
+}
+
+
+/* General API functions */
+
+DLLEXPORT char* DLLCALL tjGetErrorStr(void)
+{
+ return errStr;
+}
+
+
+DLLEXPORT int DLLCALL tjDestroy(tjhandle handle)
+{
+ getinstance(handle);
+ if(setjmp(this->jerr.setjmp_buffer)) return -1;
+ if(this->init&COMPRESS) jpeg_destroy_compress(cinfo);
+ if(this->init&DECOMPRESS) jpeg_destroy_decompress(dinfo);
+ free(this);
+ return 0;
+}
+
+
+/* These are exposed mainly because Windows can't malloc() and free() across
+ DLL boundaries except when the CRT DLL is used, and we don't use the CRT DLL
+ with turbojpeg.dll for compatibility reasons. However, these functions
+ can potentially be used for other purposes by different implementations. */
+
+DLLEXPORT void DLLCALL tjFree(unsigned char *buf)
+{
+ if(buf) free(buf);
+}
+
+
+DLLEXPORT unsigned char *DLLCALL tjAlloc(int bytes)
+{
+ return (unsigned char *)malloc(bytes);
+}
+
+
+/* Compressor */
+
+static tjhandle _tjInitCompress(tjinstance *this)
+{
+ unsigned char buffer[1], *buf=buffer; unsigned long size=1;
+
+ /* This is also straight out of example.c */
+ 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;
+
+ if(setjmp(this->jerr.setjmp_buffer))
+ {
+ /* If we get here, the JPEG code has signaled an error. */
+ if(this) free(this); return NULL;
+ }
+
+ jpeg_create_compress(&this->cinfo);
+ /* Make an initial call so it will create the destination manager */
+ jpeg_mem_dest_tj(&this->cinfo, &buf, &size, 0);
+
+ this->init|=COMPRESS;
+ return (tjhandle)this;
+}
+
+DLLEXPORT tjhandle DLLCALL tjInitCompress(void)
+{
+ tjinstance *this=NULL;
+ if((this=(tjinstance *)malloc(sizeof(tjinstance)))==NULL)
+ {
+ snprintf(errStr, JMSG_LENGTH_MAX,
+ "tjInitCompress(): Memory allocation failure");
+ return NULL;
+ }
+ MEMZERO(this, sizeof(tjinstance));
+ return _tjInitCompress(this);
+}
+
+
+DLLEXPORT unsigned long DLLCALL tjBufSize(int width, int height,
+ int jpegSubsamp)
+{
+ unsigned long retval=0; int mcuw, mcuh, chromasf;
+ if(width<1 || height<1 || jpegSubsamp<0 || jpegSubsamp>=NUMSUBOPT)
+ _throw("tjBufSize(): Invalid argument");
+
+ // This allows for rare corner cases in which a JPEG image can actually be
+ // larger than the uncompressed input (we wouldn't mention it if it hadn't
+ // happened before.)
+ mcuw=tjMCUWidth[jpegSubsamp];
+ mcuh=tjMCUHeight[jpegSubsamp];
+ chromasf=jpegSubsamp==TJSAMP_GRAY? 0: 4*64/(mcuw*mcuh);
+ retval=PAD(width, mcuw) * PAD(height, mcuh) * (2 + chromasf) + 2048;
+
+ bailout:
+ return retval;
+}
+
+
+DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height)
+{
+ unsigned long retval=0;
+ if(width<1 || height<1)
+ _throw("TJBUFSIZE(): Invalid argument");
+
+ // This allows for rare corner cases in which a JPEG image can actually be
+ // larger than the uncompressed input (we wouldn't mention it if it hadn't
+ // happened before.)
+ retval=PAD(width, 16) * PAD(height, 16) * 6 + 2048;
+
+ bailout:
+ return retval;
+}
+
+
+DLLEXPORT unsigned long DLLCALL tjBufSizeYUV(int width, int height,
+ int subsamp)
+{
+ unsigned long retval=0;
+ int pw, ph, cw, ch;
+ if(width<1 || height<1 || subsamp<0 || subsamp>=NUMSUBOPT)
+ _throw("tjBufSizeYUV(): Invalid argument");
+ pw=PAD(width, tjMCUWidth[subsamp]/8);
+ ph=PAD(height, tjMCUHeight[subsamp]/8);
+ cw=pw*8/tjMCUWidth[subsamp]; ch=ph*8/tjMCUHeight[subsamp];
+ retval=PAD(pw, 4)*ph + (subsamp==TJSAMP_GRAY? 0:PAD(cw, 4)*ch*2);
+
+ bailout:
+ return retval;
+}
+
+
+DLLEXPORT unsigned long DLLCALL TJBUFSIZEYUV(int width, int height,
+ int subsamp)
+{
+ return tjBufSizeYUV(width, height, subsamp);
+}
+
+
+DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf,
+ int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf,
+ unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)
+{
+ int i, retval=0, alloc=1; JSAMPROW *row_pointer=NULL;
+
+ getinstance(handle)
+ if((this->init&COMPRESS)==0)
+ _throw("tjCompress2(): Instance has not been initialized for compression");
+
+ if(srcBuf==NULL || width<=0 || pitch<0 || height<=0 || pixelFormat<0
+ || pixelFormat>=TJ_NUMPF || jpegBuf==NULL || jpegSize==NULL
+ || 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];
+
+ cinfo->image_width=width;
+ cinfo->image_height=height;
+
+ if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
+ else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
+ else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
+
+ if(flags&TJFLAG_NOREALLOC)
+ {
+ alloc=0; *jpegSize=tjBufSize(width, height, jpegSubsamp);
+ }
+ jpeg_mem_dest_tj(cinfo, jpegBuf, jpegSize, alloc);
+ if(setCompDefaults(cinfo, pixelFormat, jpegSubsamp, jpegQual)==-1)
+ 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) row_pointer[i]=&srcBuf[(height-i-1)*pitch];
+ else row_pointer[i]=&srcBuf[i*pitch];
+ }
+ while(cinfo->next_scanline<cinfo->image_height)
+ {
+ jpeg_write_scanlines(cinfo, &row_pointer[cinfo->next_scanline],
+ cinfo->image_height-cinfo->next_scanline);
+ }
+ jpeg_finish_compress(cinfo);
+
+ bailout:
+ if(cinfo->global_state>CSTATE_START) jpeg_abort_compress(cinfo);
+ if(row_pointer) free(row_pointer);
+ return retval;
+}
+
+DLLEXPORT int DLLCALL tjCompress(tjhandle handle, unsigned char *srcBuf,
+ int width, int pitch, int height, int pixelSize, unsigned char *jpegBuf,
+ unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags)
+{
+ int retval=0; unsigned long size;
+ if(flags&TJ_YUV)
+ {
+ size=tjBufSizeYUV(width, height, jpegSubsamp);
+ retval=tjEncodeYUV2(handle, srcBuf, width, pitch, height,
+ getPixelFormat(pixelSize, flags), jpegBuf, jpegSubsamp, flags);
+ }
+ else
+ {
+ retval=tjCompress2(handle, srcBuf, width, pitch, height,
+ getPixelFormat(pixelSize, flags), &jpegBuf, &size, jpegSubsamp, jpegQual,
+ flags|TJFLAG_NOREALLOC);
+ }
+ *jpegSize=size;
+ return retval;
+}
+
+
+DLLEXPORT int DLLCALL tjEncodeYUV2(tjhandle handle, unsigned char *srcBuf,
+ int width, int pitch, int height, int pixelFormat, unsigned char *dstBuf,
+ int subsamp, int flags)
+{
+ int i, retval=0; JSAMPROW *row_pointer=NULL;
+ JSAMPLE *_tmpbuf[MAX_COMPONENTS], *_tmpbuf2[MAX_COMPONENTS];
+ JSAMPROW *tmpbuf[MAX_COMPONENTS], *tmpbuf2[MAX_COMPONENTS];
+ JSAMPROW *outbuf[MAX_COMPONENTS];
+ int row, pw, ph, cw[MAX_COMPONENTS], ch[MAX_COMPONENTS];
+ JSAMPLE *ptr=dstBuf;
+ unsigned long yuvsize=0;
+ jpeg_component_info *compptr;
+
+ getinstance(handle);
+ if((this->init&COMPRESS)==0)
+ _throw("tjEncodeYUV2(): Instance has not been initialized for compression");
+
+ for(i=0; i<MAX_COMPONENTS; i++)
+ {
+ tmpbuf[i]=NULL; _tmpbuf[i]=NULL;
+ tmpbuf2[i]=NULL; _tmpbuf2[i]=NULL; outbuf[i]=NULL;
+ }
+
+ if(srcBuf==NULL || width<=0 || pitch<0 || height<=0 || pixelFormat<0
+ || pixelFormat>=TJ_NUMPF || dstBuf==NULL || subsamp<0
+ || subsamp>=NUMSUBOPT)
+ _throw("tjEncodeYUV2(): 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];
+
+ cinfo->image_width=width;
+ cinfo->image_height=height;
+
+ if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
+ else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
+ else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
+
+ yuvsize=tjBufSizeYUV(width, height, subsamp);
+ jpeg_mem_dest_tj(cinfo, &dstBuf, &yuvsize, 0);
+ if(setCompDefaults(cinfo, pixelFormat, subsamp, -1)==-1) return -1;
+
+ jpeg_start_compress(cinfo, TRUE);
+ pw=PAD(width, cinfo->max_h_samp_factor);
+ ph=PAD(height, cinfo->max_v_samp_factor);
+
+ if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph))==NULL)
+ _throw("tjEncodeYUV2(): Memory allocation failure");
+ for(i=0; i<height; i++)
+ {
+ if(flags&TJFLAG_BOTTOMUP) row_pointer[i]=&srcBuf[(height-i-1)*pitch];
+ else row_pointer[i]=&srcBuf[i*pitch];
+ }
+ if(height<ph)
+ for(i=height; i<ph; i++) row_pointer[i]=row_pointer[height-1];
+
+ for(i=0; i<cinfo->num_components; i++)
+ {
+ compptr=&cinfo->comp_info[i];
+ _tmpbuf[i]=(JSAMPLE *)malloc(
+ PAD((compptr->width_in_blocks*cinfo->max_h_samp_factor*DCTSIZE)
+ /compptr->h_samp_factor, 16) * cinfo->max_v_samp_factor + 16);
+ if(!_tmpbuf[i]) _throw("tjEncodeYUV2(): Memory allocation failure");
+ tmpbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*cinfo->max_v_samp_factor);
+ if(!tmpbuf[i]) _throw("tjEncodeYUV2(): Memory allocation failure");
+ for(row=0; row<cinfo->max_v_samp_factor; row++)
+ {
+ unsigned char *_tmpbuf_aligned=
+ (unsigned char *)PAD((size_t)_tmpbuf[i], 16);
+ tmpbuf[i][row]=&_tmpbuf_aligned[
+ PAD((compptr->width_in_blocks*cinfo->max_h_samp_factor*DCTSIZE)
+ /compptr->h_samp_factor, 16) * row];
+ }
+ _tmpbuf2[i]=(JSAMPLE *)malloc(PAD(compptr->width_in_blocks*DCTSIZE, 16)
+ * compptr->v_samp_factor + 16);
+ if(!_tmpbuf2[i]) _throw("tjEncodeYUV2(): Memory allocation failure");
+ tmpbuf2[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*compptr->v_samp_factor);
+ if(!tmpbuf2[i]) _throw("tjEncodeYUV2(): Memory allocation failure");
+ for(row=0; row<compptr->v_samp_factor; row++)
+ {
+ unsigned char *_tmpbuf2_aligned=
+ (unsigned char *)PAD((size_t)_tmpbuf2[i], 16);
+ tmpbuf2[i][row]=&_tmpbuf2_aligned[
+ PAD(compptr->width_in_blocks*DCTSIZE, 16) * row];
+ }
+ cw[i]=pw*compptr->h_samp_factor/cinfo->max_h_samp_factor;
+ ch[i]=ph*compptr->v_samp_factor/cinfo->max_v_samp_factor;
+ outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]);
+ if(!outbuf[i]) _throw("tjEncodeYUV2(): Memory allocation failure");
+ for(row=0; row<ch[i]; row++)
+ {
+ outbuf[i][row]=ptr;
+ ptr+=PAD(cw[i], 4);
+ }
+ }
+ if(yuvsize!=(unsigned long)(ptr-dstBuf))
+ _throw("tjEncodeYUV2(): Generated image is not the correct size");
+
+ for(row=0; row<ph; row+=cinfo->max_v_samp_factor)
+ {
+ (*cinfo->cconvert->color_convert)(cinfo, &row_pointer[row], tmpbuf, 0,
+ cinfo->max_v_samp_factor);
+ (cinfo->downsample->downsample)(cinfo, tmpbuf, 0, tmpbuf2, 0);
+ for(i=0, compptr=cinfo->comp_info; i<cinfo->num_components; i++, compptr++)
+ jcopy_sample_rows(tmpbuf2[i], 0, outbuf[i],
+ row*compptr->v_samp_factor/cinfo->max_v_samp_factor,
+ compptr->v_samp_factor, cw[i]);
+ }
+ cinfo->next_scanline+=height;
+ jpeg_abort_compress(cinfo);
+
+ bailout:
+ if(cinfo->global_state>CSTATE_START) jpeg_abort_compress(cinfo);
+ if(row_pointer) free(row_pointer);
+ for(i=0; i<MAX_COMPONENTS; i++)
+ {
+ if(tmpbuf[i]!=NULL) free(tmpbuf[i]);
+ if(_tmpbuf[i]!=NULL) free(_tmpbuf[i]);
+ if(tmpbuf2[i]!=NULL) free(tmpbuf2[i]);
+ if(_tmpbuf2[i]!=NULL) free(_tmpbuf2[i]);
+ if(outbuf[i]!=NULL) free(outbuf[i]);
+ }
+ return retval;
+}
+
+DLLEXPORT int DLLCALL tjEncodeYUV(tjhandle handle, unsigned char *srcBuf,
+ int width, int pitch, int height, int pixelSize, unsigned char *dstBuf,
+ int subsamp, int flags)
+{
+ return tjEncodeYUV2(handle, srcBuf, width, pitch, height,
+ getPixelFormat(pixelSize, flags), dstBuf, subsamp, flags);
+}
+
+
+/* Decompressor */
+
+static tjhandle _tjInitDecompress(tjinstance *this)
+{
+ unsigned char buffer[1];
+
+ /* This is also straight out of example.c */
+ 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;
+
+ if(setjmp(this->jerr.setjmp_buffer))
+ {
+ /* If we get here, the JPEG code has signaled an error. */
+ if(this) free(this); return NULL;
+ }
+
+ jpeg_create_decompress(&this->dinfo);
+ /* Make an initial call so it will create the source manager */
+ jpeg_mem_src_tj(&this->dinfo, buffer, 1);
+
+ this->init|=DECOMPRESS;
+ return (tjhandle)this;
+}
+
+DLLEXPORT tjhandle DLLCALL tjInitDecompress(void)
+{
+ tjinstance *this;
+ if((this=(tjinstance *)malloc(sizeof(tjinstance)))==NULL)
+ {
+ snprintf(errStr, JMSG_LENGTH_MAX,
+ "tjInitDecompress(): Memory allocation failure");
+ return NULL;
+ }
+ MEMZERO(this, sizeof(tjinstance));
+ return _tjInitDecompress(this);
+}
+
+
+DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle handle,
+ unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height,
+ int *jpegSubsamp)
+{
+ int retval=0;
+
+ getinstance(handle);
+ if((this->init&DECOMPRESS)==0)
+ _throw("tjDecompressHeader2(): Instance has not been initialized for decompression");
+
+ if(jpegBuf==NULL || jpegSize<=0 || width==NULL || height==NULL
+ || jpegSubsamp==NULL)
+ _throw("tjDecompressHeader2(): Invalid argument");
+
+ if(setjmp(this->jerr.setjmp_buffer))
+ {
+ /* If we get here, the JPEG code has signaled an error. */
+ return -1;
+ }
+
+ jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize);
+ jpeg_read_header(dinfo, TRUE);
+
+ *width=dinfo->image_width;
+ *height=dinfo->image_height;
+ *jpegSubsamp=getSubsamp(dinfo);
+
+ jpeg_abort_decompress(dinfo);
+
+ if(*jpegSubsamp<0)
+ _throw("tjDecompressHeader2(): Could not determine subsampling type for JPEG image");
+ if(*width<1 || *height<1)
+ _throw("tjDecompressHeader2(): Invalid data returned in header");
+
+ bailout:
+ return retval;
+}
+
+DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle handle,
+ unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height)
+{
+ int jpegSubsamp;
+ return tjDecompressHeader2(handle, jpegBuf, jpegSize, width, height,
+ &jpegSubsamp);
+}
+
+
+DLLEXPORT tjscalingfactor* DLLCALL tjGetScalingFactors(int *numscalingfactors)
+{
+ if(numscalingfactors==NULL)
+ {
+ snprintf(errStr, JMSG_LENGTH_MAX,
+ "tjGetScalingFactors(): Invalid argument");
+ return NULL;
+ }
+
+ *numscalingfactors=NUMSF;
+ return (tjscalingfactor *)sf;
+}
+
+
+DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle, unsigned char *jpegBuf,
+ unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch,
+ int height, int pixelFormat, int flags)
+{
+ int i, retval=0; JSAMPROW *row_pointer=NULL;
+ int jpegwidth, jpegheight, scaledw, scaledh;
+
+ getinstance(handle);
+ if((this->init&DECOMPRESS)==0)
+ _throw("tjDecompress2(): Instance has not been initialized for decompression");
+
+ if(jpegBuf==NULL || jpegSize<=0 || dstBuf==NULL || width<0 || pitch<0
+ || height<0 || pixelFormat<0 || pixelFormat>=TJ_NUMPF)
+ _throw("tjDecompress2(): Invalid argument");
+
+ if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
+ else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
+ else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
+
+ if(setjmp(this->jerr.setjmp_buffer))
+ {
+ /* If we get here, the JPEG code has signaled an error. */
+ retval=-1;
+ goto bailout;
+ }
+
+ jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize);
+ jpeg_read_header(dinfo, TRUE);
+ if(setDecompDefaults(dinfo, pixelFormat)==-1) return -1;
+
+ if(flags&TJFLAG_FASTUPSAMPLE) dinfo->do_fancy_upsampling=FALSE;
+
+ jpegwidth=dinfo->image_width; jpegheight=dinfo->image_height;
+ if(width==0) width=jpegwidth;
+ if(height==0) height=jpegheight;
+ for(i=0; i<NUMSF; i++)
+ {
+ scaledw=TJSCALED(jpegwidth, sf[i]);
+ scaledh=TJSCALED(jpegheight, sf[i]);
+ if(scaledw<=width && scaledh<=height)
+ break;
+ }
+ if(scaledw>width || scaledh>height)
+ _throw("tjDecompress2(): Could not scale down to desired image dimensions");
+ width=scaledw; height=scaledh;
+ dinfo->scale_num=sf[i].num;
+ dinfo->scale_denom=sf[i].denom;
+
+ jpeg_start_decompress(dinfo);
+ if(pitch==0) pitch=dinfo->output_width*tjPixelSize[pixelFormat];
+ if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)
+ *dinfo->output_height))==NULL)
+ _throw("tjDecompress2(): Memory allocation failure");
+ for(i=0; i<(int)dinfo->output_height; i++)
+ {
+ if(flags&TJFLAG_BOTTOMUP)
+ row_pointer[i]=&dstBuf[(dinfo->output_height-i-1)*pitch];
+ else row_pointer[i]=&dstBuf[i*pitch];
+ }
+ while(dinfo->output_scanline<dinfo->output_height)
+ {
+ jpeg_read_scanlines(dinfo, &row_pointer[dinfo->output_scanline],
+ dinfo->output_height-dinfo->output_scanline);
+ }
+ jpeg_finish_decompress(dinfo);
+
+ bailout:
+ if(dinfo->global_state>DSTATE_START) jpeg_abort_decompress(dinfo);
+ if(row_pointer) free(row_pointer);
+ return retval;
+}
+
+DLLEXPORT int DLLCALL tjDecompress(tjhandle handle, unsigned char *jpegBuf,
+ unsigned long jpegSize, unsigned char *dstBuf, int width, int pitch,
+ int height, int pixelSize, int flags)
+{
+ if(flags&TJ_YUV)
+ return tjDecompressToYUV(handle, jpegBuf, jpegSize, dstBuf, flags);
+ else
+ return tjDecompress2(handle, jpegBuf, jpegSize, dstBuf, width, pitch,
+ height, getPixelFormat(pixelSize, flags), flags);
+}
+
+
+DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle handle,
+ unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf,
+ int flags)
+{
+ int i, row, retval=0; JSAMPROW *outbuf[MAX_COMPONENTS];
+ int cw[MAX_COMPONENTS], ch[MAX_COMPONENTS], iw[MAX_COMPONENTS],
+ tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS];
+ JSAMPLE *_tmpbuf=NULL, *ptr=dstBuf; JSAMPROW *tmpbuf[MAX_COMPONENTS];
+
+ getinstance(handle);
+ if((this->init&DECOMPRESS)==0)
+ _throw("tjDecompressToYUV(): Instance has not been initialized for decompression");
+
+ for(i=0; i<MAX_COMPONENTS; i++)
+ {
+ tmpbuf[i]=NULL; outbuf[i]=NULL;
+ }
+
+ if(jpegBuf==NULL || jpegSize<=0 || dstBuf==NULL)
+ _throw("tjDecompressToYUV(): Invalid argument");
+
+ if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
+ else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
+ else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
+
+ if(setjmp(this->jerr.setjmp_buffer))
+ {
+ /* If we get here, the JPEG code has signaled an error. */
+ retval=-1;
+ goto bailout;
+ }
+
+ jpeg_mem_src_tj(dinfo, jpegBuf, jpegSize);
+ jpeg_read_header(dinfo, TRUE);
+
+ for(i=0; i<dinfo->num_components; i++)
+ {
+ jpeg_component_info *compptr=&dinfo->comp_info[i];
+ int ih;
+ iw[i]=compptr->width_in_blocks*DCTSIZE;
+ ih=compptr->height_in_blocks*DCTSIZE;
+ cw[i]=PAD(dinfo->image_width, dinfo->max_h_samp_factor)
+ *compptr->h_samp_factor/dinfo->max_h_samp_factor;
+ ch[i]=PAD(dinfo->image_height, dinfo->max_v_samp_factor)
+ *compptr->v_samp_factor/dinfo->max_v_samp_factor;
+ if(iw[i]!=cw[i] || ih!=ch[i]) usetmpbuf=1;
+ th[i]=compptr->v_samp_factor*DCTSIZE;
+ tmpbufsize+=iw[i]*th[i];
+ if((outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]))==NULL)
+ _throw("tjDecompressToYUV(): Memory allocation failure");
+ for(row=0; row<ch[i]; row++)
+ {
+ outbuf[i][row]=ptr;
+ ptr+=PAD(cw[i], 4);
+ }
+ }
+ if(usetmpbuf)
+ {
+ if((_tmpbuf=(JSAMPLE *)malloc(sizeof(JSAMPLE)*tmpbufsize))==NULL)
+ _throw("tjDecompressToYUV(): Memory allocation failure");
+ ptr=_tmpbuf;
+ for(i=0; i<dinfo->num_components; i++)
+ {
+ if((tmpbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*th[i]))==NULL)
+ _throw("tjDecompressToYUV(): Memory allocation failure");
+ for(row=0; row<th[i]; row++)
+ {
+ tmpbuf[i][row]=ptr;
+ ptr+=iw[i];
+ }
+ }
+ }
+
+ if(flags&TJFLAG_FASTUPSAMPLE) dinfo->do_fancy_upsampling=FALSE;
+ dinfo->raw_data_out=TRUE;
+
+ jpeg_start_decompress(dinfo);
+ for(row=0; row<(int)dinfo->output_height;
+ row+=dinfo->max_v_samp_factor*DCTSIZE)
+ {
+ JSAMPARRAY yuvptr[MAX_COMPONENTS];
+ int crow[MAX_COMPONENTS];
+ for(i=0; i<dinfo->num_components; i++)
+ {
+ jpeg_component_info *compptr=&dinfo->comp_info[i];
+ crow[i]=row*compptr->v_samp_factor/dinfo->max_v_samp_factor;
+ if(usetmpbuf) yuvptr[i]=tmpbuf[i];
+ else yuvptr[i]=&outbuf[i][crow[i]];
+ }
+ jpeg_read_raw_data(dinfo, yuvptr, dinfo->max_v_samp_factor*DCTSIZE);
+ if(usetmpbuf)
+ {
+ int j;
+ for(i=0; i<dinfo->num_components; i++)
+ {
+ for(j=0; j<min(th[i], ch[i]-crow[i]); j++)
+ {
+ memcpy(outbuf[i][crow[i]+j], tmpbuf[i][j], cw[i]);
+ }
+ }
+ }
+ }
+ jpeg_finish_decompress(dinfo);
+
+ bailout:
+ if(dinfo->global_state>DSTATE_START) jpeg_abort_decompress(dinfo);
+ for(i=0; i<MAX_COMPONENTS; i++)
+ {
+ if(tmpbuf[i]) free(tmpbuf[i]);
+ if(outbuf[i]) free(outbuf[i]);
+ }
+ if(_tmpbuf) free(_tmpbuf);
+ return retval;
+}
+
+
+/* Transformer */
+
+DLLEXPORT tjhandle DLLCALL tjInitTransform(void)
+{
+ tjinstance *this=NULL; tjhandle handle=NULL;
+ if((this=(tjinstance *)malloc(sizeof(tjinstance)))==NULL)
+ {
+ snprintf(errStr, JMSG_LENGTH_MAX,
+ "tjInitTransform(): Memory allocation failure");
+ return NULL;
+ }
+ MEMZERO(this, sizeof(tjinstance));
+ handle=_tjInitCompress(this);
+ if(!handle) return NULL;
+ handle=_tjInitDecompress(this);
+ return handle;
+}
+
+
+DLLEXPORT int DLLCALL tjTransform(tjhandle handle, unsigned char *jpegBuf,
+ unsigned long jpegSize, int n, unsigned char **dstBufs,
+ unsigned long *dstSizes, tjtransform *t, int flags)
+{
+ jpeg_transform_info *xinfo=NULL;
+ jvirt_barray_ptr *srccoefs, *dstcoefs;
+ int retval=0, i, jpegSubsamp;
+
+ getinstance(handle);
+ if((this->init&COMPRESS)==0 || (this->init&DECOMPRESS)==0)
+ _throw("tjTransform(): Instance has not been initialized for transformation");
+
+ if(jpegBuf==NULL || jpegSize<=0 || n<1 || dstBufs==NULL || dstSizes==NULL
+ || t==NULL || flags<0)
+ _throw("tjTransform(): Invalid argument");
+
+ if(flags&TJFLAG_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
+ else if(flags&TJFLAG_FORCESSE) putenv("JSIMD_FORCESSE=1");
+ else if(flags&TJFLAG_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
+
+ if(setjmp(this->jerr.setjmp_buffer))
+ {
+ /* If we get here, the JPEG code has signaled an error. */
+ retval=-1;
+ goto bailout;
+ }
+
+ 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];
+ xinfo[i].perfect=(t[i].options&TJXOPT_PERFECT)? 1:0;
+ xinfo[i].trim=(t[i].options&TJXOPT_TRIM)? 1:0;
+ xinfo[i].force_grayscale=(t[i].options&TJXOPT_GRAY)? 1:0;
+ xinfo[i].crop=(t[i].options&TJXOPT_CROP)? 1:0;
+ if(n!=1 && t[i].op==TJXOP_HFLIP) xinfo[i].slow_hflip=1;
+ else xinfo[i].slow_hflip=0;
+
+ if(xinfo[i].crop)
+ {
+ xinfo[i].crop_xoffset=t[i].r.x; xinfo[i].crop_xoffset_set=JCROP_POS;
+ xinfo[i].crop_yoffset=t[i].r.y; xinfo[i].crop_yoffset_set=JCROP_POS;
+ if(t[i].r.w!=0)
+ {
+ xinfo[i].crop_width=t[i].r.w; xinfo[i].crop_width_set=JCROP_POS;
+ }
+ else xinfo[i].crop_width=JCROP_UNSET;
+ if(t[i].r.h!=0)
+ {
+ xinfo[i].crop_height=t[i].r.h; xinfo[i].crop_height_set=JCROP_POS;
+ }
+ else xinfo[i].crop_height=JCROP_UNSET;
+ }
+ }
+
+ jcopy_markers_setup(dinfo, JCOPYOPT_ALL);
+ jpeg_read_header(dinfo, TRUE);
+ jpegSubsamp=getSubsamp(dinfo);
+ if(jpegSubsamp<0)
+ _throw("tjTransform(): Could not determine subsampling type for JPEG image");
+
+ for(i=0; i<n; i++)
+ {
+ if(!jtransform_request_workspace(dinfo, &xinfo[i]))
+ _throw("tjTransform(): Transform is not perfect");
+
+ if(xinfo[i].crop)
+ {
+ if((t[i].r.x%xinfo[i].iMCU_sample_width)!=0
+ || (t[i].r.y%xinfo[i].iMCU_sample_height)!=0)
+ {
+ snprintf(errStr, JMSG_LENGTH_MAX,
+ "To crop this JPEG image, x must be a multiple of %d\n"
+ "and y must be a multiple of %d.\n",
+ xinfo[i].iMCU_sample_width, xinfo[i].iMCU_sample_height);
+ retval=-1; goto bailout;
+ }
+ }
+ }
+
+ srccoefs=jpeg_read_coefficients(dinfo);
+
+ for(i=0; i<n; i++)
+ {
+ int w, h, alloc=1;
+ if(!xinfo[i].crop)
+ {
+ w=dinfo->image_width; h=dinfo->image_height;
+ }
+ else
+ {
+ w=xinfo[i].crop_width; h=xinfo[i].crop_height;
+ }
+ if(flags&TJFLAG_NOREALLOC)
+ {
+ alloc=0; dstSizes[i]=tjBufSize(w, h, jpegSubsamp);
+ }
+ if(!(t[i].options&TJXOPT_NOOUTPUT))
+ jpeg_mem_dest_tj(cinfo, &dstBufs[i], &dstSizes[i], alloc);
+ jpeg_copy_critical_parameters(dinfo, cinfo);
+ dstcoefs=jtransform_adjust_parameters(dinfo, cinfo, srccoefs,
+ &xinfo[i]);
+ if(!(t[i].options&TJXOPT_NOOUTPUT))
+ {
+ jpeg_write_coefficients(cinfo, dstcoefs);
+ jcopy_markers_execute(dinfo, cinfo, JCOPYOPT_ALL);
+ }
+ else jinit_c_master_control(cinfo, TRUE);
+ jtransform_execute_transformation(dinfo, cinfo, srccoefs,
+ &xinfo[i]);
+ if(t[i].customFilter)
+ {
+ int ci, by, y;
+ for(ci=0; ci<cinfo->num_components; ci++)
+ {
+ jpeg_component_info *compptr=&cinfo->comp_info[ci];
+ tjregion arrayRegion={0, 0, compptr->width_in_blocks*DCTSIZE,
+ DCTSIZE};
+ tjregion planeRegion={0, 0, compptr->width_in_blocks*DCTSIZE,
+ compptr->height_in_blocks*DCTSIZE};
+ for(by=0; by<compptr->height_in_blocks; by+=compptr->v_samp_factor)
+ {
+ JBLOCKARRAY barray=(dinfo->mem->access_virt_barray)
+ ((j_common_ptr)dinfo, dstcoefs[ci], by, compptr->v_samp_factor,
+ TRUE);
+ for(y=0; y<compptr->v_samp_factor; y++)
+ {
+ if(t[i].customFilter(barray[y][0], arrayRegion, planeRegion,
+ ci, i, &t[i])==-1)
+ _throw("tjTransform(): Error in custom filter");
+ arrayRegion.y+=DCTSIZE;
+ }
+ }
+ }
+ }
+ if(!(t[i].options&TJXOPT_NOOUTPUT)) jpeg_finish_compress(cinfo);
+ }
+
+ jpeg_finish_decompress(dinfo);
+
+ bailout:
+ if(cinfo->global_state>CSTATE_START) jpeg_abort_compress(cinfo);
+ if(dinfo->global_state>DSTATE_START) jpeg_abort_decompress(dinfo);
+ if(xinfo) free(xinfo);
+ return retval;
+}
diff --git a/turbojpeg.h b/turbojpeg.h
index 24816d7..a065fd1 100644
--- a/turbojpeg.h
+++ b/turbojpeg.h
@@ -1,341 +1,869 @@
-/* Copyright (C)2004 Landmark Graphics Corporation
- * Copyright (C)2005, 2006 Sun Microsystems, Inc.
- * Copyright (C)2009-2011 D. R. Commander
+/*
+ * Copyright (C)2009-2011 D. R. Commander. All Rights Reserved.
*
- * This library is free software and may be redistributed and/or modified under
- * the terms of the wxWindows Library License, Version 3.1 or (at your option)
- * any later version. The full license is in the LICENSE.txt file included
- * with this distribution.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
*
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * wxWindows Library License for more details.
+ * - 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.
*/
-#if (defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__)) && defined(_WIN32) && defined(DLLDEFINE)
+#ifndef __TURBOJPEG_H__
+#define __TURBOJPEG_H__
+
+#if defined(_WIN32) && defined(DLLDEFINE)
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT
#endif
-
#define DLLCALL
-/* Subsampling */
-#define NUMSUBOPT 4
-enum {TJ_444=0, TJ_422, TJ_420, TJ_GRAYSCALE};
-#define TJ_411 TJ_420 /* for backward compatibility with VirtualGL <= 2.1.x,
- TurboVNC <= 0.6, and TurboJPEG/IPP */
+/**
+ * @addtogroup TurboJPEG
+ * TurboJPEG API. This API provides an interface for generating, decoding, and
+ * transforming planar YUV and JPEG images in memory.
+ *
+ * @{
+ */
-/* Flags */
-#define TJ_BGR 1
- /* The components of each pixel in the source/destination bitmap are stored
- in B,G,R order, not R,G,B */
-#define TJ_BOTTOMUP 2
- /* The source/destination bitmap is stored in bottom-up (Windows, OpenGL)
- order, not top-down (X11) order */
-#define TJ_FORCEMMX 8
- /* Turn off CPU auto-detection and force TurboJPEG to use MMX code
- (IPP and 32-bit libjpeg-turbo versions only) */
-#define TJ_FORCESSE 16
- /* Turn off CPU auto-detection and force TurboJPEG to use SSE code
- (32-bit IPP and 32-bit libjpeg-turbo versions only) */
-#define TJ_FORCESSE2 32
- /* Turn off CPU auto-detection and force TurboJPEG to use SSE2 code
- (32-bit IPP and 32-bit libjpeg-turbo versions only) */
-#define TJ_ALPHAFIRST 64
- /* If the source/destination bitmap is 32 bpp, assume that each pixel is
- ARGB/XRGB (or ABGR/XBGR if TJ_BGR is also specified) */
-#define TJ_FORCESSE3 128
- /* Turn off CPU auto-detection and force TurboJPEG to use SSE3 code
- (64-bit IPP version only) */
-#define TJ_FASTUPSAMPLE 256
- /* Use fast, inaccurate 4:2:2 and 4:2:0 YUV upsampling routines
- (libjpeg and libjpeg-turbo versions only) */
-#define TJ_YUV 512
- /* Nothing to see here. Pay no attention to the man behind the curtain. */
+/**
+ * The number of chrominance subsampling options
+ */
+#define TJ_NUMSAMP 5
+
+/**
+ * Chrominance subsampling options.
+ * When an image is converted from the RGB to the YCbCr colorspace as part of
+ * the JPEG compression process, some of the Cb and Cr (chrominance) components
+ * can be discarded or averaged together to produce a smaller image with little
+ * perceptible loss of image clarity (the human eye is more sensitive to small
+ * changes in brightness than small changes in color.) This is called
+ * "chrominance subsampling".
+ */
+enum TJSAMP
+{
+ /**
+ * 4:4:4 chrominance subsampling (no chrominance subsampling). The JPEG or
+ * YUV image will contain one chrominance component for every pixel in the
+ * source image.
+ */
+ TJSAMP_444=0,
+ /**
+ * 4:2:2 chrominance subsampling. The JPEG or YUV image will contain one
+ * chrominance component for every 2x1 block of pixels in the source image.
+ */
+ TJSAMP_422,
+ /**
+ * 4:2:0 chrominance subsampling. The JPEG or YUV image will contain one
+ * chrominance component for every 2x2 block of pixels in the source image.
+ */
+ TJSAMP_420,
+ /**
+ * Grayscale. The JPEG or YUV image will contain no chrominance components.
+ */
+ TJSAMP_GRAY,
+ /**
+ * 4:4:0 chrominance subsampling. The JPEG or YUV image will contain one
+ * chrominance component for every 1x2 block of pixels in the source image.
+ */
+ TJSAMP_440
+};
+
+/**
+ * MCU block width (in pixels) for a given level of chrominance subsampling.
+ * MCU block sizes:
+ * - 8x8 for no subsampling or grayscale
+ * - 16x8 for 4:2:2
+ * - 8x16 for 4:4:0
+ * - 16x16 for 4:2:0
+ */
+static const int tjMCUWidth[TJ_NUMSAMP] = {8, 16, 16, 8, 8};
+
+/**
+ * MCU block height (in pixels) for a given level of chrominance subsampling.
+ * MCU block sizes:
+ * - 8x8 for no subsampling or grayscale
+ * - 16x8 for 4:2:2
+ * - 8x16 for 4:4:0
+ * - 16x16 for 4:2:0
+ */
+static const int tjMCUHeight[TJ_NUMSAMP] = {8, 8, 16, 8, 16};
+
+
+/**
+ * The number of pixel formats
+ */
+#define TJ_NUMPF 7
+
+/**
+ * Pixel formats
+ */
+enum TJPF
+{
+ /**
+ * RGB pixel format. The red, green, and blue components in the image are
+ * stored in 3-byte pixels in the order R, G, B from lowest to highest byte
+ * address within each pixel.
+ */
+ TJPF_RGB=0,
+ /**
+ * BGR pixel format. The red, green, and blue components in the image are
+ * stored in 3-byte pixels in the order B, G, R from lowest to highest byte
+ * address within each pixel.
+ */
+ TJPF_BGR,
+ /**
+ * RGBX pixel format. The red, green, and blue components in the image are
+ * stored in 4-byte pixels in the order R, G, B from lowest to highest byte
+ * address within each pixel.
+ */
+ TJPF_RGBX,
+ /**
+ * BGRX pixel format. The red, green, and blue components in the image are
+ * stored in 4-byte pixels in the order B, G, R from lowest to highest byte
+ * address within each pixel.
+ */
+ TJPF_BGRX,
+ /**
+ * XBGR pixel format. The red, green, and blue components in the image are
+ * stored in 4-byte pixels in the order R, G, B from highest to lowest byte
+ * address within each pixel.
+ */
+ TJPF_XBGR,
+ /**
+ * XRGB pixel format. The red, green, and blue components in the image are
+ * stored in 4-byte pixels in the order B, G, R from highest to lowest byte
+ * address within each pixel.
+ */
+ TJPF_XRGB,
+ /**
+ * Grayscale pixel format. Each 1-byte pixel represents a luminance
+ * (brightness) level from 0 to 255.
+ */
+ TJPF_GRAY
+};
+
+/**
+ * Red offset (in bytes) for a given pixel format. This specifies the number
+ * of bytes that the red component is offset from the start of the pixel. For
+ * instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>,
+ * then the red component will be <tt>pixel[tjRedOffset[TJ_BGRX]]</tt>.
+ */
+static const int tjRedOffset[TJ_NUMPF] = {0, 2, 0, 2, 3, 1, 0};
+/**
+ * Green offset (in bytes) for a given pixel format. This specifies the number
+ * of bytes that the green component is offset from the start of the pixel.
+ * For instance, if a pixel of format TJ_BGRX is stored in
+ * <tt>char pixel[]</tt>, then the green component will be
+ * <tt>pixel[tjGreenOffset[TJ_BGRX]]</tt>.
+ */
+static const int tjGreenOffset[TJ_NUMPF] = {1, 1, 1, 1, 2, 2, 0};
+/**
+ * Blue offset (in bytes) for a given pixel format. This specifies the number
+ * of bytes that the Blue component is offset from the start of the pixel. For
+ * instance, if a pixel of format TJ_BGRX is stored in <tt>char pixel[]</tt>,
+ * then the blue component will be <tt>pixel[tjBlueOffset[TJ_BGRX]]</tt>.
+ */
+static const int tjBlueOffset[TJ_NUMPF] = {2, 0, 2, 0, 1, 3, 0};
+
+/**
+ * Pixel size (in bytes) for a given pixel format.
+ */
+static const int tjPixelSize[TJ_NUMPF] = {3, 3, 4, 4, 4, 4, 1};
+
+
+/**
+ * The uncompressed source/destination image is stored in bottom-up (Windows,
+ * OpenGL) order, not top-down (X11) order.
+ */
+#define TJFLAG_BOTTOMUP 2
+/**
+ * Turn off CPU auto-detection and force TurboJPEG to use MMX code (IPP and
+ * 32-bit libjpeg-turbo versions only.)
+ */
+#define TJFLAG_FORCEMMX 8
+/**
+ * Turn off CPU auto-detection and force TurboJPEG to use SSE code (32-bit IPP
+ * and 32-bit libjpeg-turbo versions only)
+ */
+#define TJFLAG_FORCESSE 16
+/**
+ * Turn off CPU auto-detection and force TurboJPEG to use SSE2 code (32-bit IPP
+ * and 32-bit libjpeg-turbo versions only)
+ */
+#define TJFLAG_FORCESSE2 32
+/**
+ * Turn off CPU auto-detection and force TurboJPEG to use SSE3 code (64-bit IPP
+ * version only)
+ */
+#define TJFLAG_FORCESSE3 128
+/**
+ * Use fast, inaccurate chrominance upsampling routines in the JPEG
+ * decompressor (libjpeg and libjpeg-turbo versions only)
+ */
+#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.
+ */
+#define TJFLAG_NOREALLOC 1024
+
+
+/**
+ * Number of transform operations
+ */
+#define TJ_NUMXOP 8
+
+/**
+ * Transform operations for #tjTransform()
+ */
+enum TJXOP
+{
+ /**
+ * Do not transform the position of the image pixels
+ */
+ TJXOP_NONE=0,
+ /**
+ * Flip (mirror) image horizontally. This transform is imperfect if there
+ * are any partial MCU blocks on the right edge (see #TJXOPT_PERFECT.)
+ */
+ TJXOP_HFLIP,
+ /**
+ * Flip (mirror) image vertically. This transform is imperfect if there are
+ * any partial MCU blocks on the bottom edge (see #TJXOPT_PERFECT.)
+ */
+ TJXOP_VFLIP,
+ /**
+ * Transpose image (flip/mirror along upper left to lower right axis.) This
+ * transform is always perfect.
+ */
+ TJXOP_TRANSPOSE,
+ /**
+ * Transverse transpose image (flip/mirror along upper right to lower left
+ * axis.) This transform is imperfect if there are any partial MCU blocks in
+ * the image (see #TJXOPT_PERFECT.)
+ */
+ TJXOP_TRANSVERSE,
+ /**
+ * Rotate image clockwise by 90 degrees. This transform is imperfect if
+ * there are any partial MCU blocks on the bottom edge (see
+ * #TJXOPT_PERFECT.)
+ */
+ TJXOP_ROT90,
+ /**
+ * Rotate image 180 degrees. This transform is imperfect if there are any
+ * partial MCU blocks in the image (see #TJXOPT_PERFECT.)
+ */
+ TJXOP_ROT180,
+ /**
+ * Rotate image counter-clockwise by 90 degrees. This transform is imperfect
+ * if there are any partial MCU blocks on the right edge (see
+ * #TJXOPT_PERFECT.)
+ */
+ TJXOP_ROT270
+};
+
+
+/**
+ * This option will cause #tjTransform() to return an error if the transform is
+ * not perfect. Lossless transforms operate on MCU blocks, whose size depends
+ * on the level of chrominance subsampling used (see #tjMCUWidth
+ * and #tjMCUHeight.) If the image's width or height is not evenly divisible
+ * by the MCU block size, then there will be partial MCU blocks on the right
+ * and/or bottom edges. It is not possible to move these partial MCU blocks to
+ * the top or left of the image, so any transform that would require that is
+ * "imperfect." If this option is not specified, then any partial MCU blocks
+ * that cannot be transformed will be left in place, which will create
+ * odd-looking strips on the right or bottom edge of the image.
+ */
+#define TJXOPT_PERFECT 1
+/**
+ * This option will cause #tjTransform() to discard any partial MCU blocks that
+ * cannot be transformed.
+ */
+#define TJXOPT_TRIM 2
+/**
+ * This option will enable lossless cropping. See #tjTransform() for more
+ * information.
+ */
+#define TJXOPT_CROP 4
+/**
+ * This option will discard the color data in the input image and produce
+ * a grayscale output image.
+ */
+#define TJXOPT_GRAY 8
+/**
+ * This option will prevent #tjTransform() from outputting a JPEG image for
+ * this particular transform (this can be used in conjunction with a custom
+ * filter to capture the transformed DCT coefficients without transcoding
+ * them.)
+ */
+#define TJXOPT_NOOUTPUT 16
+
+
+/**
+ * Scaling factor
+ */
+typedef struct
+{
+ /**
+ * Numerator
+ */
+ int num;
+ /**
+ * Denominator
+ */
+ int denom;
+} tjscalingfactor;
+
+/**
+ * Cropping region
+ */
+typedef struct
+{
+ /**
+ * The left boundary of the cropping region. This must be evenly divisible
+ * by the MCU block width (see #tjMCUWidth.)
+ */
+ int x;
+ /**
+ * The upper boundary of the cropping region. This must be evenly divisible
+ * by the MCU block height (see #tjMCUHeight.)
+ */
+ int y;
+ /**
+ * The width of the cropping region. Setting this to 0 is the equivalent of
+ * setting it to the width of the source JPEG image - x.
+ */
+ int w;
+ /**
+ * The height of the cropping region. Setting this to 0 is the equivalent of
+ * setting it to the height of the source JPEG image - y.
+ */
+ int h;
+} tjregion;
+
+/**
+ * Lossless transform
+ */
+typedef struct tjtransform
+{
+ /**
+ * Cropping region
+ */
+ tjregion r;
+ /**
+ * One of the @ref TJXOP "transform operations"
+ */
+ int op;
+ /**
+ * The bitwise OR of one of more of the @ref TJXOPT_CROP "transform options"
+ */
+ int options;
+ /**
+ * Arbitrary data that can be accessed within the body of the callback
+ * function
+ */
+ void *data;
+ /**
+ * A callback function that can be used to modify the DCT coefficients
+ * after they are losslessly transformed but before they are transcoded to a
+ * new JPEG file. This allows for custom filters or other transformations to
+ * be applied in the frequency domain.
+ *
+ * @param coeffs pointer to an array of transformed DCT coefficients. (NOTE:
+ * this pointer is not guaranteed to be valid once the callback
+ * returns, so applications wishing to hand off the DCT coefficients
+ * to another function or library should make a copy of them within
+ * the body of the callback.)
+ * @param arrayRegion #tjregion structure containing the width and height of
+ * the array pointed to by <tt>coeffs</tt> as well as its offset
+ * relative to the component plane. TurboJPEG implementations may
+ * choose to split each component plane into multiple DCT coefficient
+ * arrays and call the callback function once for each array.
+ * @param planeRegion #tjregion structure containing the width and height of
+ * the component plane to which <tt>coeffs</tt> belongs
+ * @param componentID ID number of the component plane to which
+ * <tt>coeffs</tt> belongs (Y, Cb, and Cr have, respectively, ID's of
+ * 0, 1, and 2 in typical JPEG images.)
+ * @param transformID ID number of the transformed image to which
+ * <tt>coeffs</tt> belongs. This is the same as the index of the
+ * transform in the transforms array that was passed to
+ * #tjTransform().
+ * @param transform a pointer to a #tjtransform structure that specifies the
+ * parameters and/or cropping region for this transform
+ *
+ * @return 0 if the callback was successful, or -1 if an error occurred.
+ */
+ int (*customFilter)(short *coeffs, tjregion arrayRegion,
+ tjregion planeRegion, int componentIndex, int transformIndex,
+ struct tjtransform *transform);
+} tjtransform;
+
+/**
+ * TurboJPEG instance handle
+ */
typedef void* tjhandle;
-#define TJPAD(p) (((p)+3)&(~3))
-#ifndef max
- #define max(a,b) ((a)>(b)?(a):(b))
-#endif
+
+/**
+ * Pad the given width to the nearest 32-bit boundary
+ */
+#define TJPAD(width) (((width)+3)&(~3))
+
+/**
+ * Compute the scaled value of <tt>dimension</tt> using the given scaling
+ * factor. This macro performs the integer equivalent of <tt>ceil(dimension *
+ * scalingFactor)</tt>.
+ */
+#define TJSCALED(dimension, scalingFactor) ((dimension * scalingFactor.num \
+ + scalingFactor.denom - 1) / scalingFactor.denom)
+
#ifdef __cplusplus
extern "C" {
#endif
-/* API follows */
-
-/*
- tjhandle tjInitCompress(void)
-
- Creates a new JPEG compressor instance, allocates memory for the structures,
- and returns a handle to the instance. Most applications will only
- need to call this once at the beginning of the program or once for each
- concurrent thread. Don't try to create a new instance every time you
- compress an image, because this may cause performance to suffer in some
- TurboJPEG implementations.
-
- RETURNS: NULL on error
-*/
+/**
+ * Create a TurboJPEG compressor instance.
+ *
+ * @return a handle to the newly-created instance, or NULL if an error
+ * occurred (see #tjGetErrorStr().)
+ */
DLLEXPORT tjhandle DLLCALL tjInitCompress(void);
-/*
- int tjCompress(tjhandle j,
- unsigned char *srcbuf, int width, int pitch, int height, int pixelsize,
- unsigned char *dstbuf, unsigned long *size,
- int jpegsubsamp, int jpegqual, int flags)
-
- [INPUT] j = instance handle previously returned from a call to
- tjInitCompress()
- [INPUT] srcbuf = pointer to user-allocated image buffer containing RGB or
- grayscale pixels to be compressed
- [INPUT] width = width (in pixels) of the source image
- [INPUT] pitch = bytes per line of the source image (width*pixelsize if the
- bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the bitmap
- is padded to the nearest 32-bit boundary, such 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
- width*pixelsize.
- [INPUT] height = height (in pixels) of the source image
- [INPUT] pixelsize = size (in bytes) of each pixel in the source image
- RGBX/BGRX/XRGB/XBGR: 4, RGB/BGR: 3, Grayscale: 1
- [INPUT] dstbuf = pointer to user-allocated image buffer which will receive
- the JPEG image. Use the TJBUFSIZE(width, height) function to determine
- the appropriate size for this buffer based on the image width and height.
- [OUTPUT] size = pointer to unsigned long which receives the size (in bytes)
- of the compressed image
- [INPUT] jpegsubsamp = Specifies either 4:2:0, 4:2:2, 4:4:4, or grayscale
- subsampling. When the image is converted from the RGB to YCbCr colorspace
- as part of the JPEG compression process, every other Cb and Cr
- (chrominance) pixel can be discarded to produce a smaller image with
- little perceptible loss of image clarity (the human eye is more sensitive
- to small changes in brightness than small changes in color.)
-
- TJ_420: 4:2:0 subsampling. Discards every other Cb, Cr pixel in both
- horizontal and vertical directions
- TJ_422: 4:2:2 subsampling. Discards every other Cb, Cr pixel only in
- the horizontal direction
- TJ_444: no subsampling
- TJ_GRAYSCALE: Generate grayscale JPEG image
-
- [INPUT] jpegqual = JPEG quality (an integer between 0 and 100 inclusive)
- [INPUT] flags = the bitwise OR of one or more of the flags described in the
- "Flags" section above
-
- RETURNS: 0 on success, -1 on error
+/**
+ * Compress an RGB or grayscale image into a JPEG image.
+ *
+ * @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 compressed
+ * @param width width (in pixels) of the source image
+ * @param pitch bytes per line of the source image. Normally, this should be
+ * <tt>width * #tjPixelSize[pixelFormat]</tt> if the image is unpadded,
+ * or <tt>#TJPAD(width * #tjPixelSize[pixelFormat])</tt> 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 <tt>width * #tjPixelSize[pixelFormat]</tt>.
+ * @param height height (in pixels) of the source image
+ * @param pixelFormat pixel format of the source image (see @ref TJPF
+ * "Pixel formats".)
+ * @param jpegBuf 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:
+ * -# pre-allocate the JPEG buffer with an arbitrary size using
+ * #tjAlloc() and let TurboJPEG grow the buffer as needed,
+ * -# set <tt>*jpegBuf</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(). This should ensure that the buffer never has
+ * to be re-allocated (setting #TJFLAG_NOREALLOC guarantees this.)
+ * .
+ * 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, you should always check <tt>*jpegBuf</tt> upon
+ * return from this function, as it may have changed.
+ * @param jpegSize pointer to an unsigned long variable which holds the size of
+ * the JPEG image buffer. If <tt>*jpegBuf</tt> points to a
+ * pre-allocated buffer, then <tt>*jpegSize</tt> should be set to the
+ * size of the buffer. Upon return, <tt>*jpegSize</tt> will contain the
+ * size of the JPEG image (in bytes.)
+ * @param jpegSubsamp the level of chrominance subsampling to be used when
+ * generating the JPEG image (see @ref TJSAMP
+ * "Chrominance subsampling options".)
+ * @param jpegQual the image quality of the generated JPEG image (1 = worst,
+ 100 = best)
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * "flags".
+ *
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
-DLLEXPORT int DLLCALL tjCompress(tjhandle j,
- unsigned char *srcbuf, int width, int pitch, int height, int pixelsize,
- unsigned char *dstbuf, unsigned long *size,
- int jpegsubsamp, int jpegqual, int flags);
+DLLEXPORT int DLLCALL tjCompress2(tjhandle handle, unsigned char *srcBuf,
+ int width, int pitch, int height, int pixelFormat, unsigned char **jpegBuf,
+ unsigned long *jpegSize, int jpegSubsamp, int jpegQual, int flags);
-/*
- unsigned long TJBUFSIZE(int width, int height)
-
- Convenience function which returns the maximum size of the buffer required to
- hold a JPEG image with the given width and height
-
- RETURNS: -1 if arguments are out of bounds
-*/
-DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height);
+/**
+ * The maximum size of the buffer (in bytes) required to hold a JPEG image with
+ * the given parameters. The number of bytes returned by this function is
+ * larger than the size of the uncompressed source image. The reason for this
+ * is that the JPEG format uses 16-bit coefficients, and it is thus possible
+ * for a very high-quality JPEG image with very high frequency content to
+ * expand rather than compress when converted to the JPEG format. Such images
+ * represent a very rare corner case, but since there is no way to predict the
+ * size of a JPEG image prior to compression, the corner case has to be
+ * handled.
+ *
+ * @param width width of the image (in pixels)
+ * @param height height of the image (in pixels)
+ * @param jpegSubsamp the level of chrominance subsampling to be used when
+ * generating the JPEG image (see @ref TJSAMP
+ * "Chrominance subsampling options".)
+ *
+ * @return the maximum size of the buffer (in bytes) required to hold the
+ * image, or -1 if the arguments are out of bounds.
+ */
+DLLEXPORT unsigned long DLLCALL tjBufSize(int width, int height,
+ int jpegSubsamp);
-/*
- unsigned long TJBUFSIZEYUV(int width, int height, int subsamp)
-
- Convenience function which returns the size of the buffer required to
- hold a YUV planar image with the given width, height, and level of
- chrominance subsampling
-
- RETURNS: -1 if arguments are out of bounds
-*/
-DLLEXPORT unsigned long DLLCALL TJBUFSIZEYUV(int width, int height,
+/**
+ * The size of the buffer (in bytes) required to hold a YUV planar image with
+ * the given parameters.
+ *
+ * @param width width of the image (in pixels)
+ * @param height height of the image (in pixels)
+ * @param subsamp level of chrominance subsampling in the image (see
+ * @ref TJSAMP "Chrominance subsampling options".)
+ *
+ * @return the size of the buffer (in bytes) required to hold the image, or
+ * -1 if the arguments are out of bounds.
+ */
+DLLEXPORT unsigned long DLLCALL tjBufSizeYUV(int width, int height,
int subsamp);
-/*
- int tjEncodeYUV(tjhandle j,
- unsigned char *srcbuf, int width, int pitch, int height, int pixelsize,
- unsigned char *dstbuf, int subsamp, int flags)
-
- This function uses the accelerated color conversion routines in TurboJPEG's
- underlying codec to produce a planar YUV image that is suitable for X Video.
- Specifically, if the chrominance components are subsampled along the
- horizontal dimension, then the width of the luminance plane is padded to 2 in
- the output image (same goes for the height of the luminance plane, if the
- chrominance components are subsampled along the vertical dimension.) Also,
- each line of each plane in the output image is padded to 4 bytes. Although
- this will work with any subsampling option, it is really only useful in
- combination with TJ_420, which produces an image compatible with the I420
- (AKA "YUV420P") format.
-
- [INPUT] j = instance handle previously returned from a call to
- tjInitCompress()
- [INPUT] srcbuf = pointer to user-allocated image buffer containing RGB or
- grayscale pixels to be encoded
- [INPUT] width = width (in pixels) of the source image
- [INPUT] pitch = bytes per line of the source image (width*pixelsize if the
- bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the bitmap
- is padded to the nearest 32-bit boundary, such 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
- width*pixelsize.
- [INPUT] height = height (in pixels) of the source image
- [INPUT] pixelsize = size (in bytes) of each pixel in the source image
- RGBX/BGRX/XRGB/XBGR: 4, RGB/BGR: 3, Grayscale: 1
- [INPUT] dstbuf = pointer to user-allocated image buffer which will receive
- the YUV image. Use the TJBUFSIZEYUV(width, height, subsamp) function to
- determine the appropriate size for this buffer based on the image width,
- height, and level of subsampling.
- [INPUT] subsamp = Specifies either 4:2:0, 4:2:2, 4:4:4, or grayscale
- subsampling (see description under tjCompress())
- [INPUT] flags = the bitwise OR of one or more of the flags described in the
- "Flags" section above
-
- RETURNS: 0 on success, -1 on error
+/**
+ * Encode an RGB or grayscale image into a YUV planar image. This function
+ * uses the accelerated color conversion routines in TurboJPEG's underlying
+ * codec to produce a planar YUV image that is suitable for X Video.
+ * Specifically, if the chrominance components are subsampled along the
+ * horizontal dimension, then the width of the luminance plane is padded to 2
+ * in the output image (same goes for the height of the luminance plane, if the
+ * chrominance components are subsampled along the vertical dimension.) Also,
+ * each line of each plane in the output image is padded to 4 bytes. Although
+ * this will work with any subsampling option, it is really only useful in
+ * combination with TJ_420, which produces an image compatible with the I420
+ * (AKA "YUV420P") format.
+ *
+ * @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
+ * @param width width (in pixels) of the source image
+ * @param pitch bytes per line of the source image. Normally, this should be
+ * <tt>width * #tjPixelSize[pixelFormat]</tt> if the image is unpadded,
+ * or <tt>#TJPAD(width * #tjPixelSize[pixelFormat])</tt> 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 <tt>width * #tjPixelSize[pixelFormat]</tt>.
+ * @param height height (in pixels) of the source image
+ * @param pixelFormat pixel format of the source image (see @ref TJPF
+ * "Pixel formats".)
+ * @param dstBuf pointer to an image buffer which will receive the YUV image.
+ * Use #tjBufSizeYUV() to determine the appropriate size for this buffer
+ * based on the image width, height, and level of chrominance
+ * subsampling.
+ * @param subsamp the level of chrominance subsampling to be used when
+ * generating the YUV image (see @ref TJSAMP
+ * "Chrominance subsampling options".)
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * "flags".
+ *
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
-DLLEXPORT int DLLCALL tjEncodeYUV(tjhandle j,
- unsigned char *srcbuf, int width, int pitch, int height, int pixelsize,
- unsigned char *dstbuf, int subsamp, int flags);
+DLLEXPORT int DLLCALL tjEncodeYUV2(tjhandle handle,
+ unsigned char *srcBuf, int width, int pitch, int height, int pixelFormat,
+ unsigned char *dstBuf, int subsamp, int flags);
-/*
- tjhandle tjInitDecompress(void)
-
- Creates a new JPEG decompressor instance, allocates memory for the
- structures, and returns a handle to the instance. Most applications will
- only need to call this once at the beginning of the program or once for each
- concurrent thread. Don't try to create a new instance every time you
- decompress an image, because this may cause performance to suffer in some
- TurboJPEG implementations.
-
- RETURNS: NULL on error
+/**
+ * Create a TurboJPEG decompressor instance.
+ *
+ * @return a handle to the newly-created instance, or NULL if an error
+ * occurred (see #tjGetErrorStr().)
*/
DLLEXPORT tjhandle DLLCALL tjInitDecompress(void);
-/*
- int tjDecompressHeader2(tjhandle j,
- unsigned char *srcbuf, unsigned long size,
- int *width, int *height, int *jpegsubsamp)
-
- [INPUT] j = instance handle previously returned from a call to
- tjInitDecompress()
- [INPUT] srcbuf = pointer to a user-allocated buffer containing a JPEG image
- [INPUT] size = size of the JPEG image buffer (in bytes)
- [OUTPUT] width = width (in pixels) of the JPEG image
- [OUTPUT] height = height (in pixels) of the JPEG image
- [OUTPUT] jpegsubsamp = type of chrominance subsampling used when compressing
- the JPEG image
-
- RETURNS: 0 on success, -1 on error
+/**
+ * Retrieve information about a JPEG image without decompressing it.
+ *
+ * @param handle a handle to a TurboJPEG decompressor or transformer instance
+ * @param jpegBuf pointer to a buffer containing a JPEG image
+ * @param jpegSize size of the JPEG image (in bytes)
+ * @param width pointer to an integer variable which will receive the width (in
+ * pixels) of the JPEG image
+ * @param height pointer to an integer variable which will receive the height
+ * (in pixels) of the JPEG image
+ * @param jpegSubsamp pointer to an integer variable which will receive the
+ * level of chrominance subsampling used when compressing the JPEG image
+ * (see @ref TJSAMP "Chrominance subsampling options".)
+ *
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
*/
-DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle j,
- unsigned char *srcbuf, unsigned long size,
- int *width, int *height, int *jpegsubsamp);
+DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle handle,
+ unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height,
+ int *jpegSubsamp);
-/*
- Legacy version of the above function
+
+/**
+ * Returns a list of fractional scaling factors that the JPEG decompressor in
+ * this implementation of TurboJPEG supports.
+ *
+ * @param numscalingfactors pointer to an integer variable that will receive
+ * the number of elements in the list
+ *
+ * @return a pointer to a list of fractional scaling factors, or NULL if an
+ * error is encountered (see #tjGetErrorStr().)
*/
-DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle j,
- unsigned char *srcbuf, unsigned long size,
- int *width, int *height);
+DLLEXPORT tjscalingfactor* DLLCALL tjGetScalingFactors(int *numscalingfactors);
-/*
- int tjDecompress(tjhandle j,
- unsigned char *srcbuf, unsigned long size,
- unsigned char *dstbuf, int width, int pitch, int height, int pixelsize,
- int flags)
-
- [INPUT] j = instance handle previously returned from a call to
- tjInitDecompress()
- [INPUT] srcbuf = pointer to a user-allocated buffer containing the JPEG image
- to decompress
- [INPUT] size = size of the JPEG image buffer (in bytes)
- [INPUT] dstbuf = pointer to user-allocated image buffer which will receive
- the bitmap image. This buffer should normally be pitch*height
- bytes in size, although this pointer may also be used to decompress into
- a specific region of a larger buffer.
- [INPUT] width = width (in pixels) of the destination image
- [INPUT] pitch = bytes per line of the destination image (width*pixelsize if
- the bitmap is unpadded, else TJPAD(width*pixelsize) if each line of the
- bitmap is padded to the nearest 32-bit boundary, such 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 width*pixelsize.
- [INPUT] height = height (in pixels) of the destination image
- [INPUT] pixelsize = size (in bytes) of each pixel in the destination image
- RGBX/BGRX/XRGB/XBGR: 4, RGB/BGR: 3, Grayscale: 1
- [INPUT] flags = the bitwise OR of one or more of the flags described in the
- "Flags" section above.
-
- RETURNS: 0 on success, -1 on error
-*/
-DLLEXPORT int DLLCALL tjDecompress(tjhandle j,
- unsigned char *srcbuf, unsigned long size,
- unsigned char *dstbuf, int width, int pitch, int height, int pixelsize,
- int flags);
+/**
+ * Decompress a JPEG image to an RGB or grayscale image.
+ *
+ * @param handle a handle to a TurboJPEG decompressor or transformer instance
+ * @param jpegBuf pointer to a buffer containing the JPEG image to decompress
+ * @param jpegSize size of the JPEG image (in bytes)
+ * @param dstBuf pointer to an image buffer which will receive the decompressed
+ * image. This buffer should normally be <tt>pitch * scaledHeight</tt>
+ * bytes in size, where <tt>scaledHeight</tt> can be determined by
+ * calling #TJSCALED() with the JPEG image height and one of the scaling
+ * factors returned by #tjGetScalingFactors(). The dstBuf pointer may
+ * also be used to decompress into a specific region of a larger buffer.
+ * @param width desired width (in pixels) of the destination image. If this is
+ * smaller 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
+ * width is set to 0, then only the height will be considered when
+ * determining the scaled image size.
+ * @param pitch bytes per line of the destination image. Normally, this is
+ * <tt>scaledWidth * #tjPixelSize[pixelFormat]</tt> if the decompressed
+ * image is unpadded, else <tt>#TJPAD(scaledWidth *
+ * #tjPixelSize[pixelFormat])</tt> if each line of the decompressed
+ * image is padded to the nearest 32-bit boundary, as is the case for
+ * Windows bitmaps. (NOTE: <tt>scaledWidth</tt> can be determined by
+ * calling #TJSCALED() with the JPEG image width and one of the scaling
+ * factors returned by #tjGetScalingFactors().) You can also be clever
+ * and use the pitch parameter to skip lines, etc. Setting this
+ * parameter to 0 is the equivalent of setting it to <tt>scaledWidth
+ * * #tjPixelSize[pixelFormat]</tt>.
+ * @param height desired height (in pixels) of the destination image. If this
+ * is smaller than the height 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 height. If
+ * height is set to 0, then only the width will be considered when
+ * determining the scaled image size.
+ * @param pixelFormat pixel format of the destination image (see @ref
+ * TJPF "Pixel formats".)
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * "flags".
+ *
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ */
+DLLEXPORT int DLLCALL tjDecompress2(tjhandle handle,
+ unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf,
+ int width, int pitch, int height, int pixelFormat, int flags);
-/*
- int tjDecompressToYUV(tjhandle j,
- unsigned char *srcbuf, unsigned long size,
- unsigned char *dstbuf, int flags)
-
- This function performs JPEG decompression but leaves out the color conversion
- step, so a planar YUV image is generated instead of an RGB image. The
- padding of the planes in this image is the same as in tjEncodeYUV().
- Note that, if the width or height of the output image is not a multiple of 8
- (or a multiple of 16 along any dimension in which chrominance subsampling is
- used), then an intermediate buffer copy will be performed within TurboJPEG.
-
- [INPUT] j = instance handle previously returned from a call to
- tjInitDecompress()
- [INPUT] srcbuf = pointer to a user-allocated buffer containing the JPEG image
- to decompress
- [INPUT] size = size of the JPEG image buffer (in bytes)
- [INPUT] dstbuf = pointer to user-allocated image buffer which will receive
- the YUV image. Use the TJBUFSIZEYUV(width, height, subsamp) function to
- determine the appropriate size for this buffer based on the image width,
- height, and level of subsampling.
- [INPUT] flags = the bitwise OR of one or more of the flags described in the
- "Flags" section above.
-
- RETURNS: 0 on success, -1 on error
-*/
-DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle j,
- unsigned char *srcbuf, unsigned long size,
- unsigned char *dstbuf, int flags);
+/**
+ * Decompress a JPEG image to a YUV planar image. This function performs JPEG
+ * decompression but leaves out the color conversion step, so a planar YUV
+ * image is generated instead of an RGB image. The padding of the planes in
+ * this image is the same as the images generated by #tjEncodeYUV2(). Note
+ * that, if the width or height of the image is not an even multiple of the MCU
+ * block size (see #tjMCUWidth and #tjMCUHeight), then an intermediate buffer
+ * copy will be performed within TurboJPEG.
+ *
+ * @param handle a handle to a TurboJPEG decompressor or transformer instance
+ * @param jpegBuf pointer to a buffer containing the JPEG image to decompress
+ * @param jpegSize size of the JPEG image (in bytes)
+ * @param dstBuf pointer to an image buffer which will receive the YUV image.
+ * Use #tjBufSizeYUV to determine the appropriate size for this buffer
+ * based on the image width, height, and level of subsampling.
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * "flags".
+ *
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ */
+DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle handle,
+ unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf,
+ int flags);
-/*
- int tjDestroy(tjhandle h)
-
- Frees structures associated with a compression or decompression instance
-
- [INPUT] h = instance handle (returned from a previous call to
- tjInitCompress() or tjInitDecompress()
-
- RETURNS: 0 on success, -1 on error
-*/
-DLLEXPORT int DLLCALL tjDestroy(tjhandle h);
+/**
+ * Create a new TurboJPEG transformer instance.
+ *
+ * @return a handle to the newly-created instance, or NULL if an error
+ * occurred (see #tjGetErrorStr().)
+ */
+DLLEXPORT tjhandle DLLCALL tjInitTransform(void);
-/*
- char *tjGetErrorStr(void)
-
- Returns a descriptive error message explaining why the last command failed
-*/
+/**
+ * Losslessly transform a JPEG image into another JPEG image. Lossless
+ * transforms work by moving the raw coefficients from one JPEG image structure
+ * to another without altering the values of the coefficients. While this is
+ * typically faster than decompressing the image, transforming it, and
+ * re-compressing it, lossless transforms are not free. Each lossless
+ * transform requires reading and Huffman decoding all of the coefficients in
+ * the source image, regardless of the size of the destination image. Thus,
+ * this function provides a means of generating multiple transformed images
+ * from the same source or of applying multiple transformations simultaneously,
+ * in order to eliminate the need to read the source coefficients multiple
+ * times.
+ *
+ * @param handle a handle to a TurboJPEG transformer instance
+ * @param jpegBuf pointer to a buffer containing the JPEG image to transform
+ * @param jpegSize size of the JPEG image (in bytes)
+ * @param n the number of transformed JPEG images to generate
+ * @param dstBufs pointer to an array of n image buffers. <tt>dstBufs[i]</tt>
+ * will receive a JPEG image that has been transformed using the
+ * parameters in <tt>transforms[i]</tt>. TurboJPEG has the ability to
+ * reallocate the JPEG buffer to accommodate the size of the JPEG image.
+ * Thus, you can choose to:
+ * -# pre-allocate the JPEG buffer with an arbitrary size using
+ * #tjAlloc() and let TurboJPEG grow the buffer as needed,
+ * -# 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 cropped width and height. This should
+ * ensure that the buffer never has to be re-allocated (setting
+ * #TJFLAG_NOREALLOC guarantees this.)
+ * .
+ * 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 #TJFLAG_NOREALLOC, you should always check <tt>dstBufs[i]</tt>
+ * upon return from this function, as it may have changed.
+ * @param dstSizes pointer to an array of n unsigned long variables which will
+ * receive the actual sizes (in bytes) of each transformed JPEG image.
+ * If <tt>dstBufs[i]</tt> points to a pre-allocated buffer, then
+ * <tt>dstSizes[i]</tt> should be set to the size of the buffer. Upon
+ * return, <tt>dstSizes[i]</tt> will contain the size of the JPEG image
+ * (in bytes.)
+ * @param transforms pointer to an array of n tjtransform structures, each of
+ * which specifies the transform parameters and/or cropping region for
+ * the corresponding transformed output image.
+ * @param flags the bitwise OR of one or more of the @ref TJFLAG_BOTTOMUP
+ * "flags".
+ *
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ */
+DLLEXPORT int DLLCALL tjTransform(tjhandle handle, unsigned char *jpegBuf,
+ unsigned long jpegSize, int n, unsigned char **dstBufs,
+ unsigned long *dstSizes, tjtransform *transforms, int flags);
+
+
+/**
+ * Destroy a TurboJPEG compressor, decompressor, or transformer instance.
+ *
+ * @param handle a handle to a TurboJPEG compressor, decompressor or
+ * transformer instance
+ *
+ * @return 0 if successful, or -1 if an error occurred (see #tjGetErrorStr().)
+ */
+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
+ * (re)allocation (by setting #TJFLAG_NOREALLOC.)
+ *
+ * @param bytes the number of bytes to allocate
+ *
+ * @return a pointer to a newly-allocated buffer with the specified number of
+ * bytes
+ *
+ * @sa tjFree()
+ */
+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().
+ *
+ * @param buffer address of the buffer to free
+ *
+ * @sa tjAlloc()
+ */
+DLLEXPORT void DLLCALL tjFree(unsigned char *buffer);
+
+
+/**
+ * Returns a descriptive error message explaining why the last command failed.
+ *
+ * @return a descriptive error message explaining why the last command failed.
+ */
DLLEXPORT char* DLLCALL tjGetErrorStr(void);
+
+/* Backward compatibility functions and macros (nothing to see here) */
+#define NUMSUBOPT TJ_NUMSAMP
+#define TJ_444 TJSAMP_444
+#define TJ_422 TJSAMP_422
+#define TJ_420 TJSAMP_420
+#define TJ_411 TJSAMP_420
+#define TJ_GRAYSCALE TJSAMP_GRAY
+
+#define TJ_BGR 1
+#define TJ_BOTTOMUP TJFLAG_BOTTOMUP
+#define TJ_FORCEMMX TJFLAG_FORCEMMX
+#define TJ_FORCESSE TJFLAG_FORCESSE
+#define TJ_FORCESSE2 TJFLAG_FORCESSE2
+#define TJ_ALPHAFIRST 64
+#define TJ_FORCESSE3 TJFLAG_FORCESSE3
+#define TJ_FASTUPSAMPLE TJFLAG_FASTUPSAMPLE
+#define TJ_YUV 512
+
+DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height);
+
+DLLEXPORT unsigned long DLLCALL TJBUFSIZEYUV(int width, int height,
+ int jpegSubsamp);
+
+DLLEXPORT int DLLCALL tjCompress(tjhandle handle, unsigned char *srcBuf,
+ int width, int pitch, int height, int pixelSize, unsigned char *dstBuf,
+ unsigned long *compressedSize, int jpegSubsamp, int jpegQual, int flags);
+
+DLLEXPORT int DLLCALL tjEncodeYUV(tjhandle handle,
+ unsigned char *srcBuf, int width, int pitch, int height, int pixelSize,
+ unsigned char *dstBuf, int subsamp, int flags);
+
+DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle handle,
+ unsigned char *jpegBuf, unsigned long jpegSize, int *width, int *height);
+
+DLLEXPORT int DLLCALL tjDecompress(tjhandle handle,
+ unsigned char *jpegBuf, unsigned long jpegSize, unsigned char *dstBuf,
+ int width, int pitch, int height, int pixelSize, int flags);
+
+
+/**
+ * @}
+ */
+
#ifdef __cplusplus
}
#endif
+
+#endif
diff --git a/turbojpegl.c b/turbojpegl.c
deleted file mode 100644
index 5cc5437..0000000
--- a/turbojpegl.c
+++ /dev/null
@@ -1,651 +0,0 @@
-/* Copyright (C)2004 Landmark Graphics Corporation
- * Copyright (C)2005 Sun Microsystems, Inc.
- * Copyright (C)2009-2011 D. R. Commander
- *
- * This library is free software and may be redistributed and/or modified under
- * the terms of the wxWindows Library License, Version 3.1 or (at your option)
- * any later version. The full license is in the LICENSE.txt file included
- * with this distribution.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * wxWindows Library License for more details.
- */
-
-// This implements a JPEG compressor/decompressor using the libjpeg API
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#define JPEG_INTERNALS
-#include <jpeglib.h>
-#include <jerror.h>
-#include <setjmp.h>
-#include "./turbojpeg.h"
-
-#ifndef min
- #define min(a,b) ((a)<(b)?(a):(b))
-#endif
-
-#define PAD(v, p) ((v+(p)-1)&(~((p)-1)))
-
-
-// Error handling
-
-static char lasterror[JMSG_LENGTH_MAX]="No error";
-
-typedef struct _error_mgr
-{
- struct jpeg_error_mgr pub;
- jmp_buf jb;
-} error_mgr;
-
-static void my_error_exit(j_common_ptr cinfo)
-{
- error_mgr *myerr = (error_mgr *)cinfo->err;
- (*cinfo->err->output_message)(cinfo);
- longjmp(myerr->jb, 1);
-}
-
-static void my_output_message(j_common_ptr cinfo)
-{
- (*cinfo->err->format_message)(cinfo, lasterror);
-}
-
-
-// Global structures, macros, etc.
-
-typedef struct _jpgstruct
-{
- struct jpeg_compress_struct cinfo;
- struct jpeg_decompress_struct dinfo;
- struct jpeg_destination_mgr jdms;
- struct jpeg_source_mgr jsms;
- error_mgr jerr;
- int initc, initd;
-} jpgstruct;
-
-static const int hsampfactor[NUMSUBOPT]={1, 2, 2, 1};
-static const int vsampfactor[NUMSUBOPT]={1, 1, 2, 1};
-static const int pixelsize[NUMSUBOPT]={3, 3, 3, 1};
-
-#define _throw(c) {sprintf(lasterror, "%s", c); retval=-1; goto bailout;}
-#define checkhandle(h) jpgstruct *j=(jpgstruct *)h; \
- if(!j) {sprintf(lasterror, "Invalid handle"); return -1;}
-
-
-// CO
-
-static boolean empty_output_buffer(struct jpeg_compress_struct *cinfo)
-{
- ERREXIT(cinfo, JERR_BUFFER_SIZE);
- return TRUE;
-}
-
-static void destination_noop(struct jpeg_compress_struct *cinfo)
-{
-}
-
-DLLEXPORT tjhandle DLLCALL tjInitCompress(void)
-{
- jpgstruct *j=NULL;
- if((j=(jpgstruct *)malloc(sizeof(jpgstruct)))==NULL)
- {sprintf(lasterror, "Memory allocation failure"); return NULL;}
- memset(j, 0, sizeof(jpgstruct));
- j->cinfo.err=jpeg_std_error(&j->jerr.pub);
- j->jerr.pub.error_exit=my_error_exit;
- j->jerr.pub.output_message=my_output_message;
-
- if(setjmp(j->jerr.jb))
- { // this will execute if LIBJPEG has an error
- if(j) free(j); return NULL;
- }
-
- jpeg_create_compress(&j->cinfo);
- j->cinfo.dest=&j->jdms;
- j->jdms.init_destination=destination_noop;
- j->jdms.empty_output_buffer=empty_output_buffer;
- j->jdms.term_destination=destination_noop;
-
- j->initc=1;
- return (tjhandle)j;
-}
-
-
-DLLEXPORT unsigned long DLLCALL TJBUFSIZE(int width, int height)
-{
- unsigned long retval=0;
- if(width<1 || height<1)
- _throw("Invalid argument in TJBUFSIZE()");
-
- // This allows for rare corner cases in which a JPEG image can actually be
- // larger than the uncompressed input (we wouldn't mention it if it hadn't
- // happened before.)
- retval=((width+15)&(~15)) * ((height+15)&(~15)) * 6 + 2048;
-
- bailout:
- return retval;
-}
-
-
-DLLEXPORT unsigned long DLLCALL TJBUFSIZEYUV(int width, int height,
- int subsamp)
-{
- unsigned long retval=0;
- int pw, ph, cw, ch;
- if(width<1 || height<1 || subsamp<0 || subsamp>=NUMSUBOPT)
- _throw("Invalid argument in TJBUFSIZEYUV()");
- pw=PAD(width, hsampfactor[subsamp]);
- ph=PAD(height, vsampfactor[subsamp]);
- cw=pw/hsampfactor[subsamp]; ch=ph/vsampfactor[subsamp];
- retval=PAD(pw, 4)*ph + (subsamp==TJ_GRAYSCALE? 0:PAD(cw, 4)*ch*2);
-
- bailout:
- return retval;
-}
-
-
-DLLEXPORT int DLLCALL tjCompress(tjhandle h,
- unsigned char *srcbuf, int width, int pitch, int height, int ps,
- unsigned char *dstbuf, unsigned long *size,
- int jpegsub, int qual, int flags)
-{
- int i, retval=0; JSAMPROW *row_pointer=NULL;
- JSAMPLE *_tmpbuf[MAX_COMPONENTS], *_tmpbuf2[MAX_COMPONENTS];
- JSAMPROW *tmpbuf[MAX_COMPONENTS], *tmpbuf2[MAX_COMPONENTS];
- JSAMPROW *outbuf[MAX_COMPONENTS];
-
- checkhandle(h);
-
- for(i=0; i<MAX_COMPONENTS; i++)
- {
- tmpbuf[i]=NULL; _tmpbuf[i]=NULL;
- tmpbuf2[i]=NULL; _tmpbuf2[i]=NULL; outbuf[i]=NULL;
- }
-
- if(srcbuf==NULL || width<=0 || pitch<0 || height<=0
- || dstbuf==NULL || size==NULL
- || jpegsub<0 || jpegsub>=NUMSUBOPT || qual<0 || qual>100)
- _throw("Invalid argument in tjCompress()");
- if(ps!=3 && ps!=4 && ps!=1)
- _throw("This compressor can only handle 24-bit and 32-bit RGB or 8-bit grayscale input");
- if(!j->initc) _throw("Instance has not been initialized for compression");
-
- if(pitch==0) pitch=width*ps;
-
- j->cinfo.image_width = width;
- j->cinfo.image_height = height;
- j->cinfo.input_components = ps;
-
- if(ps==1) j->cinfo.in_color_space = JCS_GRAYSCALE;
- #if JCS_EXTENSIONS==1
- else j->cinfo.in_color_space = JCS_EXT_RGB;
- if(ps==3 && (flags&TJ_BGR))
- j->cinfo.in_color_space = JCS_EXT_BGR;
- else if(ps==4 && !(flags&TJ_BGR) && !(flags&TJ_ALPHAFIRST))
- j->cinfo.in_color_space = JCS_EXT_RGBX;
- else if(ps==4 && (flags&TJ_BGR) && !(flags&TJ_ALPHAFIRST))
- j->cinfo.in_color_space = JCS_EXT_BGRX;
- else if(ps==4 && (flags&TJ_BGR) && (flags&TJ_ALPHAFIRST))
- j->cinfo.in_color_space = JCS_EXT_XBGR;
- else if(ps==4 && !(flags&TJ_BGR) && (flags&TJ_ALPHAFIRST))
- j->cinfo.in_color_space = JCS_EXT_XRGB;
- #else
- #error "TurboJPEG requires JPEG colorspace extensions"
- #endif
-
- if(flags&TJ_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
- else if(flags&TJ_FORCESSE) putenv("JSIMD_FORCESSE=1");
- else if(flags&TJ_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
-
- if(setjmp(j->jerr.jb))
- { // this will execute if LIBJPEG has an error
- retval=-1;
- goto bailout;
- }
-
- jpeg_set_defaults(&j->cinfo);
-
- jpeg_set_quality(&j->cinfo, qual, TRUE);
- if(jpegsub==TJ_GRAYSCALE)
- jpeg_set_colorspace(&j->cinfo, JCS_GRAYSCALE);
- else
- jpeg_set_colorspace(&j->cinfo, JCS_YCbCr);
- if(qual>=96) j->cinfo.dct_method=JDCT_ISLOW;
- else j->cinfo.dct_method=JDCT_FASTEST;
-
- j->cinfo.comp_info[0].h_samp_factor=hsampfactor[jpegsub];
- j->cinfo.comp_info[1].h_samp_factor=1;
- j->cinfo.comp_info[2].h_samp_factor=1;
- j->cinfo.comp_info[0].v_samp_factor=vsampfactor[jpegsub];
- j->cinfo.comp_info[1].v_samp_factor=1;
- j->cinfo.comp_info[2].v_samp_factor=1;
-
- j->jdms.next_output_byte = dstbuf;
- j->jdms.free_in_buffer = TJBUFSIZE(j->cinfo.image_width, j->cinfo.image_height);
-
- jpeg_start_compress(&j->cinfo, TRUE);
- if(flags&TJ_YUV)
- {
- j_compress_ptr cinfo=&j->cinfo;
- int row;
- int pw=PAD(width, cinfo->max_h_samp_factor);
- int ph=PAD(height, cinfo->max_v_samp_factor);
- int cw[MAX_COMPONENTS], ch[MAX_COMPONENTS];
- jpeg_component_info *compptr;
- JSAMPLE *ptr=dstbuf; unsigned long yuvsize=0;
-
- if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ph))==NULL)
- _throw("Memory allocation failed in tjCompress()");
- for(i=0; i<height; i++)
- {
- if(flags&TJ_BOTTOMUP) row_pointer[i]= &srcbuf[(height-i-1)*pitch];
- else row_pointer[i]= &srcbuf[i*pitch];
- }
- if(height<ph)
- for(i=height; i<ph; i++) row_pointer[i]=row_pointer[height-1];
-
- for(i=0; i<cinfo->num_components; i++)
- {
- compptr=&cinfo->comp_info[i];
- _tmpbuf[i]=(JSAMPLE *)malloc(
- PAD((compptr->width_in_blocks*cinfo->max_h_samp_factor*DCTSIZE)
- /compptr->h_samp_factor, 16) * cinfo->max_v_samp_factor + 16);
- if(!_tmpbuf[i]) _throw("Memory allocation failure");
- tmpbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*cinfo->max_v_samp_factor);
- if(!tmpbuf[i]) _throw("Memory allocation failure");
- for(row=0; row<cinfo->max_v_samp_factor; row++)
- {
- unsigned char *_tmpbuf_aligned=
- (unsigned char *)PAD((size_t)_tmpbuf[i], 16);
- tmpbuf[i][row]=&_tmpbuf_aligned[
- PAD((compptr->width_in_blocks*cinfo->max_h_samp_factor*DCTSIZE)
- /compptr->h_samp_factor, 16) * row];
- }
- _tmpbuf2[i]=(JSAMPLE *)malloc(PAD(compptr->width_in_blocks*DCTSIZE, 16)
- * compptr->v_samp_factor + 16);
- if(!_tmpbuf2[i]) _throw("Memory allocation failure");
- tmpbuf2[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*compptr->v_samp_factor);
- if(!tmpbuf2[i]) _throw("Memory allocation failure");
- for(row=0; row<compptr->v_samp_factor; row++)
- {
- unsigned char *_tmpbuf2_aligned=
- (unsigned char *)PAD((size_t)_tmpbuf2[i], 16);
- tmpbuf2[i][row]=&_tmpbuf2_aligned[
- PAD(compptr->width_in_blocks*DCTSIZE, 16) * row];
- }
- cw[i]=pw*compptr->h_samp_factor/cinfo->max_h_samp_factor;
- ch[i]=ph*compptr->v_samp_factor/cinfo->max_v_samp_factor;
- outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]);
- if(!outbuf[i]) _throw("Memory allocation failure");
- for(row=0; row<ch[i]; row++)
- {
- outbuf[i][row]=ptr;
- ptr+=PAD(cw[i], 4);
- }
- }
- yuvsize=(unsigned long)(ptr-dstbuf);
-
- for(row=0; row<ph; row+=cinfo->max_v_samp_factor)
- {
- (*cinfo->cconvert->color_convert)(cinfo, &row_pointer[row], tmpbuf,
- 0, cinfo->max_v_samp_factor);
- (cinfo->downsample->downsample)(cinfo, tmpbuf, 0, tmpbuf2, 0);
- for(i=0, compptr=cinfo->comp_info; i<cinfo->num_components;
- i++, compptr++)
- jcopy_sample_rows(tmpbuf2[i], 0, outbuf[i],
- row*compptr->v_samp_factor/cinfo->max_v_samp_factor,
- compptr->v_samp_factor, cw[i]);
- }
- *size=yuvsize;
- cinfo->next_scanline+=height;
- jpeg_abort_compress(&j->cinfo);
- }
- else
- {
- if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL)
- _throw("Memory allocation failed in tjCompress()");
- for(i=0; i<height; i++)
- {
- if(flags&TJ_BOTTOMUP) row_pointer[i]= &srcbuf[(height-i-1)*pitch];
- else row_pointer[i]= &srcbuf[i*pitch];
- }
- while(j->cinfo.next_scanline<j->cinfo.image_height)
- {
- jpeg_write_scanlines(&j->cinfo, &row_pointer[j->cinfo.next_scanline],
- j->cinfo.image_height-j->cinfo.next_scanline);
- }
- jpeg_finish_compress(&j->cinfo);
- *size=TJBUFSIZE(j->cinfo.image_width, j->cinfo.image_height)
- -(unsigned long)(j->jdms.free_in_buffer);
- }
-
- bailout:
- if(j->cinfo.global_state>CSTATE_START) jpeg_abort_compress(&j->cinfo);
- if(row_pointer) free(row_pointer);
- for(i=0; i<MAX_COMPONENTS; i++)
- {
- if(tmpbuf[i]!=NULL) free(tmpbuf[i]);
- if(_tmpbuf[i]!=NULL) free(_tmpbuf[i]);
- if(tmpbuf2[i]!=NULL) free(tmpbuf2[i]);
- if(_tmpbuf2[i]!=NULL) free(_tmpbuf2[i]);
- if(outbuf[i]!=NULL) free(outbuf[i]);
- }
- return retval;
-}
-
-
-DLLEXPORT int DLLCALL tjEncodeYUV(tjhandle h,
- unsigned char *srcbuf, int width, int pitch, int height, int ps,
- unsigned char *dstbuf, int subsamp, int flags)
-{
- unsigned long size;
- return tjCompress(h, srcbuf, width, pitch, height, ps, dstbuf, &size,
- subsamp, 0, flags|TJ_YUV);
-}
-
-
-// DEC
-
-static boolean fill_input_buffer (struct jpeg_decompress_struct *dinfo)
-{
- ERREXIT(dinfo, JERR_BUFFER_SIZE);
- return TRUE;
-}
-
-static void skip_input_data (struct jpeg_decompress_struct *dinfo, long num_bytes)
-{
- dinfo->src->next_input_byte += (size_t) num_bytes;
- dinfo->src->bytes_in_buffer -= (size_t) num_bytes;
-}
-
-static void source_noop (struct jpeg_decompress_struct *dinfo)
-{
-}
-
-DLLEXPORT tjhandle DLLCALL tjInitDecompress(void)
-{
- jpgstruct *j;
- if((j=(jpgstruct *)malloc(sizeof(jpgstruct)))==NULL)
- {sprintf(lasterror, "Memory allocation failure"); return NULL;}
- memset(j, 0, sizeof(jpgstruct));
- j->dinfo.err=jpeg_std_error(&j->jerr.pub);
- j->jerr.pub.error_exit=my_error_exit;
- j->jerr.pub.output_message=my_output_message;
-
- if(setjmp(j->jerr.jb))
- { // this will execute if LIBJPEG has an error
- free(j); return NULL;
- }
-
- jpeg_create_decompress(&j->dinfo);
- j->dinfo.src=&j->jsms;
- j->jsms.init_source=source_noop;
- j->jsms.fill_input_buffer = fill_input_buffer;
- j->jsms.skip_input_data = skip_input_data;
- j->jsms.resync_to_restart = jpeg_resync_to_restart;
- j->jsms.term_source = source_noop;
-
- j->initd=1;
- return (tjhandle)j;
-}
-
-
-DLLEXPORT int DLLCALL tjDecompressHeader2(tjhandle h,
- unsigned char *srcbuf, unsigned long size,
- int *width, int *height, int *jpegsub)
-{
- int i, k, retval=0;
-
- checkhandle(h);
-
- if(srcbuf==NULL || size<=0 || width==NULL || height==NULL || jpegsub==NULL)
- _throw("Invalid argument in tjDecompressHeader2()");
- if(!j->initd) _throw("Instance has not been initialized for decompression");
-
- if(setjmp(j->jerr.jb))
- { // this will execute if LIBJPEG has an error
- return -1;
- }
-
- j->jsms.bytes_in_buffer = size;
- j->jsms.next_input_byte = srcbuf;
-
- jpeg_read_header(&j->dinfo, TRUE);
-
- *width=j->dinfo.image_width; *height=j->dinfo.image_height;
- *jpegsub=-1;
- for(i=0; i<NUMSUBOPT; i++)
- {
- if(j->dinfo.num_components==pixelsize[i])
- {
- if(j->dinfo.comp_info[0].h_samp_factor==hsampfactor[i]
- && j->dinfo.comp_info[0].v_samp_factor==vsampfactor[i])
- {
- int match=0;
- for(k=1; k<j->dinfo.num_components; k++)
- {
- if(j->dinfo.comp_info[k].h_samp_factor==1
- && j->dinfo.comp_info[k].v_samp_factor==1)
- match++;
- }
- if(match==j->dinfo.num_components-1)
- {
- *jpegsub=i; break;
- }
- }
- }
- }
-
- jpeg_abort_decompress(&j->dinfo);
-
- if(*jpegsub<0) _throw("Could not determine subsampling type for JPEG image");
- if(*width<1 || *height<1) _throw("Invalid data returned in header");
-
- bailout:
- return retval;
-}
-
-
-DLLEXPORT int DLLCALL tjDecompressHeader(tjhandle h,
- unsigned char *srcbuf, unsigned long size,
- int *width, int *height)
-{
- int jpegsub;
- return tjDecompressHeader2(h, srcbuf, size, width, height, &jpegsub);
-}
-
-
-DLLEXPORT int DLLCALL tjDecompress(tjhandle h,
- unsigned char *srcbuf, unsigned long size,
- unsigned char *dstbuf, int width, int pitch, int height, int ps,
- int flags)
-{
- int i, row, retval=0; JSAMPROW *row_pointer=NULL, *outbuf[MAX_COMPONENTS];
- int cw[MAX_COMPONENTS], ch[MAX_COMPONENTS], iw[MAX_COMPONENTS],
- tmpbufsize=0, usetmpbuf=0, th[MAX_COMPONENTS];
- JSAMPLE *_tmpbuf=NULL; JSAMPROW *tmpbuf[MAX_COMPONENTS];
-
- checkhandle(h);
-
- for(i=0; i<MAX_COMPONENTS; i++)
- {
- tmpbuf[i]=NULL; outbuf[i]=NULL;
- }
-
- if(srcbuf==NULL || size<=0
- || dstbuf==NULL || width<=0 || pitch<0 || height<=0)
- _throw("Invalid argument in tjDecompress()");
- if(ps!=3 && ps!=4 && ps!=1)
- _throw("This decompressor can only handle 24-bit and 32-bit RGB or 8-bit grayscale output");
- if(!j->initd) _throw("Instance has not been initialized for decompression");
-
- if(pitch==0) pitch=width*ps;
-
- if(flags&TJ_FORCEMMX) putenv("JSIMD_FORCEMMX=1");
- else if(flags&TJ_FORCESSE) putenv("JSIMD_FORCESSE=1");
- else if(flags&TJ_FORCESSE2) putenv("JSIMD_FORCESSE2=1");
-
- if(setjmp(j->jerr.jb))
- { // this will execute if LIBJPEG has an error
- retval=-1;
- goto bailout;
- }
-
- j->jsms.bytes_in_buffer = size;
- j->jsms.next_input_byte = srcbuf;
-
- jpeg_read_header(&j->dinfo, TRUE);
-
- if(flags&TJ_YUV)
- {
- j_decompress_ptr dinfo=&j->dinfo;
- JSAMPLE *ptr=dstbuf;
-
- for(i=0; i<dinfo->num_components; i++)
- {
- jpeg_component_info *compptr=&dinfo->comp_info[i];
- int ih;
- iw[i]=compptr->width_in_blocks*DCTSIZE;
- ih=compptr->height_in_blocks*DCTSIZE;
- cw[i]=PAD(dinfo->image_width, dinfo->max_h_samp_factor)
- *compptr->h_samp_factor/dinfo->max_h_samp_factor;
- ch[i]=PAD(dinfo->image_height, dinfo->max_v_samp_factor)
- *compptr->v_samp_factor/dinfo->max_v_samp_factor;
- if(iw[i]!=cw[i] || ih!=ch[i]) usetmpbuf=1;
- th[i]=compptr->v_samp_factor*DCTSIZE;
- tmpbufsize+=iw[i]*th[i];
- if((outbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*ch[i]))==NULL)
- _throw("Memory allocation failed in tjDecompress()");
- for(row=0; row<ch[i]; row++)
- {
- outbuf[i][row]=ptr;
- ptr+=PAD(cw[i], 4);
- }
- }
- if(usetmpbuf)
- {
- if((_tmpbuf=(JSAMPLE *)malloc(sizeof(JSAMPLE)*tmpbufsize))==NULL)
- _throw("Memory allocation failed in tjDecompress()");
- ptr=_tmpbuf;
- for(i=0; i<dinfo->num_components; i++)
- {
- if((tmpbuf[i]=(JSAMPROW *)malloc(sizeof(JSAMPROW)*th[i]))==NULL)
- _throw("Memory allocation failed in tjDecompress()");
- for(row=0; row<th[i]; row++)
- {
- tmpbuf[i][row]=ptr;
- ptr+=iw[i];
- }
- }
- }
- }
- else
- {
- if((row_pointer=(JSAMPROW *)malloc(sizeof(JSAMPROW)*height))==NULL)
- _throw("Memory allocation failed in tjDecompress()");
- for(i=0; i<height; i++)
- {
- if(flags&TJ_BOTTOMUP) row_pointer[i]= &dstbuf[(height-i-1)*pitch];
- else row_pointer[i]= &dstbuf[i*pitch];
- }
- }
-
- if(ps==1) j->dinfo.out_color_space = JCS_GRAYSCALE;
- #if JCS_EXTENSIONS==1
- else j->dinfo.out_color_space = JCS_EXT_RGB;
- if(ps==3 && (flags&TJ_BGR))
- j->dinfo.out_color_space = JCS_EXT_BGR;
- else if(ps==4 && !(flags&TJ_BGR) && !(flags&TJ_ALPHAFIRST))
- j->dinfo.out_color_space = JCS_EXT_RGBX;
- else if(ps==4 && (flags&TJ_BGR) && !(flags&TJ_ALPHAFIRST))
- j->dinfo.out_color_space = JCS_EXT_BGRX;
- else if(ps==4 && (flags&TJ_BGR) && (flags&TJ_ALPHAFIRST))
- j->dinfo.out_color_space = JCS_EXT_XBGR;
- else if(ps==4 && !(flags&TJ_BGR) && (flags&TJ_ALPHAFIRST))
- j->dinfo.out_color_space = JCS_EXT_XRGB;
- #else
- #error "TurboJPEG requires JPEG colorspace extensions"
- #endif
-
- if(flags&TJ_FASTUPSAMPLE) j->dinfo.do_fancy_upsampling=FALSE;
- if(flags&TJ_YUV) j->dinfo.raw_data_out=TRUE;
-
- jpeg_start_decompress(&j->dinfo);
- if(flags&TJ_YUV)
- {
- j_decompress_ptr dinfo=&j->dinfo;
- for(row=0; row<dinfo->output_height;
- row+=dinfo->max_v_samp_factor*DCTSIZE)
- {
- JSAMPARRAY yuvptr[MAX_COMPONENTS];
- int crow[MAX_COMPONENTS];
- for(i=0; i<dinfo->num_components; i++)
- {
- jpeg_component_info *compptr=&dinfo->comp_info[i];
- crow[i]=row*compptr->v_samp_factor/dinfo->max_v_samp_factor;
- if(usetmpbuf) yuvptr[i]=tmpbuf[i];
- else yuvptr[i]=&outbuf[i][crow[i]];
- }
- jpeg_read_raw_data(dinfo, yuvptr, dinfo->max_v_samp_factor*DCTSIZE);
- if(usetmpbuf)
- {
- int j;
- for(i=0; i<dinfo->num_components; i++)
- {
- for(j=0; j<min(th[i], ch[i]-crow[i]); j++)
- {
- memcpy(outbuf[i][crow[i]+j], tmpbuf[i][j], cw[i]);
- }
- }
- }
- }
- }
- else
- {
- while(j->dinfo.output_scanline<j->dinfo.output_height)
- {
- jpeg_read_scanlines(&j->dinfo, &row_pointer[j->dinfo.output_scanline],
- j->dinfo.output_height-j->dinfo.output_scanline);
- }
- }
- jpeg_finish_decompress(&j->dinfo);
-
- bailout:
- if(j->dinfo.global_state>DSTATE_START) jpeg_abort_decompress(&j->dinfo);
- for(i=0; i<MAX_COMPONENTS; i++)
- {
- if(tmpbuf[i]) free(tmpbuf[i]);
- if(outbuf[i]) free(outbuf[i]);
- }
- if(_tmpbuf) free(_tmpbuf);
- if(row_pointer) free(row_pointer);
- return retval;
-}
-
-
-DLLEXPORT int DLLCALL tjDecompressToYUV(tjhandle h,
- unsigned char *srcbuf, unsigned long size,
- unsigned char *dstbuf, int flags)
-{
- return tjDecompress(h, srcbuf, size, dstbuf, 1, 0, 1, 3, flags|TJ_YUV);
-}
-
-
-// General
-
-DLLEXPORT char* DLLCALL tjGetErrorStr(void)
-{
- return lasterror;
-}
-
-DLLEXPORT int DLLCALL tjDestroy(tjhandle h)
-{
- checkhandle(h);
- if(setjmp(j->jerr.jb)) return -1;
- if(j->initc) jpeg_destroy_compress(&j->cinfo);
- if(j->initd) jpeg_destroy_decompress(&j->dinfo);
- free(j);
- return 0;
-}
diff --git a/win/jconfig.h.in b/win/jconfig.h.in
index 3b835ea..373976d 100644
--- a/win/jconfig.h.in
+++ b/win/jconfig.h.in
@@ -32,7 +32,15 @@
#endif
#define XMD_H /* prevent jmorecfg.h from redefining it */
-#define inline __inline
+#ifndef INLINE
+#if defined(__GNUC__)
+#define INLINE __attribute__((always_inline))
+#elif defined(_MSC_VER)
+#define INLINE __forceinline
+#else
+#define INLINE
+#endif
+#endif
#ifdef JPEG_INTERNALS
diff --git a/win/jsimdcfg.inc b/win/jsimdcfg.inc
index 68e22e8..9d4aede 100755
--- a/win/jsimdcfg.inc
+++ b/win/jsimdcfg.inc
@@ -13,6 +13,31 @@
%define RGB_GREEN 1
%define RGB_BLUE 2
%define RGB_PIXELSIZE 3
+%define EXT_RGB_RED 0
+%define EXT_RGB_GREEN 1
+%define EXT_RGB_BLUE 2
+%define EXT_RGB_PIXELSIZE 3
+%define EXT_RGBX_RED 0
+%define EXT_RGBX_GREEN 1
+%define EXT_RGBX_BLUE 2
+%define EXT_RGBX_PIXELSIZE 4
+%define EXT_BGR_RED 2
+%define EXT_BGR_GREEN 1
+%define EXT_BGR_BLUE 0
+%define EXT_BGR_PIXELSIZE 3
+%define EXT_BGRX_RED 2
+%define EXT_BGRX_GREEN 1
+%define EXT_BGRX_BLUE 0
+%define EXT_BGRX_PIXELSIZE 4
+%define EXT_XBGR_RED 3
+%define EXT_XBGR_GREEN 2
+%define EXT_XBGR_BLUE 1
+%define EXT_XBGR_PIXELSIZE 4
+%define EXT_XRGB_RED 1
+%define EXT_XRGB_GREEN 2
+%define EXT_XRGB_BLUE 3
+%define EXT_XRGB_PIXELSIZE 4
+%define RGBX_FILLER_0XFF 1
; Representation of a single sample (pixel element value).
; On this SIMD implementation, this must be 'unsigned char'.
;