mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 876216 - Update libjpeg-turbo to version 1.3.0. r=jlebar
This commit is contained in:
parent
7ef37edc87
commit
e3ea827d96
@ -58,6 +58,10 @@ To upgrade to a new revision of libjpeg-turbo, do the following:
|
||||
|
||||
$ hg addremove
|
||||
|
||||
== June 4, 2013 (libjpeg-turbo v1.3.0 r988 2013-05-25) ==
|
||||
|
||||
* Updated to v1.3.0 release.
|
||||
|
||||
== December 12, 2012 ==
|
||||
|
||||
* Replace the runtime computed jpeg_nbits_table with constants in
|
||||
|
@ -1,8 +1,8 @@
|
||||
libjpeg-turbo note: This file contains portions of the libjpeg v6b and v8
|
||||
README files, with additional wordsmithing by The libjpeg-turbo Project.
|
||||
It is included only for reference, as some parts of it may not apply to
|
||||
libjpeg-turbo. Please see README-turbo.txt for information specific to
|
||||
libjpeg-turbo.
|
||||
libjpeg-turbo note: This file has been modified by The libjpeg-turbo Project
|
||||
to include only information relevant to libjpeg-turbo, to wordsmith certain
|
||||
sections, and to remove impolitic language that existed in the libjpeg v8
|
||||
README. It is included only for reference. Please see README-turbo.txt for
|
||||
information specific to libjpeg-turbo.
|
||||
|
||||
|
||||
The Independent JPEG Group's JPEG software
|
||||
@ -17,7 +17,8 @@ Bill Allombert, Jim Boucher, Lee Crocker, Bob Friesenhahn, Ben Jackson,
|
||||
Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Ge' Weijers,
|
||||
and other members of the Independent JPEG Group.
|
||||
|
||||
IJG is not affiliated with the official ISO JPEG standards committee.
|
||||
IJG is not affiliated with the ISO/IEC JTC1/SC29/WG1 standards committee
|
||||
(also known as JPEG, together with ITU-T SG16).
|
||||
|
||||
|
||||
DOCUMENTATION ROADMAP
|
||||
@ -45,7 +46,6 @@ Programmer and internal documentation:
|
||||
libjpeg.txt How to use the JPEG library in your own programs.
|
||||
example.c Sample code for calling the JPEG library.
|
||||
structure.txt Overview of the JPEG library's internal structure.
|
||||
filelist.txt Road map of IJG files.
|
||||
coderules.txt Coding style rules --- please read if you contribute code.
|
||||
|
||||
Please read at least the files install.txt and usage.txt. Some information
|
||||
@ -129,7 +129,7 @@ with respect to this software, its quality, accuracy, merchantability, or
|
||||
fitness for a particular purpose. This software is provided "AS IS", and you,
|
||||
its user, assume the entire risk as to its quality and accuracy.
|
||||
|
||||
This software is copyright (C) 1991-2010, Thomas G. Lane, Guido Vollbeding.
|
||||
This software is copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
|
||||
All Rights Reserved except as specified below.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
@ -160,15 +160,6 @@ commercial products, provided that all warranty or liability claims are
|
||||
assumed by the product vendor.
|
||||
|
||||
|
||||
ansi2knr.c is included in this distribution by permission of L. Peter Deutsch,
|
||||
sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA.
|
||||
ansi2knr.c is NOT covered by the above copyright and conditions, but instead
|
||||
by the usual distribution terms of the Free Software Foundation; principally,
|
||||
that you must include source code if you redistribute it. (See the file
|
||||
ansi2knr.c for full details.) However, since ansi2knr.c is not needed as part
|
||||
of any program generated from the IJG code, this does not limit you more than
|
||||
the foregoing paragraphs do.
|
||||
|
||||
The Unix configuration script "configure" was produced with GNU Autoconf.
|
||||
It is copyright by the Free Software Foundation but is freely distributable.
|
||||
The same holds for its supporting scripts (config.guess, config.sub,
|
||||
@ -274,11 +265,12 @@ with body
|
||||
FILE FORMAT WARS
|
||||
================
|
||||
|
||||
The ISO JPEG standards committee actually promotes different formats like
|
||||
"JPEG 2000" or "JPEG XR", which are incompatible with original DCT-based
|
||||
JPEG. IJG therefore does not support these formats (see REFERENCES). Indeed,
|
||||
one of the original reasons for developing this free software was to help
|
||||
force convergence on common, interoperable format standards for JPEG files.
|
||||
The ISO/IEC JTC1/SC29/WG1 standards committee (also known as JPEG, together
|
||||
with ITU-T SG16) currently promotes different formats containing the name
|
||||
"JPEG" which are incompatible with original DCT-based JPEG. IJG therefore does
|
||||
not support these formats (see REFERENCES). Indeed, one of the original
|
||||
reasons for developing this free software was to help force convergence on
|
||||
common, interoperable format standards for JPEG files.
|
||||
Don't use an incompatible file format!
|
||||
(In any case, our decoder will remain capable of reading existing JPEG
|
||||
image files indefinitely.)
|
||||
|
@ -2,24 +2,26 @@
|
||||
** Background
|
||||
*******************************************************************************
|
||||
|
||||
libjpeg-turbo is a derivative of libjpeg that uses SIMD instructions (MMX,
|
||||
SSE2, NEON) to accelerate baseline JPEG compression and decompression on x86,
|
||||
x86-64, and ARM systems. On such systems, libjpeg-turbo is generally 2-4x as
|
||||
fast as the unmodified version of libjpeg, all else being equal.
|
||||
libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2,
|
||||
NEON) to accelerate baseline JPEG compression and decompression on x86, x86-64,
|
||||
and ARM systems. On such systems, libjpeg-turbo is generally 2-4x as fast as
|
||||
libjpeg, all else being equal. On other types of systems, libjpeg-turbo can
|
||||
still outperform libjpeg by a significant amount, by virtue of its
|
||||
highly-optimized Huffman coding routines. In many cases, the performance of
|
||||
libjpeg-turbo rivals that of proprietary high-speed JPEG codecs.
|
||||
|
||||
libjpeg-turbo was originally based on libjpeg/SIMD by Miyasaka Masaru, but
|
||||
the TigerVNC and VirtualGL projects made numerous enhancements to the codec in
|
||||
2009, including improved support for Mac OS X, 64-bit support, support for
|
||||
32-bit and big-endian pixel formats (RGBX, XBGR, etc.), accelerated Huffman
|
||||
encoding/decoding, and various bug fixes. The goal was to produce a fully
|
||||
open-source codec that could replace the partially closed-source TurboJPEG/IPP
|
||||
codec used by VirtualGL and TurboVNC. libjpeg-turbo generally achieves 80-120%
|
||||
of the performance of TurboJPEG/IPP. It is faster in some areas but slower in
|
||||
others.
|
||||
libjpeg-turbo implements both the traditional libjpeg API as well as the less
|
||||
powerful but more straightforward TurboJPEG API. libjpeg-turbo also features
|
||||
colorspace extensions that allow it to compress from/decompress to 32-bit and
|
||||
big-endian pixel buffers (RGBX, XBGR, etc.), as well as a full-featured Java
|
||||
interface.
|
||||
|
||||
In early 2010, libjpeg-turbo spun off into its own independent project, with
|
||||
the goal of making high-speed JPEG compression/decompression technology
|
||||
available to a broader range of users and developers.
|
||||
libjpeg-turbo was originally based on libjpeg/SIMD, an MMX-accelerated
|
||||
derivative of libjpeg v6b developed by Miyasaka Masaru. The TigerVNC and
|
||||
VirtualGL projects made numerous enhancements to the codec in 2009, and in
|
||||
early 2010, libjpeg-turbo spun off into an independent project, with the goal
|
||||
of making high-speed JPEG compression/decompression technology available to a
|
||||
broader range of users and developers.
|
||||
|
||||
|
||||
*******************************************************************************
|
||||
@ -27,7 +29,7 @@ available to a broader range of users and developers.
|
||||
*******************************************************************************
|
||||
|
||||
Most of libjpeg-turbo inherits the non-restrictive, BSD-style license used by
|
||||
libjpeg (see README.) The TurboJPEG/OSS wrapper (both C and Java versions) and
|
||||
libjpeg (see README.) The TurboJPEG wrapper (both C and Java versions) and
|
||||
associated test programs bear a similar license, which is reproduced below:
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@ -71,16 +73,32 @@ JPEG images:
|
||||
|
||||
libjpeg API: This is the de facto industry-standard API for compressing and
|
||||
decompressing JPEG images. It is more difficult to use than the TurboJPEG
|
||||
API 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.)
|
||||
API but also more powerful. The libjpeg API implementation in 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.)
|
||||
|
||||
There is no significant performance advantage to either API when both are used
|
||||
to perform similar operations.
|
||||
|
||||
======================
|
||||
Installation Directory
|
||||
======================
|
||||
|
||||
This document assumes that libjpeg-turbo will be installed in the default
|
||||
directory (/opt/libjpeg-turbo on Un*x and Mac systems and
|
||||
c:\libjpeg-turbo[-gcc][64] on Windows systems. If your installation of
|
||||
libjpeg-turbo resides in a different directory, then adjust the instructions
|
||||
accordingly.
|
||||
|
||||
=============================
|
||||
Replacing libjpeg at Run Time
|
||||
=============================
|
||||
|
||||
If a Unix application is dynamically linked with libjpeg, then you can replace
|
||||
Un*x
|
||||
----
|
||||
|
||||
If a Un*x application is dynamically linked with libjpeg, then you can replace
|
||||
libjpeg with libjpeg-turbo at run time by manipulating LD_LIBRARY_PATH.
|
||||
For instance:
|
||||
|
||||
@ -97,67 +115,51 @@ For instance:
|
||||
user 0m0.029s
|
||||
sys 0m0.010s
|
||||
|
||||
NOTE: {lib} can be lib, lib32, lib64, or lib/64, depending on the O/S and
|
||||
architecture.
|
||||
({lib} = lib32 or lib64, depending on whether you wish to use the 32-bit or the
|
||||
64-bit version of libjpeg-turbo.)
|
||||
|
||||
System administrators can also replace the libjpeg sym links in /usr/{lib} with
|
||||
System administrators can also replace the libjpeg symlinks in /usr/lib* with
|
||||
links to the libjpeg-turbo dynamic library located in /opt/libjpeg-turbo/{lib}.
|
||||
This will effectively accelerate every application that uses the libjpeg
|
||||
dynamic library on the system.
|
||||
|
||||
The libjpeg-turbo SDK for Visual C++ installs the libjpeg-turbo DLL
|
||||
(jpeg62.dll, jpeg7.dll, or jpeg8.dll, depending on whether it was built with
|
||||
libjpeg v6b, v7, or v8 emulation) into c:\libjpeg-turbo[64]\bin, and the PATH
|
||||
environment variable can be modified such that this directory is searched
|
||||
before any others that might contain a libjpeg DLL. However, if a libjpeg
|
||||
DLL exists in an application's install directory, then Windows will load this
|
||||
DLL first whenever the application is launched. Thus, if an application ships
|
||||
with jpeg62.dll, jpeg7.dll, or jpeg8.dll, then back up the application's
|
||||
version of this DLL and copy c:\libjpeg-turbo[64]\bin\jpeg*.dll into the
|
||||
application's install directory to accelerate it.
|
||||
Windows
|
||||
-------
|
||||
|
||||
The version of the libjpeg-turbo DLL distributed in the libjpeg-turbo SDK for
|
||||
Visual C++ requires the Visual C++ 2008 C run-time DLL (msvcr90.dll).
|
||||
If a Windows application is dynamically linked with libjpeg, then you can
|
||||
replace libjpeg with libjpeg-turbo at run time by backing up the application's
|
||||
copy of jpeg62.dll, jpeg7.dll, or jpeg8.dll (assuming the application has its
|
||||
own local copy of this library) and copying the corresponding DLL from
|
||||
libjpeg-turbo into the application's install directory. The official
|
||||
libjpeg-turbo binary packages only provide jpeg62.dll. If the application uses
|
||||
jpeg7.dll or jpeg8.dll instead, then it will be necessary to build
|
||||
libjpeg-turbo from source (see "libjpeg v7 and v8 API/ABI Emulation" below.)
|
||||
|
||||
The following information is specific to the official libjpeg-turbo binary
|
||||
packages for Visual C++:
|
||||
|
||||
-- jpeg62.dll requires the Visual C++ 2008 C run-time DLL (msvcr90.dll).
|
||||
msvcr90.dll ships with more recent versions of Windows, but users of older
|
||||
Windows releases can obtain it from the Visual C++ 2008 Redistributable
|
||||
Package, which is available as a free download from Microsoft's web site.
|
||||
|
||||
NOTE: Features of libjpeg that require passing a C run-time structure, such
|
||||
as a file handle, from an application to libjpeg will probably not work with
|
||||
the version of the libjpeg-turbo DLL distributed in the libjpeg-turbo SDK for
|
||||
Visual C++, unless the application is also built to use the Visual C++ 2008 C
|
||||
run-time DLL. In particular, this affects jpeg_stdio_dest() and
|
||||
-- Features of the libjpeg API that require passing a C run-time structure,
|
||||
such as a file handle, from an application to the library will probably not
|
||||
work with jpeg62.dll, unless the application is also built to use the Visual
|
||||
C++ 2008 C run-time DLL. In particular, this affects jpeg_stdio_dest() and
|
||||
jpeg_stdio_src().
|
||||
|
||||
Mac
|
||||
---
|
||||
|
||||
Mac applications typically embed their own copies of the libjpeg dylib inside
|
||||
the (hidden) application bundle, so it is not possible to globally replace
|
||||
libjpeg on OS X systems. If an application uses a shared library version of
|
||||
libjpeg, then it may be possible to replace the application's version of it.
|
||||
This would generally involve copying libjpeg.*.dylib from libjpeg-turbo into
|
||||
libjpeg on OS X systems. Replacing the application's version of the libjpeg
|
||||
dylib would generally involve copying libjpeg.*.dylib from libjpeg-turbo into
|
||||
the appropriate place in the application bundle and using install_name_tool to
|
||||
repoint the dylib to the new directory. This requires an advanced knowledge of
|
||||
OS X and would not survive an upgrade or a re-install of the application.
|
||||
Thus, it is not recommended for most users.
|
||||
|
||||
=======================
|
||||
Replacing TurboJPEG/IPP
|
||||
=======================
|
||||
|
||||
libjpeg-turbo is a drop-in replacement for the TurboJPEG/IPP SDK used by
|
||||
VirtualGL 2.1.x and TurboVNC 0.6 (and prior.) libjpeg-turbo contains a wrapper
|
||||
library (TurboJPEG/OSS) that emulates the TurboJPEG API using libjpeg-turbo
|
||||
instead of the closed-source Intel Performance Primitives. You can replace the
|
||||
TurboJPEG/IPP package on Linux systems with the libjpeg-turbo package in order
|
||||
to make existing releases of VirtualGL 2.1.x and TurboVNC 0.x use the new codec
|
||||
at run time. Note that the 64-bit libjpeg-turbo packages contain only 64-bit
|
||||
binaries, whereas the TurboJPEG/IPP 64-bit packages contained both 64-bit and
|
||||
32-bit binaries. Thus, to replace a TurboJPEG/IPP 64-bit package, install
|
||||
both the 64-bit and 32-bit versions of libjpeg-turbo.
|
||||
|
||||
You can also build the VirtualGL 2.1.x and TurboVNC 0.6 source code with
|
||||
the libjpeg-turbo SDK instead of TurboJPEG/IPP. It should work identically.
|
||||
libjpeg-turbo also includes static library versions of TurboJPEG/OSS, which
|
||||
are used to build VirtualGL 2.2 and TurboVNC 1.0 and later.
|
||||
repoint the libjpeg-turbo dylib to its new directory. This requires an
|
||||
advanced knowledge of OS X and would not survive an upgrade or a re-install of
|
||||
the application. Thus, it is not recommended for most users.
|
||||
|
||||
========================================
|
||||
Using libjpeg-turbo in Your Own Programs
|
||||
@ -165,8 +167,8 @@ Using libjpeg-turbo in Your Own Programs
|
||||
|
||||
For the most part, libjpeg-turbo should work identically to libjpeg, so in
|
||||
most cases, an application can be built against libjpeg and then run against
|
||||
libjpeg-turbo. On Unix systems (including Cygwin), you can build against
|
||||
libjpeg-turbo instead of libjpeg by setting
|
||||
libjpeg-turbo. On Un*x systems and Cygwin, you can build against libjpeg-turbo
|
||||
instead of libjpeg by setting
|
||||
|
||||
CPATH=/opt/libjpeg-turbo/include
|
||||
and
|
||||
@ -183,20 +185,20 @@ If using MinGW, then set
|
||||
|
||||
Building against libjpeg-turbo is useful, for instance, if you want to build an
|
||||
application that leverages the libjpeg-turbo colorspace extensions (see below.)
|
||||
On Linux and Solaris systems, you would still need to manipulate
|
||||
LD_LIBRARY_PATH or create appropriate sym links to use libjpeg-turbo at run
|
||||
time. On such systems, you can pass -R /opt/libjpeg-turbo/{lib} to the linker
|
||||
to force the use of libjpeg-turbo at run time rather than libjpeg (also useful
|
||||
if you want to leverage the colorspace extensions), or you can link against the
|
||||
libjpeg-turbo static library.
|
||||
On Un*x systems, you would still need to manipulate LD_LIBRARY_PATH or create
|
||||
appropriate symlinks to use libjpeg-turbo at run time. On such systems, you
|
||||
can pass -R /opt/libjpeg-turbo/{lib} to the linker to force the use of
|
||||
libjpeg-turbo at run time rather than libjpeg (also useful if you want to
|
||||
leverage the colorspace extensions), or you can link against the libjpeg-turbo
|
||||
static library.
|
||||
|
||||
To force a Linux, Solaris, or MinGW application to link against the static
|
||||
version of libjpeg-turbo, you can use the following linker options:
|
||||
To force a Un*x or MinGW application to link against the static version of
|
||||
libjpeg-turbo, you can use the following linker options:
|
||||
|
||||
-Wl,-Bstatic -ljpeg -Wl,-Bdynamic
|
||||
|
||||
On OS X, simply add /opt/libjpeg-turbo/lib/libjpeg.a to the linker command
|
||||
line (this also works on Linux and Solaris.)
|
||||
line.
|
||||
|
||||
To build Visual C++ applications using libjpeg-turbo, add
|
||||
c:\libjpeg-turbo[64]\include to the system or user INCLUDE environment
|
||||
@ -234,8 +236,10 @@ time with:
|
||||
|
||||
#ifdef JCS_EXTENSIONS
|
||||
|
||||
At run time, attempting to use these extensions with a version of libjpeg
|
||||
that doesn't support them will result in a "Bogus input colorspace" error.
|
||||
At run time, attempting to use these extensions with a libjpeg implementation
|
||||
that does not support them will result in a "Bogus input colorspace" error.
|
||||
Applications can trap this error in order to test whether run-time support is
|
||||
available for the colorspace extensions.
|
||||
|
||||
When using the RGBX, BGRX, XBGR, and XRGB colorspaces during decompression, the
|
||||
X byte is undefined, and in order to ensure the best performance, libjpeg-turbo
|
||||
@ -252,34 +256,47 @@ extensions at compile time with:
|
||||
jcstest.c, located in the libjpeg-turbo source tree, demonstrates how to check
|
||||
for the existence of the colorspace extensions at compile time and run time.
|
||||
|
||||
=================================
|
||||
libjpeg v7 and v8 API/ABI support
|
||||
=================================
|
||||
===================================
|
||||
libjpeg v7 and v8 API/ABI Emulation
|
||||
===================================
|
||||
|
||||
With libjpeg v7 and v8, new features were added that necessitated extending the
|
||||
compression and decompression structures. Unfortunately, due to the exposed
|
||||
nature of those structures, extending them also necessitated breaking backward
|
||||
ABI compatibility with previous libjpeg releases. Thus, programs that are
|
||||
ABI compatibility with previous libjpeg releases. Thus, programs that were
|
||||
built to use libjpeg v7 or v8 did not work with libjpeg-turbo, since it is
|
||||
based on the libjpeg v6b code base. Although libjpeg v7 and v8 are still not
|
||||
as widely used as v6b, enough programs (including a few Linux distros) have
|
||||
made the switch that it was desirable to provide support for the libjpeg v7/v8
|
||||
API/ABI in libjpeg-turbo. Although libjpeg-turbo can now be configured as a
|
||||
drop-in replacement for libjpeg v7 or v8, it should be noted that not all of
|
||||
the features in libjpeg v7 and v8 are supported (see below.)
|
||||
as widely used as v6b, enough programs (including a few Linux distros) made
|
||||
the switch that there was a demand to emulate the libjpeg v7 and v8 ABIs
|
||||
in libjpeg-turbo. It should be noted, however, that this feature was added
|
||||
primarily so that applications that had already been compiled to use libjpeg
|
||||
v7+ could take advantage of accelerated baseline JPEG encoding/decoding
|
||||
without recompiling. libjpeg-turbo does not claim to support all of the
|
||||
libjpeg v7+ features, nor to produce identical output to libjpeg v7+ in all
|
||||
cases (see below.)
|
||||
|
||||
By passing an argument of --with-jpeg7 or --with-jpeg8 to configure, or an
|
||||
argument of -DWITH_JPEG7=1 or -DWITH_JPEG8=1 to cmake, you can build a version
|
||||
of libjpeg-turbo that emulates the libjpeg v7 or v8 API/ABI, so that programs
|
||||
of libjpeg-turbo that emulates the libjpeg v7 or v8 ABI, so that programs
|
||||
that are built against libjpeg v7 or v8 can be run with libjpeg-turbo. The
|
||||
following section describes which libjpeg v7+ features are supported and which
|
||||
aren't.
|
||||
|
||||
libjpeg v7 and v8 Features:
|
||||
---------------------------
|
||||
Support for libjpeg v7 and v8 Features:
|
||||
---------------------------------------
|
||||
|
||||
Fully supported:
|
||||
|
||||
-- libjpeg: IDCT scaling extensions in decompressor
|
||||
libjpeg-turbo supports IDCT scaling with scaling factors of 1/8, 1/4, 3/8,
|
||||
1/2, 5/8, 3/4, 7/8, 9/8, 5/4, 11/8, 3/2, 13/8, 7/4, 15/8, and 2/1 (only 1/4
|
||||
and 1/2 are SIMD-accelerated.)
|
||||
|
||||
-- libjpeg: arithmetic coding
|
||||
|
||||
-- libjpeg: In-memory source and destination managers
|
||||
See notes below.
|
||||
|
||||
-- cjpeg: Separate quality settings for luminance and chrominance
|
||||
Note that the libpjeg v7+ API was extended to accommodate this feature only
|
||||
for convenience purposes. It has always been possible to implement this
|
||||
@ -287,38 +304,47 @@ Fully supported:
|
||||
|
||||
-- cjpeg: 32-bit BMP support
|
||||
|
||||
-- cjpeg: -rgb option
|
||||
|
||||
-- jpegtran: lossless cropping
|
||||
|
||||
-- jpegtran: -perfect option
|
||||
|
||||
-- jpegtran: forcing width/height when performing lossless crop
|
||||
|
||||
-- rdjpgcom: -raw option
|
||||
|
||||
-- rdjpgcom: locale awareness
|
||||
|
||||
|
||||
Fully supported when using libjpeg v7/v8 emulation:
|
||||
|
||||
-- libjpeg: In-memory source and destination managers
|
||||
|
||||
|
||||
Not supported:
|
||||
|
||||
NOTE: As of this writing, extensive research has been conducted into the
|
||||
usefulness of DCT scaling as a means of data reduction and SmartScale as a
|
||||
means of quality improvement. The reader is invited to peruse the research at
|
||||
http://www.libjpeg-turbo.org/About/SmartScale and draw his/her own conclusions,
|
||||
but it is the general belief of our project that these features have not
|
||||
demonstrated sufficient usefulness to justify inclusion in libjpeg-turbo.
|
||||
|
||||
-- libjpeg: DCT scaling in compressor
|
||||
cinfo.scale_num and cinfo.scale_denom are silently ignored.
|
||||
There is no technical reason why DCT scaling cannot be supported, but
|
||||
without the SmartScale extension (see below), it would only be able to
|
||||
down-scale using ratios of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and 8/9,
|
||||
which is of limited usefulness.
|
||||
There is no technical reason why DCT scaling could not be supported when
|
||||
emulating the libjpeg v7+ API/ABI, but without the SmartScale extension (see
|
||||
below), only scaling factors of 1/2, 8/15, 4/7, 8/13, 2/3, 8/11, 4/5, and
|
||||
8/9 would be available, which is of limited usefulness.
|
||||
|
||||
-- libjpeg: SmartScale
|
||||
cinfo.block_size is silently ignored.
|
||||
SmartScale is an extension to the JPEG format that allows for DCT block
|
||||
sizes other than 8x8. It would be difficult to support this feature while
|
||||
retaining backward compatibility with libjpeg v6b.
|
||||
|
||||
-- libjpeg: IDCT scaling extensions in decompressor
|
||||
libjpeg-turbo still supports IDCT scaling with scaling factors of 1/2, 1/4,
|
||||
and 1/8 (same as libjpeg v6b.)
|
||||
sizes other than 8x8. Providing support for this new format would be
|
||||
feasible (particularly without full acceleration.) However, until/unless
|
||||
the format becomes either an official industry standard or, at minimum, an
|
||||
accepted solution in the community, we are hesitant to implement it, as
|
||||
there is no sense of whether or how it might change in the future. It is
|
||||
our belief that SmartScale has not demonstrated sufficient usefulness as a
|
||||
lossless format nor as a means of quality enhancement, and thus, our primary
|
||||
interest in providing this feature would be as a means of supporting
|
||||
additional DCT scaling factors.
|
||||
|
||||
-- libjpeg: Fancy downsampling in compressor
|
||||
cinfo.do_fancy_downsampling is silently ignored.
|
||||
@ -331,9 +357,97 @@ Not supported:
|
||||
-- Lossless RGB JPEG files
|
||||
This requires the SmartScale feature, which is not supported.
|
||||
|
||||
What About libjpeg v9?
|
||||
----------------------
|
||||
|
||||
libjpeg v9 introduced yet another field to the JPEG compression structure
|
||||
(color_transform), thus making the ABI backward incompatible with that of
|
||||
libjpeg v8. This new field was introduced solely for the purpose of supporting
|
||||
lossless SmartScale encoding. Further, there was actually no reason to extend
|
||||
the API in this manner, as the color transform could have just as easily been
|
||||
activated by way of a new JPEG colorspace constant, thus preserving backward
|
||||
ABI compatibility.
|
||||
|
||||
Our research (see link above) has shown that lossless SmartScale does not
|
||||
generally accomplish anything that can't already be accomplished better with
|
||||
existing, standard lossless formats. Thus, at this time, it is our belief that
|
||||
there is not sufficient technical justification for software to upgrade from
|
||||
libjpeg v8 to libjpeg v9, and therefore, not sufficient technical justification
|
||||
for us to emulate the libjpeg v9 ABI.
|
||||
|
||||
=====================================
|
||||
In-Memory Source/Destination Managers
|
||||
=====================================
|
||||
|
||||
By default, libjpeg-turbo 1.3 and later includes the jpeg_mem_src() and
|
||||
jpeg_mem_dest() functions, even when not emulating the libjpeg v8 API/ABI.
|
||||
Previously, it was necessary to build libjpeg-turbo from source with libjpeg v8
|
||||
API/ABI emulation in order to use the in-memory source/destination managers,
|
||||
but several projects requested that those functions be included when emulating
|
||||
the libjpeg v6b API/ABI as well. This allows the use of those functions by
|
||||
programs that need them without breaking ABI compatibility for programs that
|
||||
don't, and it allows those functions to be provided in the "official"
|
||||
libjpeg-turbo binaries.
|
||||
|
||||
Those who are concerned about maintaining strict conformance with the libjpeg
|
||||
v6b or v7 API can pass an argument of --without-mem-srcdst to configure or
|
||||
an argument of -DWITH_MEM_SRCDST=0 to CMake prior to building libjpeg-turbo.
|
||||
This will restore the pre-1.3 behavior, in which jpeg_mem_src() and
|
||||
jpeg_mem_dest() are only included when emulating the libjpeg v8 API/ABI.
|
||||
|
||||
On Un*x systems, including the in-memory source/destination managers changes
|
||||
the dynamic library version from 62.0.0 to 62.1.0 if using libjpeg v6b API/ABI
|
||||
emulation and from 7.0.0 to 7.1.0 if using libjpeg v7 API/ABI emulation.
|
||||
|
||||
Note that, on most Un*x systems, the dynamic linker will not look for a
|
||||
function in a library until that function is actually used. Thus, if a program
|
||||
is built against libjpeg-turbo 1.3+ and uses jpeg_mem_src() or jpeg_mem_dest(),
|
||||
that program will not fail if run against an older version of libjpeg-turbo or
|
||||
against libjpeg v7- until the program actually tries to call jpeg_mem_src() or
|
||||
jpeg_mem_dest(). Such is not the case on Windows. If a program is built
|
||||
against the libjpeg-turbo 1.3+ DLL and uses jpeg_mem_src() or jpeg_mem_dest(),
|
||||
then it must use the libjpeg-turbo 1.3+ DLL at run time.
|
||||
|
||||
Both cjpeg and djpeg have been extended to allow testing the in-memory
|
||||
source/destination manager functions. See their respective man pages for more
|
||||
details.
|
||||
|
||||
|
||||
*******************************************************************************
|
||||
** Performance pitfalls
|
||||
** Mathematical Compatibility
|
||||
*******************************************************************************
|
||||
|
||||
For the most part, libjpeg-turbo should produce identical output to libjpeg
|
||||
v6b. The one exception to this is when using the floating point DCT/IDCT, in
|
||||
which case the outputs of libjpeg v6b and libjpeg-turbo are not guaranteed to
|
||||
be identical (the accuracy of the floating point DCT/IDCT is constant when
|
||||
using libjpeg-turbo's SIMD extensions, but otherwise, it can depend heavily on
|
||||
the compiler and compiler settings.)
|
||||
|
||||
While libjpeg-turbo does emulate the libjpeg v8 API/ABI, under the hood, it is
|
||||
still using the same algorithms as libjpeg v6b, so there are several specific
|
||||
cases in which libjpeg-turbo cannot be expected to produce the same output as
|
||||
libjpeg v8:
|
||||
|
||||
-- When decompressing using scaling factors of 1/2 and 1/4, because libjpeg v8
|
||||
implements those scaling algorithms a bit differently than libjpeg v6b does,
|
||||
and libjpeg-turbo's SIMD extensions are based on the libjpeg v6b behavior.
|
||||
|
||||
-- When using chrominance subsampling, because libjpeg v8 implements this
|
||||
with its DCT/IDCT scaling algorithms rather than with a separate
|
||||
downsampling/upsampling algorithm.
|
||||
|
||||
-- When using the floating point IDCT, for the reasons stated above and also
|
||||
because the floating point IDCT algorithm was modified in libjpeg v8a to
|
||||
improve accuracy.
|
||||
|
||||
-- When decompressing using a scaling factor > 1 and merged (AKA "non-fancy" or
|
||||
"non-smooth") chrominance upsampling, because libjpeg v8 does not support
|
||||
merged upsampling with scaling factors > 1.
|
||||
|
||||
|
||||
*******************************************************************************
|
||||
** Performance Pitfalls
|
||||
*******************************************************************************
|
||||
|
||||
===============
|
||||
|
@ -1,5 +1,5 @@
|
||||
#define VERSION "1.2.1"
|
||||
#define BUILD "2012-06-30"
|
||||
#define VERSION "1.3.0"
|
||||
#define BUILD "2013-05-25"
|
||||
#define PACKAGE_NAME "libjpeg-turbo"
|
||||
|
||||
/* Need to use Mozilla-specific function inlining. */
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jccolext.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* Copyright (C) 2009-2012, 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.
|
||||
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* jccolor.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2009-2012, 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.
|
||||
|
@ -1,11 +1,12 @@
|
||||
/*
|
||||
* jcdctmgr.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* Copyright (C) 1999-2006, MIYASAKA Masaru.
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 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 the forward-DCT management logic.
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jchuff.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* 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 Huffman entropy encoding routines.
|
||||
@ -291,8 +292,6 @@ dump_buffer (working_state * state)
|
||||
{
|
||||
struct jpeg_destination_mgr * dest = state->cinfo->dest;
|
||||
|
||||
dest->free_in_buffer = state->free_in_buffer;
|
||||
|
||||
if (! (*dest->empty_output_buffer) (state->cinfo))
|
||||
return FALSE;
|
||||
/* After a successful buffer dump, must reset buffer pointers */
|
||||
|
@ -170,7 +170,7 @@ process_data_buffer_main (j_compress_ptr cinfo,
|
||||
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;
|
||||
int ci;
|
||||
jpeg_component_info *compptr;
|
||||
boolean writing = (main_ptr->pass_mode != JBUF_CRANK_DEST);
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jcmarker.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* Copyright (C) 2010, 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 routines to write JPEG datastream markers.
|
||||
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* jcmaster.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2003-2010 by Guido Vollbeding.
|
||||
* Modifications:
|
||||
* Copyright (C) 2010, 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 master control logic for the JPEG compressor.
|
||||
|
@ -5,7 +5,10 @@
|
||||
#define JPEG_LIB_VERSION 62
|
||||
|
||||
/* libjpeg-turbo version */
|
||||
#define LIBJPEG_TURBO_VERSION 1.2.0
|
||||
#define LIBJPEG_TURBO_VERSION 1.3.0
|
||||
|
||||
/* Support in-memory source/destination managers */
|
||||
/* #undef MEM_SRCDST_SUPPORTED */
|
||||
|
||||
/* Compiler supports function prototypes. */
|
||||
#define HAVE_PROTOTYPES 1
|
||||
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* jcparam.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2003-2008 by Guido Vollbeding.
|
||||
* Modifications:
|
||||
* 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 optional default-setting code for the JPEG compressor.
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jdapistd.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* Copyright (C) 2010, 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 application interface code for the decompression half
|
||||
|
@ -1,9 +1,11 @@
|
||||
/*
|
||||
* jdatadst.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2009 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* Modified 2009-2012 by Guido Vollbeding.
|
||||
* Modifications:
|
||||
* Copyright (C) 2013, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains compression data destination routines for the case of
|
||||
@ -40,7 +42,7 @@ typedef my_destination_mgr * my_dest_ptr;
|
||||
#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */
|
||||
|
||||
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
/* Expanded data destination object for memory output */
|
||||
|
||||
typedef struct {
|
||||
@ -76,7 +78,7 @@ init_destination (j_compress_ptr cinfo)
|
||||
dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
|
||||
}
|
||||
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
METHODDEF(void)
|
||||
init_mem_destination (j_compress_ptr cinfo)
|
||||
{
|
||||
@ -123,7 +125,7 @@ empty_output_buffer (j_compress_ptr cinfo)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
METHODDEF(boolean)
|
||||
empty_mem_output_buffer (j_compress_ptr cinfo)
|
||||
{
|
||||
@ -133,7 +135,7 @@ empty_mem_output_buffer (j_compress_ptr cinfo)
|
||||
|
||||
/* Try to allocate new buffer with double size */
|
||||
nextsize = dest->bufsize * 2;
|
||||
nextbuffer = malloc(nextsize);
|
||||
nextbuffer = (JOCTET *) malloc(nextsize);
|
||||
|
||||
if (nextbuffer == NULL)
|
||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
||||
@ -182,14 +184,14 @@ term_destination (j_compress_ptr cinfo)
|
||||
ERREXIT(cinfo, JERR_FILE_WRITE);
|
||||
}
|
||||
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
METHODDEF(void)
|
||||
term_mem_destination (j_compress_ptr cinfo)
|
||||
{
|
||||
my_mem_dest_ptr dest = (my_mem_dest_ptr) cinfo->dest;
|
||||
|
||||
*dest->outbuffer = dest->buffer;
|
||||
*dest->outsize = dest->bufsize - dest->pub.free_in_buffer;
|
||||
*dest->outsize = (unsigned long)(dest->bufsize - dest->pub.free_in_buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -225,7 +227,7 @@ jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile)
|
||||
}
|
||||
|
||||
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
/*
|
||||
* Prepare for output to a memory buffer.
|
||||
* The caller may supply an own initial buffer with appropriate size.
|
||||
@ -265,7 +267,7 @@ jpeg_mem_dest (j_compress_ptr cinfo,
|
||||
|
||||
if (*outbuffer == NULL || *outsize == 0) {
|
||||
/* Allocate initial buffer */
|
||||
dest->newbuffer = *outbuffer = malloc(OUTPUT_BUF_SIZE);
|
||||
dest->newbuffer = *outbuffer = (unsigned char *) malloc(OUTPUT_BUF_SIZE);
|
||||
if (dest->newbuffer == NULL)
|
||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
||||
*outsize = OUTPUT_BUF_SIZE;
|
||||
|
@ -1,9 +1,11 @@
|
||||
/*
|
||||
* jdatasrc.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2009-2010 by Guido Vollbeding.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* Modified 2009-2011 by Guido Vollbeding.
|
||||
* Modifications:
|
||||
* Copyright (C) 2013, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains decompression data source routines for the case of
|
||||
@ -53,7 +55,7 @@ init_source (j_decompress_ptr cinfo)
|
||||
src->start_of_file = TRUE;
|
||||
}
|
||||
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
METHODDEF(void)
|
||||
init_mem_source (j_decompress_ptr cinfo)
|
||||
{
|
||||
@ -120,20 +122,21 @@ fill_input_buffer (j_decompress_ptr cinfo)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
METHODDEF(boolean)
|
||||
fill_mem_input_buffer (j_decompress_ptr cinfo)
|
||||
{
|
||||
static JOCTET mybuffer[4];
|
||||
static const JOCTET mybuffer[4] = {
|
||||
(JOCTET) 0xFF, (JOCTET) JPEG_EOI, 0, 0
|
||||
};
|
||||
|
||||
/* 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;
|
||||
@ -243,7 +246,7 @@ jpeg_stdio_src (j_decompress_ptr cinfo, FILE * infile)
|
||||
}
|
||||
|
||||
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
/*
|
||||
* Prepare for input from a supplied memory buffer.
|
||||
* The buffer must contain the whole JPEG data.
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jdcoefct.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1997, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* Copyright (C) 2010, 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 the coefficient buffer controller for decompression.
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jdcolext.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* 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.
|
||||
|
@ -1,10 +1,12 @@
|
||||
/*
|
||||
* jdcolor.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2011 by Guido Vollbeding.
|
||||
* Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2009, 2011-2012, 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.
|
||||
@ -27,20 +29,28 @@ typedef struct {
|
||||
int * Cb_b_tab; /* => table for Cb to B conversion */
|
||||
INT32 * Cr_g_tab; /* => table for Cr to G conversion */
|
||||
INT32 * Cb_g_tab; /* => table for Cb to G conversion */
|
||||
|
||||
/* Private state for RGB->Y conversion */
|
||||
INT32 * rgb_y_tab; /* => table for RGB to Y conversion */
|
||||
} my_color_deconverter;
|
||||
|
||||
typedef my_color_deconverter * my_cconvert_ptr;
|
||||
|
||||
|
||||
/**************** YCbCr -> RGB conversion: most common case **************/
|
||||
/**************** RGB -> Y conversion: less common case **************/
|
||||
|
||||
/*
|
||||
* YCbCr is defined per CCIR 601-1, except that Cb and Cr are
|
||||
* normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
|
||||
* The conversion equations to be implemented are therefore
|
||||
*
|
||||
* R = Y + 1.40200 * Cr
|
||||
* G = Y - 0.34414 * Cb - 0.71414 * Cr
|
||||
* B = Y + 1.77200 * Cb
|
||||
*
|
||||
* Y = 0.29900 * R + 0.58700 * G + 0.11400 * B
|
||||
*
|
||||
* where Cb and Cr represent the incoming values less CENTERJSAMPLE.
|
||||
* (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
|
||||
*
|
||||
@ -65,6 +75,18 @@ typedef my_color_deconverter * my_cconvert_ptr;
|
||||
#define ONE_HALF ((INT32) 1 << (SCALEBITS-1))
|
||||
#define FIX(x) ((INT32) ((x) * (1L<<SCALEBITS) + 0.5))
|
||||
|
||||
/* We allocate one big table for RGB->Y conversion and divide it up into
|
||||
* three parts, instead of doing three alloc_small requests. This lets us
|
||||
* use a single table base address, which can be held in a register in the
|
||||
* inner loops on many machines (more than can hold all three addresses,
|
||||
* anyway).
|
||||
*/
|
||||
|
||||
#define R_Y_OFF 0 /* offset to R => Y section */
|
||||
#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */
|
||||
#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */
|
||||
#define TABLE_SIZE (3*(MAXJSAMPLE+1))
|
||||
|
||||
|
||||
/* Include inline routines for colorspace extensions */
|
||||
|
||||
@ -271,6 +293,66 @@ ycc_rgb_convert (j_decompress_ptr cinfo,
|
||||
/**************** Cases other than YCbCr -> RGB **************/
|
||||
|
||||
|
||||
/*
|
||||
* Initialize for RGB->grayscale colorspace conversion.
|
||||
*/
|
||||
|
||||
LOCAL(void)
|
||||
build_rgb_y_table (j_decompress_ptr cinfo)
|
||||
{
|
||||
my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
|
||||
INT32 * rgb_y_tab;
|
||||
INT32 i;
|
||||
|
||||
/* Allocate and fill in the conversion tables. */
|
||||
cconvert->rgb_y_tab = rgb_y_tab = (INT32 *)
|
||||
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
|
||||
(TABLE_SIZE * SIZEOF(INT32)));
|
||||
|
||||
for (i = 0; i <= MAXJSAMPLE; i++) {
|
||||
rgb_y_tab[i+R_Y_OFF] = FIX(0.29900) * i;
|
||||
rgb_y_tab[i+G_Y_OFF] = FIX(0.58700) * i;
|
||||
rgb_y_tab[i+B_Y_OFF] = FIX(0.11400) * i + ONE_HALF;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Convert RGB to grayscale.
|
||||
*/
|
||||
|
||||
METHODDEF(void)
|
||||
rgb_gray_convert (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 r, g, b;
|
||||
register INT32 * ctab = cconvert->rgb_y_tab;
|
||||
register JSAMPROW outptr;
|
||||
register JSAMPROW inptr0, inptr1, inptr2;
|
||||
register JDIMENSION col;
|
||||
JDIMENSION num_cols = cinfo->output_width;
|
||||
|
||||
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++) {
|
||||
r = GETJSAMPLE(inptr0[col]);
|
||||
g = GETJSAMPLE(inptr1[col]);
|
||||
b = GETJSAMPLE(inptr2[col]);
|
||||
/* Y */
|
||||
outptr[col] = (JSAMPLE)
|
||||
((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
|
||||
>> SCALEBITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Color conversion for no colorspace change: just copy the data,
|
||||
* converting from separate-planes to interleaved representation.
|
||||
@ -409,6 +491,7 @@ rgb_rgb_convert (j_decompress_ptr cinfo,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Adobe-style YCCK->CMYK conversion.
|
||||
* We convert YCbCr to R=1-C, G=1-M, and B=1-Y using the same
|
||||
@ -526,6 +609,9 @@ jinit_color_deconverter (j_decompress_ptr cinfo)
|
||||
/* For color->grayscale conversion, only the Y (0) component is needed */
|
||||
for (ci = 1; ci < cinfo->num_components; ci++)
|
||||
cinfo->comp_info[ci].component_needed = FALSE;
|
||||
} else if (cinfo->jpeg_color_space == JCS_RGB) {
|
||||
cconvert->pub.color_convert = rgb_gray_convert;
|
||||
build_rgb_y_table(cinfo);
|
||||
} else
|
||||
ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
|
||||
break;
|
||||
|
@ -95,9 +95,21 @@ typedef FAST_FLOAT FLOAT_MULT_TYPE; /* preferred floating type */
|
||||
#define jpeg_idct_islow jRDislow
|
||||
#define jpeg_idct_ifast jRDifast
|
||||
#define jpeg_idct_float jRDfloat
|
||||
#define jpeg_idct_7x7 jRD7x7
|
||||
#define jpeg_idct_6x6 jRD6x6
|
||||
#define jpeg_idct_5x5 jRD5x5
|
||||
#define jpeg_idct_4x4 jRD4x4
|
||||
#define jpeg_idct_3x3 jRD3x3
|
||||
#define jpeg_idct_2x2 jRD2x2
|
||||
#define jpeg_idct_1x1 jRD1x1
|
||||
#define jpeg_idct_9x9 jRD9x9
|
||||
#define jpeg_idct_10x10 jRD10x10
|
||||
#define jpeg_idct_11x11 jRD11x11
|
||||
#define jpeg_idct_12x12 jRD12x12
|
||||
#define jpeg_idct_13x13 jRD13x13
|
||||
#define jpeg_idct_14x14 jRD14x14
|
||||
#define jpeg_idct_15x15 jRD15x15
|
||||
#define jpeg_idct_16x16 jRD16x16
|
||||
#endif /* NEED_SHORT_EXTERNAL_NAMES */
|
||||
|
||||
/* Extern declarations for the forward and inverse DCT routines. */
|
||||
@ -115,15 +127,51 @@ EXTERN(void) jpeg_idct_ifast
|
||||
EXTERN(void) jpeg_idct_float
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_7x7
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_6x6
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_5x5
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_4x4
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_3x3
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_2x2
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_1x1
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_9x9
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_10x10
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_11x11
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_12x12
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_13x13
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_14x14
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_15x15
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
EXTERN(void) jpeg_idct_16x16
|
||||
JPP((j_decompress_ptr cinfo, jpeg_component_info * compptr,
|
||||
JCOEFPTR coef_block, JSAMPARRAY output_buf, JDIMENSION output_col));
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1,10 +1,12 @@
|
||||
/*
|
||||
* jddctmgr.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modified 2002-2010 by Guido Vollbeding.
|
||||
* Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2010, 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 the inverse-DCT management logic.
|
||||
@ -115,6 +117,10 @@ start_pass (j_decompress_ptr cinfo)
|
||||
method_ptr = jpeg_idct_2x2;
|
||||
method = JDCT_ISLOW; /* jidctred uses islow-style table */
|
||||
break;
|
||||
case 3:
|
||||
method_ptr = jpeg_idct_3x3;
|
||||
method = JDCT_ISLOW; /* jidctint uses islow-style table */
|
||||
break;
|
||||
case 4:
|
||||
if (jsimd_can_idct_4x4())
|
||||
method_ptr = jsimd_idct_4x4;
|
||||
@ -122,6 +128,18 @@ start_pass (j_decompress_ptr cinfo)
|
||||
method_ptr = jpeg_idct_4x4;
|
||||
method = JDCT_ISLOW; /* jidctred uses islow-style table */
|
||||
break;
|
||||
case 5:
|
||||
method_ptr = jpeg_idct_5x5;
|
||||
method = JDCT_ISLOW; /* jidctint uses islow-style table */
|
||||
break;
|
||||
case 6:
|
||||
method_ptr = jpeg_idct_6x6;
|
||||
method = JDCT_ISLOW; /* jidctint uses islow-style table */
|
||||
break;
|
||||
case 7:
|
||||
method_ptr = jpeg_idct_7x7;
|
||||
method = JDCT_ISLOW; /* jidctint uses islow-style table */
|
||||
break;
|
||||
#endif
|
||||
case DCTSIZE:
|
||||
switch (cinfo->dct_method) {
|
||||
@ -157,6 +175,38 @@ start_pass (j_decompress_ptr cinfo)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
method_ptr = jpeg_idct_9x9;
|
||||
method = JDCT_ISLOW; /* jidctint uses islow-style table */
|
||||
break;
|
||||
case 10:
|
||||
method_ptr = jpeg_idct_10x10;
|
||||
method = JDCT_ISLOW; /* jidctint uses islow-style table */
|
||||
break;
|
||||
case 11:
|
||||
method_ptr = jpeg_idct_11x11;
|
||||
method = JDCT_ISLOW; /* jidctint uses islow-style table */
|
||||
break;
|
||||
case 12:
|
||||
method_ptr = jpeg_idct_12x12;
|
||||
method = JDCT_ISLOW; /* jidctint uses islow-style table */
|
||||
break;
|
||||
case 13:
|
||||
method_ptr = jpeg_idct_13x13;
|
||||
method = JDCT_ISLOW; /* jidctint uses islow-style table */
|
||||
break;
|
||||
case 14:
|
||||
method_ptr = jpeg_idct_14x14;
|
||||
method = JDCT_ISLOW; /* jidctint uses islow-style table */
|
||||
break;
|
||||
case 15:
|
||||
method_ptr = jpeg_idct_15x15;
|
||||
method = JDCT_ISLOW; /* jidctint uses islow-style table */
|
||||
break;
|
||||
case 16:
|
||||
method_ptr = jpeg_idct_16x16;
|
||||
method = JDCT_ISLOW; /* jidctint uses islow-style table */
|
||||
break;
|
||||
default:
|
||||
ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->_DCT_scaled_size);
|
||||
break;
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jdhuff.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* 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 Huffman entropy decoding routines.
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jdhuff.h
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* 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.
|
||||
*
|
||||
* This file contains declarations for Huffman entropy decoding routines
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
* jdinput.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2002-2009 by Guido Vollbeding.
|
||||
* Modifications:
|
||||
* Copyright (C) 2010, 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 control logic for the JPEG decompressor.
|
||||
@ -38,79 +38,6 @@ METHODDEF(int) consume_markers JPP((j_decompress_ptr cinfo));
|
||||
* Routines to calculate various quantities related to the size of the image.
|
||||
*/
|
||||
|
||||
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
/*
|
||||
* Compute output image dimensions and related values.
|
||||
* NOTE: this is exported for possible use by application.
|
||||
* Hence it mustn't do anything that can't be done twice.
|
||||
*/
|
||||
|
||||
GLOBAL(void)
|
||||
jpeg_core_output_dimensions (j_decompress_ptr cinfo)
|
||||
/* Do computations that are needed before master selection phase.
|
||||
* This function is used for transcoding and full decompression.
|
||||
*/
|
||||
{
|
||||
#ifdef IDCT_SCALING_SUPPORTED
|
||||
int ci;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
/* Compute actual output image dimensions and DCT scaling choices. */
|
||||
if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom) {
|
||||
/* Provide 1/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 1;
|
||||
cinfo->min_DCT_v_scaled_size = 1;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 2) {
|
||||
/* Provide 2/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 2L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 2L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 2;
|
||||
cinfo->min_DCT_v_scaled_size = 2;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 4) {
|
||||
/* Provide 4/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 4L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 4L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 4;
|
||||
cinfo->min_DCT_v_scaled_size = 4;
|
||||
} else if (cinfo->scale_num * cinfo->block_size <= cinfo->scale_denom * 8) {
|
||||
/* Provide 8/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 8L, (long) cinfo->block_size);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 8L, (long) cinfo->block_size);
|
||||
cinfo->min_DCT_h_scaled_size = 8;
|
||||
cinfo->min_DCT_v_scaled_size = 8;
|
||||
}
|
||||
/* Recompute dimensions of components */
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
compptr->DCT_h_scaled_size = cinfo->min_DCT_h_scaled_size;
|
||||
compptr->DCT_v_scaled_size = cinfo->min_DCT_v_scaled_size;
|
||||
}
|
||||
|
||||
#else /* !IDCT_SCALING_SUPPORTED */
|
||||
|
||||
/* Hardwire it to "no scaling" */
|
||||
cinfo->output_width = cinfo->image_width;
|
||||
cinfo->output_height = cinfo->image_height;
|
||||
/* jdinput.c has already initialized DCT_scaled_size,
|
||||
* and has computed unscaled downsampled_width and downsampled_height.
|
||||
*/
|
||||
|
||||
#endif /* IDCT_SCALING_SUPPORTED */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
LOCAL(void)
|
||||
initial_setup (j_decompress_ptr cinfo)
|
||||
/* Called once, when first SOS marker is reached */
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jdmainct.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* Copyright (C) 2010, 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 the main buffer controller for decompression.
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jdmarker.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* Copyright (C) 2012, 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 routines to decode JPEG datastream markers.
|
||||
|
@ -1,9 +1,11 @@
|
||||
/*
|
||||
* jdmaster.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modified 2002-2009 by Guido Vollbeding.
|
||||
* Modifications:
|
||||
* 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 master control logic for the JPEG decompressor.
|
||||
@ -85,6 +87,177 @@ use_merged_upsample (j_decompress_ptr cinfo)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Compute output image dimensions and related values.
|
||||
* NOTE: this is exported for possible use by application.
|
||||
* Hence it mustn't do anything that can't be done twice.
|
||||
*/
|
||||
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
GLOBAL(void)
|
||||
#else
|
||||
LOCAL(void)
|
||||
#endif
|
||||
jpeg_core_output_dimensions (j_decompress_ptr cinfo)
|
||||
/* Do computations that are needed before master selection phase.
|
||||
* This function is used for transcoding and full decompression.
|
||||
*/
|
||||
{
|
||||
#ifdef IDCT_SCALING_SUPPORTED
|
||||
int ci;
|
||||
jpeg_component_info *compptr;
|
||||
|
||||
/* Compute actual output image dimensions and DCT scaling choices. */
|
||||
if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom) {
|
||||
/* Provide 1/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 1;
|
||||
cinfo->_min_DCT_v_scaled_size = 1;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 2) {
|
||||
/* Provide 2/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 2L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 2L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 2;
|
||||
cinfo->_min_DCT_v_scaled_size = 2;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 3) {
|
||||
/* Provide 3/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 3L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 3L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 3;
|
||||
cinfo->_min_DCT_v_scaled_size = 3;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 4) {
|
||||
/* Provide 4/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 4L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 4L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 4;
|
||||
cinfo->_min_DCT_v_scaled_size = 4;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 5) {
|
||||
/* Provide 5/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 5L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 5L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 5;
|
||||
cinfo->_min_DCT_v_scaled_size = 5;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 6) {
|
||||
/* Provide 6/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 6L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 6L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 6;
|
||||
cinfo->_min_DCT_v_scaled_size = 6;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 7) {
|
||||
/* Provide 7/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 7L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 7L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 7;
|
||||
cinfo->_min_DCT_v_scaled_size = 7;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 8) {
|
||||
/* Provide 8/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 8L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 8L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 8;
|
||||
cinfo->_min_DCT_v_scaled_size = 8;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 9) {
|
||||
/* Provide 9/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 9L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 9L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 9;
|
||||
cinfo->_min_DCT_v_scaled_size = 9;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 10) {
|
||||
/* Provide 10/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 10L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 10L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 10;
|
||||
cinfo->_min_DCT_v_scaled_size = 10;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 11) {
|
||||
/* Provide 11/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 11L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 11L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 11;
|
||||
cinfo->_min_DCT_v_scaled_size = 11;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 12) {
|
||||
/* Provide 12/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 12L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 12L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 12;
|
||||
cinfo->_min_DCT_v_scaled_size = 12;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 13) {
|
||||
/* Provide 13/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 13L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 13L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 13;
|
||||
cinfo->_min_DCT_v_scaled_size = 13;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 14) {
|
||||
/* Provide 14/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 14L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 14L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 14;
|
||||
cinfo->_min_DCT_v_scaled_size = 14;
|
||||
} else if (cinfo->scale_num * DCTSIZE <= cinfo->scale_denom * 15) {
|
||||
/* Provide 15/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 15L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 15L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 15;
|
||||
cinfo->_min_DCT_v_scaled_size = 15;
|
||||
} else {
|
||||
/* Provide 16/block_size scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width * 16L, (long) DCTSIZE);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height * 16L, (long) DCTSIZE);
|
||||
cinfo->_min_DCT_h_scaled_size = 16;
|
||||
cinfo->_min_DCT_v_scaled_size = 16;
|
||||
}
|
||||
|
||||
/* Recompute dimensions of components */
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
compptr->_DCT_h_scaled_size = cinfo->_min_DCT_h_scaled_size;
|
||||
compptr->_DCT_v_scaled_size = cinfo->_min_DCT_v_scaled_size;
|
||||
}
|
||||
|
||||
#else /* !IDCT_SCALING_SUPPORTED */
|
||||
|
||||
/* Hardwire it to "no scaling" */
|
||||
cinfo->output_width = cinfo->image_width;
|
||||
cinfo->output_height = cinfo->image_height;
|
||||
/* jdinput.c has already initialized DCT_scaled_size,
|
||||
* and has computed unscaled downsampled_width and downsampled_height.
|
||||
*/
|
||||
|
||||
#endif /* IDCT_SCALING_SUPPORTED */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Compute output image dimensions and related values.
|
||||
* NOTE: this is exported for possible use by application.
|
||||
@ -105,65 +278,24 @@ jpeg_calc_output_dimensions (j_decompress_ptr cinfo)
|
||||
if (cinfo->global_state != DSTATE_READY)
|
||||
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
|
||||
|
||||
/* Compute core output image dimensions and DCT scaling choices. */
|
||||
jpeg_core_output_dimensions(cinfo);
|
||||
|
||||
#ifdef IDCT_SCALING_SUPPORTED
|
||||
|
||||
/* Compute actual output image dimensions and DCT scaling choices. */
|
||||
if (cinfo->scale_num * 8 <= cinfo->scale_denom) {
|
||||
/* Provide 1/8 scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, 8L);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, 8L);
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
cinfo->min_DCT_h_scaled_size = cinfo->min_DCT_v_scaled_size = 1;
|
||||
#else
|
||||
cinfo->min_DCT_scaled_size = 1;
|
||||
#endif
|
||||
} else if (cinfo->scale_num * 4 <= cinfo->scale_denom) {
|
||||
/* Provide 1/4 scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, 4L);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, 4L);
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
cinfo->min_DCT_h_scaled_size = cinfo->min_DCT_v_scaled_size = 2;
|
||||
#else
|
||||
cinfo->min_DCT_scaled_size = 2;
|
||||
#endif
|
||||
} else if (cinfo->scale_num * 2 <= cinfo->scale_denom) {
|
||||
/* Provide 1/2 scaling */
|
||||
cinfo->output_width = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_width, 2L);
|
||||
cinfo->output_height = (JDIMENSION)
|
||||
jdiv_round_up((long) cinfo->image_height, 2L);
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
cinfo->min_DCT_h_scaled_size = cinfo->min_DCT_v_scaled_size = 4;
|
||||
#else
|
||||
cinfo->min_DCT_scaled_size = 4;
|
||||
#endif
|
||||
} else {
|
||||
/* Provide 1/1 scaling */
|
||||
cinfo->output_width = cinfo->image_width;
|
||||
cinfo->output_height = cinfo->image_height;
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
cinfo->min_DCT_h_scaled_size = cinfo->min_DCT_v_scaled_size = DCTSIZE;
|
||||
#else
|
||||
cinfo->min_DCT_scaled_size = DCTSIZE;
|
||||
#endif
|
||||
}
|
||||
/* In selecting the actual DCT scaling for each component, we try to
|
||||
* scale up the chroma components via IDCT scaling rather than upsampling.
|
||||
* This saves time if the upsampler gets to use 1:1 scaling.
|
||||
* Note this code assumes that the supported DCT scalings are powers of 2.
|
||||
* Note this code adapts subsampling ratios which are powers of 2.
|
||||
*/
|
||||
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
|
||||
ci++, compptr++) {
|
||||
int ssize = cinfo->_min_DCT_scaled_size;
|
||||
while (ssize < DCTSIZE &&
|
||||
(compptr->h_samp_factor * ssize * 2 <=
|
||||
cinfo->max_h_samp_factor * cinfo->_min_DCT_scaled_size) &&
|
||||
(compptr->v_samp_factor * ssize * 2 <=
|
||||
cinfo->max_v_samp_factor * cinfo->_min_DCT_scaled_size)) {
|
||||
((cinfo->max_h_samp_factor * cinfo->_min_DCT_scaled_size) %
|
||||
(compptr->h_samp_factor * ssize * 2) == 0) &&
|
||||
((cinfo->max_v_samp_factor * cinfo->_min_DCT_scaled_size) %
|
||||
(compptr->v_samp_factor * ssize * 2) == 0)) {
|
||||
ssize = ssize * 2;
|
||||
}
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* jdmerge.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Modifications:
|
||||
* 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 code for merged upsampling/color conversion.
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jdmrgext.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1994-1996, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* Copyright (C) 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 code for merged upsampling/color conversion.
|
||||
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* jdsample.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
* Copyright (C) 2010, 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 upsampling routines.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jmorecfg.h
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* 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 additional configuration options that customize the
|
||||
|
@ -11,6 +11,8 @@
|
||||
|
||||
#if JPEG_LIB_VERSION >= 70
|
||||
#define _DCT_scaled_size DCT_h_scaled_size
|
||||
#define _DCT_h_scaled_size DCT_h_scaled_size
|
||||
#define _DCT_v_scaled_size DCT_v_scaled_size
|
||||
#define _min_DCT_scaled_size min_DCT_h_scaled_size
|
||||
#define _min_DCT_h_scaled_size min_DCT_h_scaled_size
|
||||
#define _min_DCT_v_scaled_size min_DCT_v_scaled_size
|
||||
@ -18,6 +20,8 @@
|
||||
#define _jpeg_height jpeg_height
|
||||
#else
|
||||
#define _DCT_scaled_size DCT_scaled_size
|
||||
#define _DCT_h_scaled_size DCT_scaled_size
|
||||
#define _DCT_v_scaled_size DCT_scaled_size
|
||||
#define _min_DCT_scaled_size min_DCT_scaled_size
|
||||
#define _min_DCT_h_scaled_size min_DCT_scaled_size
|
||||
#define _min_DCT_v_scaled_size min_DCT_scaled_size
|
||||
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* jpeglib.h
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1998, Thomas G. Lane.
|
||||
* Modified 2002-2009 by Guido Vollbeding.
|
||||
* Copyright (C) 2009-2011, D. R. Commander.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* Modifications:
|
||||
* Copyright (C) 2009-2011, 2013, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file defines the application interface for the JPEG library.
|
||||
@ -912,7 +913,7 @@ typedef JMETHOD(boolean, jpeg_marker_parser_method, (j_decompress_ptr cinfo));
|
||||
#define jpeg_destroy_decompress jDestDecompress
|
||||
#define jpeg_stdio_dest jStdDest
|
||||
#define jpeg_stdio_src jStdSrc
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
#define jpeg_mem_dest jMemDest
|
||||
#define jpeg_mem_src jMemSrc
|
||||
#endif
|
||||
@ -999,7 +1000,7 @@ EXTERN(void) jpeg_destroy_decompress JPP((j_decompress_ptr cinfo));
|
||||
EXTERN(void) jpeg_stdio_dest JPP((j_compress_ptr cinfo, FILE * outfile));
|
||||
EXTERN(void) jpeg_stdio_src JPP((j_decompress_ptr cinfo, FILE * infile));
|
||||
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
#if JPEG_LIB_VERSION >= 80 || defined(MEM_SRCDST_SUPPORTED)
|
||||
/* Data source and destination managers: memory buffers. */
|
||||
EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
|
||||
unsigned char ** outbuffer,
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jquant1.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* Copyright (C) 2009, 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 1-pass color quantization (color mapping) routines.
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jquant2.c
|
||||
*
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-1996, Thomas G. Lane.
|
||||
* Modifications:
|
||||
* Copyright (C) 2009, 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 2-pass color quantization (color mapping) routines.
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* jversion.h
|
||||
*
|
||||
* Copyright (C) 1991-2010, Thomas G. Lane, Guido Vollbeding.
|
||||
* Copyright (C) 2010, 2012, D. R. Commander.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* This file was part of the Independent JPEG Group's software:
|
||||
* Copyright (C) 1991-2012, Thomas G. Lane, Guido Vollbeding.
|
||||
* Modifications:
|
||||
* Copyright (C) 2010, 2012-2013, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains software version identification.
|
||||
@ -12,11 +13,11 @@
|
||||
|
||||
#if JPEG_LIB_VERSION >= 80
|
||||
|
||||
#define JVERSION "8b 16-May-2010"
|
||||
#define JVERSION "8d 15-Jan-2012"
|
||||
|
||||
#elif JPEG_LIB_VERSION >= 70
|
||||
|
||||
#define JVERSION "7 27-Jun-2009"
|
||||
#define JVERSION "7 27-Jun-2009"
|
||||
|
||||
#else
|
||||
|
||||
@ -24,8 +25,8 @@
|
||||
|
||||
#endif
|
||||
|
||||
#define JCOPYRIGHT "Copyright (C) 1991-2010 Thomas G. Lane, Guido Vollbeding\n" \
|
||||
#define JCOPYRIGHT "Copyright (C) 1991-2012 Thomas G. Lane, Guido Vollbeding\n" \
|
||||
"Copyright (C) 1999-2006 MIYASAKA Masaru\n" \
|
||||
"Copyright (C) 2009 Pierre Ossman for Cendio AB\n" \
|
||||
"Copyright (C) 2009-2012 D. R. Commander\n" \
|
||||
"Copyright (C) 2009-2013 D. R. Commander\n" \
|
||||
"Copyright (C) 2009-2011 Nokia Corporation and/or its subsidiary(-ies)"
|
||||
|
@ -1,7 +1,60 @@
|
||||
--- jmorecfg.h 2012-01-27 00:46:32 -0500
|
||||
+++ jmorecfg.h 2012-02-10 23:08:03 -0500
|
||||
@@ -6,16 +6,17 @@
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
diff -up8 jchuff.c jchuff.c
|
||||
--- jchuff.c 2012-12-30 21:42:18 -0500
|
||||
+++ jchuff.c 2013-02-16 19:37:01 -0500
|
||||
@@ -17,18 +17,20 @@
|
||||
*/
|
||||
|
||||
#define JPEG_INTERNALS
|
||||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jchuff.h" /* Declarations shared with jcphuff.c */
|
||||
#include <limits.h>
|
||||
|
||||
-static unsigned char jpeg_nbits_table[65536];
|
||||
-static int jpeg_nbits_table_init = 0;
|
||||
+static const unsigned char jpeg_nbits_table[65536] = {
|
||||
+/* Number i needs jpeg_nbits_table[i] bits to be represented. */
|
||||
+#include "jpeg_nbits_table.h"
|
||||
+};
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
|
||||
/* Expanded entropy encoder object for Huffman encoding.
|
||||
*
|
||||
@@ -266,25 +268,16 @@ jpeg_make_c_derived_tbl (j_compress_ptr
|
||||
|
||||
for (p = 0; p < lastp; p++) {
|
||||
i = htbl->huffval[p];
|
||||
if (i < 0 || i > maxsymbol || dtbl->ehufsi[i])
|
||||
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
|
||||
dtbl->ehufco[i] = huffcode[p];
|
||||
dtbl->ehufsi[i] = huffsize[p];
|
||||
}
|
||||
-
|
||||
- if(!jpeg_nbits_table_init) {
|
||||
- for(i = 0; i < 65536; i++) {
|
||||
- int nbits = 0, temp = i;
|
||||
- while (temp) {temp >>= 1; nbits++;}
|
||||
- jpeg_nbits_table[i] = nbits;
|
||||
- }
|
||||
- jpeg_nbits_table_init = 1;
|
||||
- }
|
||||
}
|
||||
|
||||
|
||||
/* Outputting bytes to the file */
|
||||
|
||||
/* Emit a byte, taking 'action' if must suspend. */
|
||||
#define emit_byte(state,val,action) \
|
||||
{ *(state)->next_output_byte++ = (JOCTET) (val); \
|
||||
diff -up8 jmorecfg.h jmorecfg.h
|
||||
--- jmorecfg.h 2013-01-06 12:59:42 -0500
|
||||
+++ jmorecfg.h 2013-02-16 19:37:01 -0500
|
||||
@@ -7,16 +7,17 @@
|
||||
* Copyright (C) 2009, 2011, D. R. Commander.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains additional configuration options that customize the
|
||||
@ -18,7 +71,7 @@
|
||||
* Only 8 and 12 are legal data precisions for lossy JPEG according to the
|
||||
* JPEG standard, and the IJG code does not support anything else!
|
||||
* We do not support run-time selection of data precision, sorry.
|
||||
@@ -127,45 +128,29 @@ typedef char JOCTET;
|
||||
@@ -128,45 +129,29 @@ typedef char JOCTET;
|
||||
* They must be at least as wide as specified; but making them too big
|
||||
* won't cost a huge amount of memory, so we don't provide special
|
||||
* extraction code like we did for JSAMPLE. (In other words, these
|
||||
@ -68,54 +121,3 @@
|
||||
* can change this datatype.
|
||||
*/
|
||||
|
||||
--- jchuff.c
|
||||
+++ jchuff.c
|
||||
@@ -16,18 +16,20 @@
|
||||
*/
|
||||
|
||||
#define JPEG_INTERNALS
|
||||
#include "jinclude.h"
|
||||
#include "jpeglib.h"
|
||||
#include "jchuff.h" /* Declarations shared with jcphuff.c */
|
||||
#include <limits.h>
|
||||
|
||||
-static unsigned char jpeg_nbits_table[65536];
|
||||
-static int jpeg_nbits_table_init = 0;
|
||||
+static const unsigned char jpeg_nbits_table[65536] = {
|
||||
+/* Number i needs jpeg_nbits_table[i] bits to be represented. */
|
||||
+#include "jpeg_nbits_table.h"
|
||||
+};
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) ((a)<(b)?(a):(b))
|
||||
#endif
|
||||
|
||||
|
||||
/* Expanded entropy encoder object for Huffman encoding.
|
||||
*
|
||||
@@ -265,25 +267,16 @@ jpeg_make_c_derived_tbl (j_compress_ptr
|
||||
|
||||
for (p = 0; p < lastp; p++) {
|
||||
i = htbl->huffval[p];
|
||||
if (i < 0 || i > maxsymbol || dtbl->ehufsi[i])
|
||||
ERREXIT(cinfo, JERR_BAD_HUFF_TABLE);
|
||||
dtbl->ehufco[i] = huffcode[p];
|
||||
dtbl->ehufsi[i] = huffsize[p];
|
||||
}
|
||||
-
|
||||
- if(!jpeg_nbits_table_init) {
|
||||
- for(i = 0; i < 65536; i++) {
|
||||
- int nbits = 0, temp = i;
|
||||
- while (temp) {temp >>= 1; nbits++;}
|
||||
- jpeg_nbits_table[i] = nbits;
|
||||
- }
|
||||
- jpeg_nbits_table_init = 1;
|
||||
- }
|
||||
}
|
||||
|
||||
|
||||
/* Outputting bytes to the file */
|
||||
|
||||
/* Emit a byte, taking 'action' if must suspend. */
|
||||
#define emit_byte(state,val,action) \
|
||||
{ *(state)->next_output_byte++ = (JOCTET) (val); \
|
||||
|
@ -2,7 +2,7 @@
|
||||
; jdclrss2-64.asm - colorspace conversion (64-bit SSE2)
|
||||
;
|
||||
; Copyright 2009, 2012 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
; Copyright 2009 D. R. Commander
|
||||
; Copyright 2009, 2012 D. R. Commander
|
||||
;
|
||||
; Based on
|
||||
; x86 SIMD extension for IJG JPEG library
|
||||
@ -288,7 +288,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2):
|
||||
; space.
|
||||
cmp rcx, byte SIZEOF_MMWORD
|
||||
jb short .column_st7
|
||||
movq MMWORD [rdi], xmmA
|
||||
movq XMM_MMWORD [rdi], xmmA
|
||||
add rdi, byte SIZEOF_MMWORD
|
||||
sub rcx, byte SIZEOF_MMWORD
|
||||
psrldq xmmA, SIZEOF_MMWORD
|
||||
@ -297,7 +297,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2):
|
||||
; space.
|
||||
cmp rcx, byte SIZEOF_DWORD
|
||||
jb short .column_st3
|
||||
movd DWORD [rdi], xmmA
|
||||
movd XMM_DWORD [rdi], xmmA
|
||||
add rdi, byte SIZEOF_DWORD
|
||||
sub rcx, byte SIZEOF_DWORD
|
||||
psrldq xmmA, SIZEOF_DWORD
|
||||
@ -407,7 +407,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2):
|
||||
; space.
|
||||
test rcx, rcx
|
||||
jz short .nextrow
|
||||
movd DWORD [rdi], xmmA
|
||||
movd XMM_DWORD [rdi], xmmA
|
||||
|
||||
%endif ; RGB_PIXELSIZE ; ---------------
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
; jdclrss2.asm - colorspace conversion (SSE2)
|
||||
;
|
||||
; Copyright 2009, 2012 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
; Copyright 2012 D. R. Commander
|
||||
;
|
||||
; Based on
|
||||
; x86 SIMD extension for IJG JPEG library
|
||||
@ -300,7 +301,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2):
|
||||
; space.
|
||||
cmp ecx, byte SIZEOF_MMWORD
|
||||
jb short .column_st7
|
||||
movq MMWORD [edi], xmmA
|
||||
movq XMM_MMWORD [edi], xmmA
|
||||
add edi, byte SIZEOF_MMWORD
|
||||
sub ecx, byte SIZEOF_MMWORD
|
||||
psrldq xmmA, SIZEOF_MMWORD
|
||||
@ -309,7 +310,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2):
|
||||
; space.
|
||||
cmp ecx, byte SIZEOF_DWORD
|
||||
jb short .column_st3
|
||||
movd DWORD [edi], xmmA
|
||||
movd XMM_DWORD [edi], xmmA
|
||||
add edi, byte SIZEOF_DWORD
|
||||
sub ecx, byte SIZEOF_DWORD
|
||||
psrldq xmmA, SIZEOF_DWORD
|
||||
@ -411,7 +412,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2):
|
||||
; space.
|
||||
cmp ecx, byte SIZEOF_XMMWORD/8
|
||||
jb short .column_st7
|
||||
movq MMWORD [edi], xmmA
|
||||
movq XMM_MMWORD [edi], xmmA
|
||||
add edi, byte SIZEOF_XMMWORD/8*4
|
||||
sub ecx, byte SIZEOF_XMMWORD/8
|
||||
psrldq xmmA, SIZEOF_XMMWORD/8*4
|
||||
@ -420,7 +421,7 @@ EXTN(jsimd_ycc_rgb_convert_sse2):
|
||||
; space.
|
||||
test ecx, ecx
|
||||
jz short .nextrow
|
||||
movd DWORD [edi], xmmA
|
||||
movd XMM_DWORD [edi], xmmA
|
||||
|
||||
%endif ; RGB_PIXELSIZE ; ---------------
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
; jdmrgss2-64.asm - merged upsampling/color conversion (64-bit SSE2)
|
||||
;
|
||||
; Copyright 2009, 2012 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
; Copyright 2009 D. R. Commander
|
||||
; Copyright 2009, 2012 D. R. Commander
|
||||
;
|
||||
; Based on
|
||||
; x86 SIMD extension for IJG JPEG library
|
||||
@ -292,7 +292,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2):
|
||||
; space.
|
||||
cmp rcx, byte SIZEOF_MMWORD
|
||||
jb short .column_st7
|
||||
movq MMWORD [rdi], xmmA
|
||||
movq XMM_MMWORD [rdi], xmmA
|
||||
add rdi, byte SIZEOF_MMWORD
|
||||
sub rcx, byte SIZEOF_MMWORD
|
||||
psrldq xmmA, SIZEOF_MMWORD
|
||||
@ -301,7 +301,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2):
|
||||
; space.
|
||||
cmp rcx, byte SIZEOF_DWORD
|
||||
jb short .column_st3
|
||||
movd DWORD [rdi], xmmA
|
||||
movd XMM_DWORD [rdi], xmmA
|
||||
add rdi, byte SIZEOF_DWORD
|
||||
sub rcx, byte SIZEOF_DWORD
|
||||
psrldq xmmA, SIZEOF_DWORD
|
||||
@ -405,7 +405,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2):
|
||||
; space.
|
||||
cmp rcx, byte SIZEOF_XMMWORD/8
|
||||
jb short .column_st7
|
||||
movq MMWORD [rdi], xmmA
|
||||
movq XMM_MMWORD [rdi], xmmA
|
||||
add rdi, byte SIZEOF_XMMWORD/8*4
|
||||
sub rcx, byte SIZEOF_XMMWORD/8
|
||||
psrldq xmmA, SIZEOF_XMMWORD/8*4
|
||||
@ -414,7 +414,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2):
|
||||
; space.
|
||||
test rcx, rcx
|
||||
jz short .endcolumn
|
||||
movd DWORD [rdi], xmmA
|
||||
movd XMM_DWORD [rdi], xmmA
|
||||
|
||||
%endif ; RGB_PIXELSIZE ; ---------------
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
; jdmrgss2.asm - merged upsampling/color conversion (SSE2)
|
||||
;
|
||||
; Copyright 2009, 2012 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
||||
; Copyright 2012 D. R. Commander
|
||||
;
|
||||
; Based on
|
||||
; x86 SIMD extension for IJG JPEG library
|
||||
@ -305,7 +306,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2):
|
||||
; space.
|
||||
cmp ecx, byte SIZEOF_MMWORD
|
||||
jb short .column_st7
|
||||
movq MMWORD [edi], xmmA
|
||||
movq XMM_MMWORD [edi], xmmA
|
||||
add edi, byte SIZEOF_MMWORD
|
||||
sub ecx, byte SIZEOF_MMWORD
|
||||
psrldq xmmA, SIZEOF_MMWORD
|
||||
@ -314,7 +315,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2):
|
||||
; space.
|
||||
cmp ecx, byte SIZEOF_DWORD
|
||||
jb short .column_st3
|
||||
movd DWORD [edi], xmmA
|
||||
movd XMM_DWORD [edi], xmmA
|
||||
add edi, byte SIZEOF_DWORD
|
||||
sub ecx, byte SIZEOF_DWORD
|
||||
psrldq xmmA, SIZEOF_DWORD
|
||||
@ -419,7 +420,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2):
|
||||
; space.
|
||||
cmp ecx, byte SIZEOF_XMMWORD/8
|
||||
jb short .column_st7
|
||||
movq MMWORD [edi], xmmA
|
||||
movq XMM_MMWORD [edi], xmmA
|
||||
add edi, byte SIZEOF_XMMWORD/8*4
|
||||
sub ecx, byte SIZEOF_XMMWORD/8
|
||||
psrldq xmmA, SIZEOF_XMMWORD/8*4
|
||||
@ -428,7 +429,7 @@ EXTN(jsimd_h2v1_merged_upsample_sse2):
|
||||
; space.
|
||||
test ecx, ecx
|
||||
jz short .endcolumn
|
||||
movd DWORD [edi], xmmA
|
||||
movd XMM_DWORD [edi], xmmA
|
||||
|
||||
%endif ; RGB_PIXELSIZE ; ---------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user