Alien-FreeImage

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

src/Source/LibWebP/src/dsp/dsp.enc.c
src/Source/LibWebP/src/dsp/dsp.enc_avx2.c
src/Source/LibWebP/src/dsp/dsp.enc_mips32.c
src/Source/LibWebP/src/dsp/dsp.enc_mips_dsp_r2.c
src/Source/LibWebP/src/dsp/dsp.enc_neon.c
src/Source/LibWebP/src/dsp/dsp.enc_sse2.c
src/Source/LibWebP/src/dsp/dsp.filters.c
src/Source/LibWebP/src/dsp/dsp.filters_mips_dsp_r2.c
src/Source/LibWebP/src/dsp/dsp.filters_sse2.c
src/Source/LibWebP/src/dsp/dsp.h
src/Source/LibWebP/src/dsp/dsp.lossless.c
src/Source/LibWebP/src/dsp/dsp.lossless_mips32.c
src/Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c
src/Source/LibWebP/src/dsp/dsp.lossless_neon.c
src/Source/LibWebP/src/dsp/dsp.lossless_sse2.c
src/Source/LibWebP/src/dsp/dsp.rescaler.c
src/Source/LibWebP/src/dsp/dsp.rescaler_mips32.c
src/Source/LibWebP/src/dsp/dsp.rescaler_mips_dsp_r2.c
src/Source/LibWebP/src/dsp/dsp.upsampling.c
src/Source/LibWebP/src/dsp/dsp.upsampling_mips_dsp_r2.c
src/Source/LibWebP/src/dsp/dsp.upsampling_neon.c
src/Source/LibWebP/src/dsp/dsp.upsampling_sse2.c
src/Source/LibWebP/src/dsp/dsp.yuv.c
src/Source/LibWebP/src/dsp/dsp.yuv_mips32.c
src/Source/LibWebP/src/dsp/dsp.yuv_mips_dsp_r2.c
src/Source/LibWebP/src/dsp/dsp.yuv_sse2.c
src/Source/LibWebP/src/dsp/lossless.h
src/Source/LibWebP/src/dsp/mips_macro.h
src/Source/LibWebP/src/dsp/neon.h
src/Source/LibWebP/src/dsp/yuv.h
src/Source/LibWebP/src/dsp/yuv_tables_sse2.h
src/Source/LibWebP/src/enc/backward_references.h
src/Source/LibWebP/src/enc/cost.h
src/Source/LibWebP/src/enc/enc.alpha.c
src/Source/LibWebP/src/enc/enc.analysis.c
src/Source/LibWebP/src/enc/enc.backward_references.c
src/Source/LibWebP/src/enc/enc.config.c
src/Source/LibWebP/src/enc/enc.cost.c
src/Source/LibWebP/src/enc/enc.filter.c
src/Source/LibWebP/src/enc/enc.frame.c
src/Source/LibWebP/src/enc/enc.histogram.c
src/Source/LibWebP/src/enc/enc.iterator.c
src/Source/LibWebP/src/enc/enc.near_lossless.c
src/Source/LibWebP/src/enc/enc.picture.c
src/Source/LibWebP/src/enc/enc.picture_csp.c
src/Source/LibWebP/src/enc/enc.picture_psnr.c
src/Source/LibWebP/src/enc/enc.picture_rescale.c
src/Source/LibWebP/src/enc/enc.picture_tools.c
src/Source/LibWebP/src/enc/enc.quant.c
src/Source/LibWebP/src/enc/enc.syntax.c
src/Source/LibWebP/src/enc/enc.token.c
src/Source/LibWebP/src/enc/enc.tree.c
src/Source/LibWebP/src/enc/enc.vp8l.c

patches/FreeImage-3.17.0-ALL-IN-ONE.patch  view on Meta::CPAN

       "subu      %[temp3],    %[temp1],     %[temp2]    \n\t"                  \
@@ -177,7 +177,7 @@
     __asm__ volatile (                                                         \
       "lbu       %[temp1],   0(%[src])               \n\t"                     \
       "lbu       %[temp2],   0(%[pred])              \n\t"                     \
-    ".if "#INVERSE"                                  \n\t"                     \
+    ".if " #INVERSE "                                \n\t"                     \
       "addu      %[temp3],   %[temp1],   %[temp2]    \n\t"                     \
     ".else                                           \n\t"                     \
       "subu      %[temp3],   %[temp1],   %[temp2]    \n\t"                     \
diff -ru src.3170/Source/LibWebP/src/dsp/dsp.lossless_mips32.c src/Source/LibWebP/src/dsp/dsp.lossless_mips32.c
--- src.3170/Source/LibWebP/src/dsp/dsp.lossless_mips32.c	2015-02-20 02:34:36.000000000 +0100
+++ src/Source/LibWebP/src/dsp/dsp.lossless_mips32.c	2017-06-22 22:18:06.110473600 +0200
@@ -285,28 +285,28 @@
 // literal_ and successive histograms could be unaligned
 // so we must use ulw and usw
 #define ADD_TO_OUT(A, B, C, D, E, P0, P1, P2)           \
-    "ulw    %[temp0], "#A"(%["#P0"])        \n\t"       \
-    "ulw    %[temp1], "#B"(%["#P0"])        \n\t"       \
-    "ulw    %[temp2], "#C"(%["#P0"])        \n\t"       \
-    "ulw    %[temp3], "#D"(%["#P0"])        \n\t"       \
-    "ulw    %[temp4], "#A"(%["#P1"])        \n\t"       \
-    "ulw    %[temp5], "#B"(%["#P1"])        \n\t"       \

patches/FreeImage-3.17.0-ALL-IN-ONE.patch  view on Meta::CPAN

-    "bne    %["#P0"], %[LoopEnd], 1b        \n\t"       \
+    "usw    %[temp4], " #A "(%[" #P2 "])    \n\t"       \
+    "usw    %[temp5], " #B "(%[" #P2 "])    \n\t"       \
+    "usw    %[temp6], " #C "(%[" #P2 "])    \n\t"       \
+    "usw    %[temp7], " #D "(%[" #P2 "])    \n\t"       \
+    "addiu  %[" #P2 "], %[" #P2 "],   16    \n\t"       \
+    "bne    %[" #P0 "], %[LoopEnd], 1b      \n\t"       \
     ".set   pop                             \n\t"       \
 
 #define ASM_END_COMMON_0                                \
diff -ru src.3170/Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c src/Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c
--- src.3170/Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c	2015-03-08 20:53:02.000000000 +0100
+++ src/Source/LibWebP/src/dsp/dsp.lossless_mips_dsp_r2.c	2017-06-22 22:18:06.110473600 +0200
@@ -29,14 +29,14 @@
     for (x = 0; x < (width >> 2); ++x) {                                       \
       int tmp1, tmp2, tmp3, tmp4;                                              \
       __asm__ volatile (                                                       \
-      ".ifc        "#TYPE",  uint8_t                    \n\t"                  \
+      ".ifc        " #TYPE ",  uint8_t                  \n\t"                  \
         "lbu       %[tmp1],  0(%[src])                  \n\t"                  \
         "lbu       %[tmp2],  1(%[src])                  \n\t"                  \
         "lbu       %[tmp3],  2(%[src])                  \n\t"                  \
         "lbu       %[tmp4],  3(%[src])                  \n\t"                  \

src/Makefile.srcs  view on Meta::CPAN

VER_MAJOR = 3
VER_MINOR = 17.0
SRCS = ./Source/FreeImage/BitmapAccess.cpp ./Source/FreeImage/ColorLookup.cpp ./Source/FreeImage/FreeImage.cpp ./Source/FreeImage/FreeImageC.c ./Source/FreeImage/FreeImageIO.cpp ./Source/FreeImage/GetType.cpp ./Source/FreeImage/MemoryIO.cpp ./Source/...
INCLS = ./Examples/OpenGL/TextureManager/TextureManager.h ./Examples/Plugin/PluginCradle.h ./Examples/Generic/FIIO_Mem.h ./Source/MapIntrospector.h ./Source/FreeImage - Copie.h ./Source/CacheFile.h ./Source/LibTIFF/tiffconf.vc.h ./Source/LibTIFF/tif_...

INCLUDE = -I. -ISource -ISource/Metadata -ISource/FreeImageToolkit -ISource/LibJPEG -ISource/LibPNG -ISource/LibTIFF4 -ISource/ZLib -ISource/LibOpenJPEG -ISource/OpenEXR -ISource/OpenEXR/Half -ISource/OpenEXR/Iex -ISource/OpenEXR/IlmImf -ISource/Open...

src/Source/FreeImage.h  view on Meta::CPAN

	FIC_RGBALPHA   = 4,		//! RGB color model with alpha channel
	FIC_CMYK       = 5		//! CMYK color model
};

/** Color quantization algorithms.
Constants used in FreeImage_ColorQuantize.
*/
FI_ENUM(FREE_IMAGE_QUANTIZE) {
    FIQ_WUQUANT = 0,		//! Xiaolin Wu color quantization algorithm
    FIQ_NNQUANT = 1,		//! NeuQuant neural-net quantization algorithm by Anthony Dekker
	FIQ_LFPQUANT = 2		//! Lossless Fast Pseudo-Quantization Algorithm by Carsten Klein
};

/** Dithering algorithms.
Constants used in FreeImage_Dither.
*/
FI_ENUM(FREE_IMAGE_DITHER) {
    FID_FS			= 0,	//! Floyd & Steinberg error diffusion
	FID_BAYER4x4	= 1,	//! Bayer ordered dispersed dot dithering (order 2 dithering matrix)
	FID_BAYER8x8	= 2,	//! Bayer ordered dispersed dot dithering (order 3 dithering matrix)
	FID_CLUSTER6x6	= 3,	//! Ordered clustered dot dithering (order 3 - 6x6 matrix)
	FID_CLUSTER8x8	= 4,	//! Ordered clustered dot dithering (order 4 - 8x8 matrix)
	FID_CLUSTER16x16= 5,	//! Ordered clustered dot dithering (order 8 - 16x16 matrix)
	FID_BAYER16x16	= 6		//! Bayer ordered dispersed dot dithering (order 4 dithering matrix)
};

/** Lossless JPEG transformations
Constants used in FreeImage_JPEGTransform
*/
FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
	FIJPEG_OP_NONE			= 0,	//! no transformation
	FIJPEG_OP_FLIP_H		= 1,	//! horizontal flip
	FIJPEG_OP_FLIP_V		= 2,	//! vertical flip
	FIJPEG_OP_TRANSPOSE		= 3,	//! transpose across UL-to-LR axis
	FIJPEG_OP_TRANSVERSE	= 4,	//! transpose across UR-to-LL axis
	FIJPEG_OP_ROTATE_90		= 5,	//! 90-degree clockwise rotation
	FIJPEG_OP_ROTATE_180	= 6,	//! 180-degree rotation

src/Source/FreeImage.h  view on Meta::CPAN

#define TIFF_NONE           0x0800  //! save without any compression
#define TIFF_CCITTFAX3		0x1000  //! save using CCITT Group 3 fax encoding
#define TIFF_CCITTFAX4		0x2000  //! save using CCITT Group 4 fax encoding
#define TIFF_LZW			0x4000	//! save using LZW compression
#define TIFF_JPEG			0x8000	//! save using JPEG compression
#define TIFF_LOGLUV			0x10000	//! save using LogLuv compression
#define WBMP_DEFAULT        0
#define XBM_DEFAULT			0
#define XPM_DEFAULT			0
#define WEBP_DEFAULT		0		//! save with good quality (75:1)
#define WEBP_LOSSLESS		0x100	//! save in lossless mode
#define JXR_DEFAULT			0		//! save with quality 80 and no chroma subsampling (4:4:4)
#define JXR_LOSSLESS		0x0064	//! save lossless
#define JXR_PROGRESSIVE		0x2000	//! save as a progressive-JXR (use | to combine with other save flags)

// Background filling options ---------------------------------------------------------
// Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas

#define FI_COLOR_IS_RGB_COLOR			0x00	//! RGBQUAD color is a RGB color (contains no valid alpha channel)
#define FI_COLOR_IS_RGBA_COLOR			0x01	//! RGBQUAD color is a RGBA color (contains a valid alpha channel)
#define FI_COLOR_FIND_EQUAL_COLOR		0x02	//! For palettized images: lookup equal RGB color from palette
#define FI_COLOR_ALPHA_IS_INDEX			0x04	//! The color's rgbReserved member (alpha) contains the palette index to be used
#define FI_COLOR_PALETTE_SEARCH_MASK	(FI_COLOR_FIND_EQUAL_COLOR | FI_COLOR_ALPHA_IS_INDEX)	// No color lookup is performed

src/Source/FreeImage.h  view on Meta::CPAN

DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadataKeyValue(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, const char *value);

// helpers
DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib);
DLL_API BOOL DLL_CALLCONV FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src);

// tag to C string conversion
DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, FITAG *tag, char *Make FI_DEFAULT(NULL));

// --------------------------------------------------------------------------
// JPEG lossless transformation routines
// --------------------------------------------------------------------------

DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCropU(const wchar_t *src_file, const wchar_t *dst_file, int left, int top, int right, int bottom);
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformFromHandle(FreeImageIO* src_io, fi_handle src_handle, FreeImageIO* dst_io, fi_handle dst_handle, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAU...
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombined(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedFromMemory(FIMEMORY* src_stream, FIMEMORY* dst_stream, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));

src/Source/FreeImage/PluginJXR.cpp  view on Meta::CPAN

Configure compression parameters

ImageQuality  Q (BD==1)  Q (BD==8)   Q (BD==16)  Q (BD==32F) Subsample   Overlap
[0.0, 0.4]    8-IQ*5     (see table) (see table) (see table) 4:4:4       2
(0.4, 0.8)    8-IQ*5     (see table) (see table) (see table) 4:4:4       1
[0.8, 1.0)    8-IQ*5     (see table) (see table) (see table) 4:4:4       1
[1.0, 1.0]    1          1           1           1           4:4:4       0

@param wmiSCP Encoder parameters
@param pixelInfo Image specifications
@param fltImageQuality Image output quality in [0..1), 1 means lossless
*/
static void 
SetCompression(CWMIStrCodecParam *wmiSCP, const PKPixelInfo *pixelInfo, float fltImageQuality) {
    if(fltImageQuality < 1.0F) {
        // overlap
		if(fltImageQuality >= 0.5F) {
			wmiSCP->olOverlap = OL_ONE;
		} else {
			wmiSCP->olOverlap = OL_TWO;
		}

src/Source/FreeImage/PluginJXR.cpp  view on Meta::CPAN

				
			wmiSCP->uiDefaultQPIndex = (U8) (0.5F + (float) pQPs[0] * (1.0F - qf) + (float) (pQPs + 6)[0] * qf);
			wmiSCP->uiDefaultQPIndexU = (U8) (0.5F + (float) pQPs[1] * (1.0F - qf) + (float) (pQPs + 6)[1] * qf);
			wmiSCP->uiDefaultQPIndexV = (U8) (0.5F + (float) pQPs[2] * (1.0F - qf) + (float) (pQPs + 6)[2] * qf);
            wmiSCP->uiDefaultQPIndexYHP = (U8) (0.5F + (float) pQPs[3] * (1.0F - qf) + (float) (pQPs + 6)[3] * qf);
			wmiSCP->uiDefaultQPIndexUHP = (U8) (0.5F + (float) pQPs[4] * (1.0F - qf) + (float) (pQPs + 6)[4] * qf);
			wmiSCP->uiDefaultQPIndexVHP = (U8) (0.5F + (float) pQPs[5] * (1.0F - qf) + (float) (pQPs + 6)[5] * qf);
		}
	} // fltImageQuality < 1.0F
    else {
		// lossless mode
		wmiSCP->uiDefaultQPIndex = 1;
	}
}

/**
Set encoder parameters
@param wmiSCP Encoder parameters
@param pixelInfo Image specifications
@param flags FreeImage save flags
@param bHasAlpha TRUE if an alpha layer is present

src/Source/FreeImage/PluginJXR.cpp  view on Meta::CPAN

	// update default values for some attributes
    wmiSCP->cfColorFormat = YUV_444;		// color format
    wmiSCP->bdBitDepth = BD_LONG;			// internal bit depth
    wmiSCP->bfBitstreamFormat = SPATIAL;	// compressed image data in spatial order
    wmiSCP->bProgressiveMode = FALSE;		// sequential mode
    wmiSCP->olOverlap = OL_ONE;				// single level overlap processing 
	wmiSCP->cNumOfSliceMinus1H = 0;			// # of horizontal slices
	wmiSCP->cNumOfSliceMinus1V = 0;			// # of vertical slices
    wmiSCP->sbSubband = SB_ALL;				// keep all subbands
    wmiSCP->uAlphaMode = 0;					// 0:no alpha 1: alpha only else: something + alpha 
    wmiSCP->uiDefaultQPIndex = 1;			// quantization for grey or rgb layer(s), 1: lossless
    wmiSCP->uiDefaultQPIndexAlpha = 1;		// quantization for alpha layer, 1: lossless

	// process the flags
	// -----------------

	// progressive mode
	if((flags & JXR_PROGRESSIVE) == JXR_PROGRESSIVE) {
		// turn on progressive mode (instead of sequential mode)
		wmiSCP->bProgressiveMode = TRUE;
	}

	// quality in [0.01 - 1.0), 1.0 means lossless - default is 0.80
	int quality = flags & 0x7F;
	if(quality == 0) {
		// defaut to 0.80
		fltImageQuality = 0.8F;
	} else if((flags & JXR_LOSSLESS) == JXR_LOSSLESS) {
		fltImageQuality = 1.0F;
	} else {
		quality = (quality >= 100) ? 100 : quality;
		fltImageQuality = quality / 100.0F;
	}

src/Source/FreeImage/PluginWebP.cpp  view on Meta::CPAN


		// --- Set encoding parameters ---

		// Initialize encoding parameters to default values
		WebPConfigInit(&config);

		// quality/speed trade-off (0=fast, 6=slower-better)
		config.method = 6;

		if((flags & WEBP_LOSSLESS) == WEBP_LOSSLESS) {
			// lossless encoding
			config.lossless = 1;
			picture.use_argb = 1;
		} else if((flags & 0x7F) > 0) {
			// lossy encoding
			config.lossless = 0;
			// quality is between 1 (smallest file) and 100 (biggest) - default to 75
			config.quality = (float)(flags & 0x7F);
			if(config.quality > 100) {
				config.quality = 100;
			}
		}

		// validate encoding parameters
		if(WebPValidateConfig(&config) == 0) {
			throw "Failed to initialize encoder";

src/Source/FreeImageToolkit/JPEGTransform.cpp  view on Meta::CPAN

// ==========================================================
// JPEG lossless transformations
//
// Design and implementation by
// - Petr Pytelka (pyta@lightcomp.com)
// - Hervé Drolon (drolon@infonie.fr)
// - Mihail Naydenov (mnaydenov@users.sourceforge.net)
//
// This file is part of FreeImage 3
//
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES

src/Source/LibJPEG/README  view on Meta::CPAN

OVERVIEW
========

This package contains C software to implement JPEG image encoding, decoding,
and transcoding.  JPEG (pronounced "jay-peg") is a standardized compression
method for full-color and gray-scale images.

This software implements JPEG baseline, extended-sequential, and progressive
compression processes.  Provision is made for supporting all variants of these
processes, although some uncommon parameter settings aren't implemented yet.
We have made no provision for supporting the hierarchical or lossless
processes defined in the standard.

We provide a set of library routines for reading and writing JPEG image files,
plus two sample applications "cjpeg" and "djpeg", which use the library to
perform conversion between JPEG and some other popular image file formats.
The library is intended to be reused in other applications.

In order to support file conversion and viewing software, we have included
considerable functionality beyond the bare JPEG coding/decoding capability;
for example, the color quantization modules are not strictly part of JPEG
decoding, but they are essential for output to colormapped file formats or
colormapped displays.  These extra functions can be compiled out of the
library if not required for a particular application.

We have also included "jpegtran", a utility for lossless transcoding between
different JPEG processes, and "rdjpgcom" and "wrjpgcom", two simple
applications for inserting and extracting textual comments in JFIF files.

The emphasis in designing this software has been on achieving portability and
flexibility, while also making it fast enough to be useful.  In particular,
the software is not intended to be read as a tutorial on JPEG.  (See the
REFERENCES section for introductory material.)  Rather, it is intended to
be reliable, portable, industrial-strength code.  We do not claim to have
achieved that goal in every aspect of the software, but we strive for it.

src/Source/LibJPEG/README  view on Meta::CPAN

Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS
10918-1, ITU-T T.81.  Part 2 is titled "Digital Compression and Coding of
Continuous-tone Still Images, Part 2: Compliance testing" and has document
numbers ISO/IEC IS 10918-2, ITU-T T.83.
IJG JPEG 8 introduced an implementation of the JPEG SmartScale extension
which is specified in two documents:  A contributed document at ITU and ISO
with title "ITU-T JPEG-Plus Proposal for Extending ITU-T T.81 for Advanced
Image Coding", April 2006, Geneva, Switzerland.  The latest version of this
document is Revision 3.  And a contributed document ISO/IEC JTC1/SC29/WG1 N
5799 with title "Evolution of JPEG", June/July 2011, Berlin, Germany.
IJG JPEG 9 introduces a reversible color transform for improved lossless
compression which is described in a contributed document ISO/IEC JTC1/SC29/
WG1 N 6080 with title "JPEG 9 Lossless Coding", June/July 2012, Paris,
France.

The JPEG standard does not specify all details of an interchangeable file
format.  For the omitted details we follow the "JFIF" conventions, revision
1.02.  JFIF 1.02 has been adopted as an Ecma International Technical Report
and thus received a formal publication status.  It is available as a free
download in PDF format from
http://www.ecma-international.org/publications/techreports/E-TR-098.htm.
A PostScript version of the JFIF document is available at
http://www.ijg.org/files/jfif.ps.gz.  There is also a plain text version at

src/Source/LibJPEG/change.log  view on Meta::CPAN

Note: Requires rebuild of test images.

Extend the bit depth support to all values from 8 to 12
(BITS_IN_JSAMPLE configuration option in jmorecfg.h).
jpegtran now supports N bits sample data precision with all N from 8 to 12
in a single instance.  Thank to Roland Fassauer for inspiration.

Try to resolve issues with new boolean type definition.
Thank also to v4hn for suggestion.

Enable option to use default Huffman tables for lossless compression
(for hardware solution), and in this case improve lossless RGB compression
with reversible color transform.  Thank to Benny Alexandar for hint.

Extend the entropy decoding structure, so that extraneous bytes between
compressed scan data and following marker can be reported correctly.
Thank to Nigel Tao for hint.

Add jpegtran -wipe option and extension for -crop.
Thank to Andrew Senior, David Clunie, and Josef Schmid for suggestion.


Version 9  13-Jan-2013
----------------------

Add cjpeg -rgb1 option to create an RGB JPEG file, and insert
a simple reversible color transform into the processing which
significantly improves the compression.
The recommended command for lossless coding of RGB images is now
cjpeg -rgb1 -block 1 -arithmetic.
As said, this option improves the compression significantly, but
the files are not compatible with JPEG decoders prior to IJG v9
due to the included color transform.
The used color transform and marker signaling is compatible with
other JPEG standards (e.g., JPEG-LS part 2).

Remove the automatic de-ANSI-fication support (Automake 1.12).
Thank also to Nitin A Kamble for suggestion.

src/Source/LibJPEG/change.log  view on Meta::CPAN

Add missing #include directives in configuration checks, avoid
configuration errors.  Thank to John Spencer for the hint.


Version 8d  15-Jan-2012
-----------------------

Add cjpeg -rgb option to create RGB JPEG files.
Using this switch suppresses the conversion from RGB
colorspace input to the default YCbCr JPEG colorspace.
This feature allows true lossless JPEG coding of RGB color images.
The recommended command for this purpose is currently
cjpeg -rgb -block 1 -arithmetic.
SmartScale capable decoder (introduced with IJG JPEG 8) required.
Thank to Michael Koch for the initial suggestion.

Add option to disable the region adjustment in the transupp crop code.
Thank to Jeffrey Friedl for the suggestion.

Thank to Richard Jones and Edd Dawson for various minor corrections.

src/Source/LibJPEG/change.log  view on Meta::CPAN

Support 32-bit BMPs (RGB image with Alpha channel) for read in cjpeg.
Thank to Brett Blackham for the suggestion.

Improve accuracy in floating point IDCT calculation.
Thank to Robert Hooke for the hint.


Version 8  10-Jan-2010
----------------------

jpegtran now supports the same -scale option as djpeg for "lossless" resize.
An implementation of the JPEG SmartScale extension is required for this
feature.  A (draft) specification of the JPEG SmartScale extension is
available as a contributed document at ITU and ISO.  Revision 2 or later
of the document is required (latest document version is Revision 3).
The SmartScale extension will enable more features beside lossless resize
in future implementations, as described in the document (new compression
options).

Add sanity check in BMP reader module to avoid cjpeg crash for empty input
image (thank to Isaev Ildar of ISP RAS, Moscow, RU for reporting this error).

Add data source and destination managers for read from and write to
memory buffers.  New API functions jpeg_mem_src and jpeg_mem_dest.
Thank to Roberto Boni from Italy for the suggestion.

src/Source/LibJPEG/change.log  view on Meta::CPAN

New variable "do_fancy_downsampling" in library, complement to fancy
upsampling.  Fancy upsampling now uses direct DCT scaling with sizes
larger than 8.  The old method is not reversible and has been removed.

Support arithmetic entropy encoding and decoding.
Added files jaricom.c, jcarith.c, jdarith.c.

Straighten the file structure:
Removed files jidctred.c, jcphuff.c, jchuff.h, jdphuff.c, jdhuff.h.

jpegtran has a new "lossless" cropping feature.

Implement -perfect option in jpegtran, new API function
jtransform_perfect_transform() in transupp. (DP 204_perfect.dpatch)

Better error messages for jpegtran fopen failure.
(DP 203_jpegtran_errmsg.dpatch)

Fix byte order issue with 16bit PPM/PGM files in rdppm.c/wrppm.c:
according to Netpbm, the de facto standard implementation of the PNM formats,
the most significant byte is first. (DP 203_rdppm.dpatch)

src/Source/LibJPEG/change.log  view on Meta::CPAN


Add extern "C" to jpeglib.h.
This avoids the need to put extern "C" { ... } around #include "jpeglib.h"
in your C++ application.  Defining the symbol DONT_USE_EXTERN_C in the
configuration prevents this. (DP 202_jpeglib.h_c++.dpatch)


Version 6b  27-Mar-1998
-----------------------

jpegtran has new features for lossless image transformations (rotation
and flipping) as well as "lossless" reduction to grayscale.

jpegtran now copies comments by default; it has a -copy switch to enable
copying all APPn blocks as well, or to suppress comments.  (Formerly it
always suppressed comments and APPn blocks.)  jpegtran now also preserves
JFIF version and resolution information.

New decompressor library feature: COM and APPn markers found in the input
file can be saved in memory for later use by the application.  (Before,
you had to code this up yourself with a custom marker processor.)

src/Source/LibJPEG/change.log  view on Meta::CPAN


Version 6  2-Aug-95
-------------------

Progressive JPEG support: library can read and write full progressive JPEG
files.  A "buffered image" mode supports incremental decoding for on-the-fly
display of progressive images.  Simply recompiling an existing IJG-v5-based
decoder with v6 should allow it to read progressive files, though of course
without any special progressive display.

New "jpegtran" application performs lossless transcoding between different
JPEG formats; primarily, it can be used to convert baseline to progressive
JPEG and vice versa.  In support of jpegtran, the library now allows lossless
reading and writing of JPEG files as DCT coefficient arrays.  This ability
may be of use in other applications.

Notes for programmers:
* We changed jpeg_start_decompress() to be able to suspend; this makes all
decoding modes available to suspending-input applications.  However,
existing applications that use suspending input will need to be changed
to check the return value from jpeg_start_decompress().  You don't need to
do anything if you don't use a suspending data source.
* We changed the interface to the virtual array routines: access_virt_array

src/Source/LibJPEG/filelist.txt  view on Meta::CPAN


Copyright (C) 1994-2013, Thomas G. Lane, Guido Vollbeding.
This file is part of the Independent JPEG Group's software.
For conditions of distribution and use, see the accompanying README file.


Here is a road map to the files in the IJG JPEG distribution.  The
distribution includes the JPEG library proper, plus two application
programs ("cjpeg" and "djpeg") which use the library to convert JPEG
files to and from some other popular image formats.  A third application
"jpegtran" uses the library to do lossless conversion between different
variants of JPEG.  There are also two stand-alone applications,
"rdjpgcom" and "wrjpgcom".


THE JPEG LIBRARY
================

Include files:

jpeglib.h	JPEG library's exported data and function declarations.

src/Source/LibJPEG/filelist.txt  view on Meta::CPAN


C source code files:

cjpeg.c		Main program for cjpeg.
djpeg.c		Main program for djpeg.
jpegtran.c	Main program for jpegtran.
cdjpeg.c	Utility routines used by all three programs.
rdcolmap.c	Code to read a colormap file for djpeg's "-map" switch.
rdswitch.c	Code to process some of cjpeg's more complex switches.
		Also used by jpegtran.
transupp.c	Support code for jpegtran: lossless image manipulations.

Image file reader modules for cjpeg:

rdbmp.c		BMP file input.
rdgif.c		GIF file input (now just a stub).
rdppm.c		PPM/PGM file input.
rdrle.c		Utah RLE file input.
rdtarga.c	Targa file input.

Image file writer modules for djpeg:

src/Source/LibJPEG/jccolor.c  view on Meta::CPAN

 * maximum red and maximum blue in order to get exact grayscales.
 *
 * To avoid floating-point arithmetic, we represent the fractional constants
 * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
 * the products by 2^16, with appropriate rounding, to get the correct answer.
 *
 * For even more speed, we avoid doing any multiplications in the inner loop
 * by precalculating the constants times R,G,B for all possible values.
 * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
 * for 9-bit to 12-bit samples it is still acceptable.  It's not very
 * reasonable for 16-bit samples, but if you want lossless storage you
 * shouldn't be changing colorspace anyway.
 * The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included
 * in the tables to save adding them separately in the inner loop.
 */

#define SCALEBITS	16	/* speediest right-shift on some machines */
#define CBCR_OFFSET	((INT32) CENTERJSAMPLE << SCALEBITS)
#define ONE_HALF	((INT32) 1 << (SCALEBITS-1))
#define FIX(x)		((INT32) ((x) * (1L<<SCALEBITS) + 0.5))

src/Source/LibJPEG/jctrans.c  view on Meta::CPAN

  /* Perform master selection of active modules */
  transencode_master_selection(cinfo, coef_arrays);
  /* Wait for jpeg_finish_compress() call */
  cinfo->next_scanline = 0;	/* so jpeg_write_marker works */
  cinfo->global_state = CSTATE_WRCOEFS;
}


/*
 * Initialize the compression object with default parameters,
 * then copy from the source object all parameters needed for lossless
 * transcoding.  Parameters that can be varied without loss (such as
 * scan script and Huffman optimization) are left in their default states.
 */

GLOBAL(void)
jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
			       j_compress_ptr dstinfo)
{
  JQUANT_TBL ** qtblptr;
  jpeg_component_info *incomp, *outcomp;

src/Source/LibJPEG/jdcolor.c  view on Meta::CPAN

 * To avoid floating-point arithmetic, we represent the fractional constants
 * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
 * the products by 2^16, with appropriate rounding, to get the correct answer.
 * Notice that Y, being an integral input, does not contribute any fraction
 * so it need not participate in the rounding.
 *
 * For even more speed, we avoid doing any multiplications in the inner loop
 * by precalculating the constants times Cb and Cr for all possible values.
 * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
 * for 9-bit to 12-bit samples it is still acceptable.  It's not very
 * reasonable for 16-bit samples, but if you want lossless storage you
 * shouldn't be changing colorspace anyway.
 * The Cr=>R and Cb=>B values can be rounded to integers in advance; the
 * values for the G calculation are left scaled up, since we must add them
 * together before rounding.
 */

#define SCALEBITS	16	/* speediest right-shift on some machines */
#define ONE_HALF	((INT32) 1 << (SCALEBITS-1))
#define FIX(x)		((INT32) ((x) * (1L<<SCALEBITS) + 0.5))

src/Source/LibJPEG/jdmarker.c  view on Meta::CPAN

      if (! get_sof(cinfo, FALSE, FALSE, TRUE))
	return JPEG_SUSPENDED;
      break;

    case M_SOF10:		/* Progressive, arithmetic */
      if (! get_sof(cinfo, FALSE, TRUE, TRUE))
	return JPEG_SUSPENDED;
      break;

    /* Currently unsupported SOFn types */
    case M_SOF3:		/* Lossless, Huffman */
    case M_SOF5:		/* Differential sequential, Huffman */
    case M_SOF6:		/* Differential progressive, Huffman */
    case M_SOF7:		/* Differential lossless, Huffman */
    case M_JPG:			/* Reserved for JPEG extensions */
    case M_SOF11:		/* Lossless, arithmetic */
    case M_SOF13:		/* Differential sequential, arithmetic */
    case M_SOF14:		/* Differential progressive, arithmetic */
    case M_SOF15:		/* Differential lossless, arithmetic */
      ERREXIT1(cinfo, JERR_SOF_UNSUPPORTED, cinfo->unread_marker);
      break;

    case M_SOS:
      if (! get_sos(cinfo))
	return JPEG_SUSPENDED;
      cinfo->unread_marker = 0;	/* processed the marker */
      return JPEG_REACHED_SOS;

    case M_EOI:

src/Source/LibJPEG/jmorecfg.h  view on Meta::CPAN


/*
 * Define BITS_IN_JSAMPLE as either
 *   8   for 8-bit sample values (the usual setting)
 *   9   for 9-bit sample values
 *   10  for 10-bit sample values
 *   11  for 11-bit sample values
 *   12  for 12-bit sample values
 * Only 8, 9, 10, 11, and 12 bits sample data precision are supported for
 * full-feature DCT processing.  Further depths up to 16-bit may be added
 * later for the lossless modes of operation.
 * Run-time selection and conversion of data precision will be added later
 * and are currently not supported, sorry.
 * Exception:  The transcoding part (jpegtran) supports all settings in a
 * single instance, since it operates on the level of DCT coefficients and
 * not sample values.  The DCT coefficients are of the same type (16 bits)
 * in all cases (see below).
 */

#define BITS_IN_JSAMPLE  8	/* use 8, 9, 10, 11, or 12 */

src/Source/LibJPEG/jpeglib.h  view on Meta::CPAN

/* Control saving of COM and APPn markers into marker_list. */
EXTERN(void) jpeg_save_markers
	JPP((j_decompress_ptr cinfo, int marker_code,
	     unsigned int length_limit));

/* Install a special processing method for COM or APPn markers. */
EXTERN(void) jpeg_set_marker_processor
	JPP((j_decompress_ptr cinfo, int marker_code,
	     jpeg_marker_parser_method routine));

/* Read or write raw DCT coefficients --- useful for lossless transcoding. */
EXTERN(jvirt_barray_ptr *) jpeg_read_coefficients JPP((j_decompress_ptr cinfo));
EXTERN(void) jpeg_write_coefficients JPP((j_compress_ptr cinfo,
					  jvirt_barray_ptr * coef_arrays));
EXTERN(void) jpeg_copy_critical_parameters JPP((j_decompress_ptr srcinfo,
						j_compress_ptr dstinfo));

/* If you choose to abort compression or decompression before completing
 * jpeg_finish_(de)compress, then you need to clean up to release memory,
 * temporary files, etc.  You can just call jpeg_destroy_(de)compress
 * if you're done with the JPEG object, but if you want to clean it up and

src/Source/LibJPEG/jpegtran.c  view on Meta::CPAN

/*
 * jpegtran.c
 *
 * Copyright (C) 1995-2013, Thomas G. Lane, 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 a command-line user interface for JPEG transcoding.
 * It is very similar to cjpeg.c, and partly to djpeg.c, but provides
 * lossless transcoding between different JPEG file formats.  It also
 * provides some lossless and sort-of-lossless transformations of JPEG data.
 */

#include "cdjpeg.h"		/* Common decls for cjpeg/djpeg applications */
#include "transupp.h"		/* Support routines for jpegtran */
#include "jversion.h"		/* for version message */

#ifdef USE_CCOMMAND		/* command-line reader for Macintosh */
#ifdef __MWERKS__
#include <SIOUX.h>              /* Metrowerks needs this */
#include <console.h>		/* ... and this */

src/Source/LibJPEG/jpegtran.c  view on Meta::CPAN

      if (keymatch(argv[argn], "none", 1)) {
	copyoption = JCOPYOPT_NONE;
      } else if (keymatch(argv[argn], "comments", 1)) {
	copyoption = JCOPYOPT_COMMENTS;
      } else if (keymatch(argv[argn], "all", 1)) {
	copyoption = JCOPYOPT_ALL;
      } else
	usage();

    } else if (keymatch(arg, "crop", 2)) {
      /* Perform lossless cropping. */
#if TRANSFORMS_SUPPORTED
      if (++argn >= argc)	/* advance to next argument */
	usage();
      if (transformoption.crop /* reject multiple crop/wipe requests */ ||
	  ! jtransform_parse_crop_spec(&transformoption, argv[argn])) {
	fprintf(stderr, "%s: bogus -crop argument '%s'\n",
		progname, argv[argn]);
	exit(EXIT_FAILURE);
      }
#else

src/Source/LibJPEG/libjpeg.txt  view on Meta::CPAN

compression side we have generally not provided low-quality choices, since
compression is normally less time-critical.  It should be understood that the
low-quality modes may not meet the JPEG standard's accuracy requirements;
nonetheless, they are useful for viewers.

A word about functions *not* provided by the library.  We handle a subset of
the ISO JPEG standard; most baseline, extended-sequential, and progressive
JPEG processes are supported.  (Our subset includes all features now in common
use.)  Unsupported ISO options include:
	* Hierarchical storage
	* Lossless JPEG
	* DNL marker
	* Nonintegral subsampling ratios
We support 8-bit to 12-bit data precision, but this is a compile-time choice
rather than a run-time choice; hence it is difficult to use different
precisions in a single application.

By itself, the library handles only interchange JPEG datastreams --- in
particular the widely used JFIF file format.  The library can be used by
surrounding code to process interchange or abbreviated JPEG datastreams that
are embedded in more complex file formats.  (For example, this library is

src/Source/LibJPEG/libjpeg.txt  view on Meta::CPAN

include jerror.h to define those symbols.

jpeglib.h indirectly includes the files jconfig.h and jmorecfg.h.  If you are
installing the JPEG header files in a system directory, you will want to
install all four files: jpeglib.h, jerror.h, jconfig.h, jmorecfg.h.

The most convenient way to include the JPEG code into your executable program
is to prepare a library file ("libjpeg.a", or a corresponding name on non-Unix
machines) and reference it at your link step.  If you use only half of the
library (only compression or only decompression), only that much code will be
included from the library, unless your linker is hopelessly brain-damaged.
The supplied makefiles build libjpeg.a automatically (see install.txt).

While you can build the JPEG library as a shared library if the whim strikes
you, we don't really recommend it.  The trouble with shared libraries is that
at some point you'll probably try to substitute a new version of the library
without recompiling the calling applications.  That generally doesn't work
because the parameter struct declarations usually change with each new
version.  In other words, the library's API is *not* guaranteed binary
compatible across versions; we only try to ensure source-code compatibility.
(In hindsight, it might have been smarter to hide the parameter structs from

src/Source/LibJPEG/libjpeg.txt  view on Meta::CPAN

	If TRUE, use arithmetic coding.
	If FALSE, use Huffman coding.

int block_size
	Set DCT block size.  All N from 1 to 16 are possible.
	Default is 8 (baseline format).
	Larger values produce higher compression,
	smaller values produce higher quality.
	An exact DCT stage is possible with 1 or 2.
	With the default quality of 75 and default Luminance qtable
	the DCT+Quantization stage is lossless for value 1.
	Note that values other than 8 require a SmartScale capable decoder,
	introduced with IJG JPEG 8.  Setting the block_size parameter for
	compression works with version 8c and later.

J_DCT_METHOD dct_method
	Selects the algorithm used for the DCT step.  Choices are:
		JDCT_ISLOW: slow but accurate integer algorithm
		JDCT_IFAST: faster, less accurate integer method
		JDCT_FLOAT: floating-point method
		JDCT_DEFAULT: default method (normally JDCT_ISLOW)

src/Source/LibJPEG/libjpeg.txt  view on Meta::CPAN

int num_components
	The JPEG color space and corresponding number of components; see
	"Special color spaces", below, for more info.  We recommend using
	jpeg_set_colorspace() if you want to change these.

J_COLOR_TRANSFORM color_transform
	Internal color transform identifier, writes LSE marker if nonzero
	(requires decoder with inverse color transform support, introduced
	with IJG JPEG 9).
	Two values are currently possible: JCT_NONE and JCT_SUBTRACT_GREEN.
	Set this value for lossless RGB application *before* calling
	jpeg_set_colorspace(), because entropy table assignment in
	jpeg_set_colorspace() depends on color_transform.

boolean optimize_coding
	TRUE causes the compressor to compute optimal Huffman coding tables
	for the image.  This requires an extra pass over the data and
	therefore costs a good deal of space and time.  The default is
	FALSE, which tells the compressor to use the supplied or default
	Huffman tables.  In most cases optimal tables save only a few percent
	of file size compared to the default tables.  Note that when this is

src/Source/LibJPEG/libjpeg.txt  view on Meta::CPAN


Input suspension is supported with raw-data decompression: if the data source
module suspends, jpeg_read_raw_data() will return 0.  You can also use
buffered-image mode to read raw data in multiple passes.


Really raw data: DCT coefficients
---------------------------------

It is possible to read or write the contents of a JPEG file as raw DCT
coefficients.  This facility is mainly intended for use in lossless
transcoding between different JPEG file formats.  Other possible applications
include lossless cropping of a JPEG image, lossless reassembly of a
multi-strip or multi-tile TIFF/JPEG file into a single JPEG datastream, etc.

To read the contents of a JPEG file as DCT coefficients, open the file and do
jpeg_read_header() as usual.  But instead of calling jpeg_start_decompress()
and jpeg_read_scanlines(), call jpeg_read_coefficients().  This will read the
entire image into a set of virtual coefficient-block arrays, one array per
component.  The return value is a pointer to an array of virtual-array
descriptors.  Each virtual array can be accessed directly using the JPEG
memory manager's access_virt_barray method (see Memory management, below,
and also read structure.txt's discussion of virtual array handling).  Or,

src/Source/LibJPEG/rdjpgcom.c  view on Meta::CPAN


  data_precision = read_1_byte();
  image_height = read_2_bytes();
  image_width = read_2_bytes();
  num_components = read_1_byte();

  switch (marker) {
  case M_SOF0:	process = "Baseline";  break;
  case M_SOF1:	process = "Extended sequential";  break;
  case M_SOF2:	process = "Progressive";  break;
  case M_SOF3:	process = "Lossless";  break;
  case M_SOF5:	process = "Differential sequential";  break;
  case M_SOF6:	process = "Differential progressive";  break;
  case M_SOF7:	process = "Differential lossless";  break;
  case M_SOF9:	process = "Extended sequential, arithmetic coding";  break;
  case M_SOF10:	process = "Progressive, arithmetic coding";  break;
  case M_SOF11:	process = "Lossless, arithmetic coding";  break;
  case M_SOF13:	process = "Differential sequential, arithmetic coding";  break;
  case M_SOF14:	process = "Differential progressive, arithmetic coding"; break;
  case M_SOF15:	process = "Differential lossless, arithmetic coding";  break;
  default:	process = "Unknown";  break;
  }

  printf("JPEG image is %uw * %uh, %d color components, %d bits per sample\n",
	 image_width, image_height, num_components, data_precision);
  printf("JPEG process: %s\n", process);

  if (length != (unsigned int) (8 + num_components * 3))
    ERREXIT("Bogus SOF marker length");

src/Source/LibJPEG/rdjpgcom.c  view on Meta::CPAN

  /* Scan miscellaneous markers until we reach SOS. */
  for (;;) {
    marker = next_marker();
    switch (marker) {
      /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be,
       * treated as SOFn.  C4 in particular is actually DHT.
       */
    case M_SOF0:		/* Baseline */
    case M_SOF1:		/* Extended sequential, Huffman */
    case M_SOF2:		/* Progressive, Huffman */
    case M_SOF3:		/* Lossless, Huffman */
    case M_SOF5:		/* Differential sequential, Huffman */
    case M_SOF6:		/* Differential progressive, Huffman */
    case M_SOF7:		/* Differential lossless, Huffman */
    case M_SOF9:		/* Extended sequential, arithmetic */
    case M_SOF10:		/* Progressive, arithmetic */
    case M_SOF11:		/* Lossless, arithmetic */
    case M_SOF13:		/* Differential sequential, arithmetic */
    case M_SOF14:		/* Differential progressive, arithmetic */
    case M_SOF15:		/* Differential lossless, arithmetic */
      if (verbose)
	process_SOFn(marker);
      else
	skip_variable();
      break;

    case M_SOS:			/* stop before hitting compressed data */
      return marker;

    case M_EOI:			/* in case it's a tables-only JPEG stream */

src/Source/LibJPEG/structure.txt  view on Meta::CPAN

The IJG distribution contains two parts:
  * A subroutine library for JPEG compression and decompression.
  * cjpeg/djpeg, two sample applications that use the library to transform
    JFIF JPEG files to and from several other image formats.
cjpeg/djpeg are of no great intellectual complexity: they merely add a simple
command-line user interface and I/O routines for several uncompressed image
formats.  This document concentrates on the library itself.

We desire the library to be capable of supporting all JPEG baseline, extended
sequential, and progressive DCT processes.  The library does not support the
hierarchical or lossless processes defined in the standard.

Within these limits, any set of compression parameters allowed by the JPEG
spec should be readable for decompression.  (We can be more restrictive about
what formats we can generate.)  Although the system design allows for all
parameter values, some uncommon settings are not yet implemented and may
never be; nonintegral sampling ratios are the prime example.  Furthermore,
we treat 8-bit vs. 12-bit data precision as a compile-time switch, not a
run-time option, because most machines can store 8-bit pixels much more
compactly than 12-bit.

src/Source/LibJPEG/transupp.c  view on Meta::CPAN


#include "jinclude.h"
#include "jpeglib.h"
#include "transupp.h"		/* My own external interface */
#include <ctype.h>		/* to declare isdigit() */


#if TRANSFORMS_SUPPORTED

/*
 * Lossless image transformation routines.  These routines work on DCT
 * coefficient arrays and thus do not require any lossy decompression
 * or recompression of the image.
 * Thanks to Guido Vollbeding for the initial design and code of this feature,
 * and to Ben Jackson for introducing the cropping feature.
 *
 * Horizontal flipping is done in-place, using a single top-to-bottom
 * pass through the virtual source array.  It will thus be much the
 * fastest option for images larger than main memory.
 *
 * The other routines require a set of destination virtual arrays, so they

src/Source/LibJPEG/transupp.c  view on Meta::CPAN

    break;
  case JXFORM_WIPE:
    do_wipe(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
	    src_coef_arrays, info->drop_width, info->drop_height);
    break;
  }
}

/* jtransform_perfect_transform
 *
 * Determine whether lossless transformation is perfectly
 * possible for a specified image and transformation.
 *
 * Inputs:
 *   image_width, image_height: source image dimensions.
 *   MCU_width, MCU_height: pixel dimensions of MCU.
 *   transform: transformation identifier.
 * Parameter sources from initialized jpeg_struct
 * (after reading source header):
 *   image_width = cinfo.image_width
 *   image_height = cinfo.image_height

src/Source/LibJPEG/transupp.h  view on Meta::CPAN

 * basic transformation.
 *
 * Transpose is the only transformation that can handle partial iMCUs at the
 * right and bottom edges completely cleanly.  flip_h can flip partial iMCUs
 * at the bottom, but leaves any partial iMCUs at the right edge untouched.
 * Similarly flip_v leaves any partial iMCUs at the bottom edge untouched.
 * The other transforms are defined as combinations of these basic transforms
 * and process edge blocks in a way that preserves the equivalence.
 *
 * The "trim" option causes untransformable partial iMCUs to be dropped;
 * this is not strictly lossless, but it usually gives the best-looking
 * result for odd-size images.  Note that when this option is active,
 * the expected mathematical equivalences between the transforms may not hold.
 * (For example, -rot 270 -trim trims only the bottom edge, but -rot 90 -trim
 * followed by -rot 180 -trim trims both edges.)
 *
 * We also offer a lossless-crop option, which discards data outside a given
 * image region but losslessly preserves what is inside.  Like the rotate and
 * flip transforms, lossless crop is restricted by the current JPEG format: the
 * upper left corner of the selected region must fall on an iMCU boundary.  If
 * this does not hold for the given crop parameters, we silently move the upper
 * left corner up and/or left to make it so, simultaneously increasing the
 * region dimensions to keep the lower right crop corner unchanged.  (Thus, the
 * output image covers at least the requested region, but may cover more.)
 * The adjustment of the region dimensions may be optionally disabled.
 *
 * A complementary lossless-wipe option is provided to discard (gray out) data
 * inside a given image region while losslessly preserving what is outside.
 *
 * We also provide a lossless-resize option, which is kind of a lossless-crop
 * operation in the DCT coefficient block domain - it discards higher-order
 * coefficients and losslessly preserves lower-order coefficients of a
 * sub-block.
 *
 * Rotate/flip transform, resize, and crop can be requested together in a
 * single invocation.  The crop is applied last --- that is, the crop region
 * is specified in terms of the destination image after transform/resize.
 *
 * We also offer a "force to grayscale" option, which simply discards the
 * chrominance channels of a YCbCr image.  This is lossless in the sense that
 * the luminance channel is preserved exactly.  It's not the same kind of
 * thing as the rotate/flip transformations, but it's convenient to handle it
 * as part of this package, mainly because the transformation routines have to
 * be aware of the option to know how many components to work on.
 */


/* Short forms of external names for systems with brain-damaged linkers. */

#ifdef NEED_SHORT_EXTERNAL_NAMES

src/Source/LibJPEG/transupp.h  view on Meta::CPAN

/* Adjust output image parameters */
EXTERN(jvirt_barray_ptr *) jtransform_adjust_parameters
	JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
	     jvirt_barray_ptr *src_coef_arrays,
	     jpeg_transform_info *info));
/* Execute the actual transformation, if any */
EXTERN(void) jtransform_execute_transform
	JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
	     jvirt_barray_ptr *src_coef_arrays,
	     jpeg_transform_info *info));
/* Determine whether lossless transformation is perfectly
 * possible for a specified image and transformation.
 */
EXTERN(boolean) jtransform_perfect_transform
	JPP((JDIMENSION image_width, JDIMENSION image_height,
	     int MCU_width, int MCU_height,
	     JXFORM_CODE transform));

/* jtransform_execute_transform used to be called
 * jtransform_execute_transformation, but some compilers complain about
 * routine names that long.  This macro is here to avoid breaking any

src/Source/LibJPEG/usage.txt  view on Meta::CPAN

			Be sure to use this switch when compressing a grayscale
			BMP file, because cjpeg isn't bright enough to notice
			whether a BMP file uses only shades of gray.  By
			saying -grayscale, you'll get a smaller JPEG file that
			takes less time to process.

	-rgb		Create RGB JPEG file.
			Using this switch suppresses the conversion from RGB
			colorspace input to the default YCbCr JPEG colorspace.
			You can use this switch in combination with the
			-block N switch (see below) for lossless JPEG coding.
			See also the -rgb1 switch below.

	-optimize	Perform optimization of entropy encoding parameters.
			Without this, default encoding parameters are used.
			-optimize usually makes the JPEG file a little smaller,
			but cjpeg runs somewhat slower and needs much more
			memory.  Image quality and speed of decompression are
			unaffected by -optimize.

	-progressive	Create progressive JPEG file (see below).

src/Source/LibJPEG/usage.txt  view on Meta::CPAN

			CAUTION: arithmetic coded JPEG is not yet widely
			implemented, so many decoders will be unable to
			view an arithmetic coded JPEG file at all.

	-block N	Set DCT block size.  All N from 1 to 16 are possible.
			Default is 8 (baseline format).
			Larger values produce higher compression,
			smaller values produce higher quality
			(exact DCT stage possible with 1 or 2; with the
			default quality of 75 and default Luminance qtable
			the DCT+Quantization stage is lossless for N=1).
			CAUTION: An implementation of the JPEG SmartScale
			extension is required for this feature.  SmartScale
			enabled JPEG is not yet widely implemented, so many
			decoders will be unable to view a SmartScale extended
			JPEG file at all.

	-rgb1		Create RGB JPEG file with reversible color transform.
			Works like the -rgb switch (see above) and inserts a
			simple reversible color transform into the processing
			which significantly improves the compression.
			Use this switch in combination with the -block N
			switch (see above) for lossless JPEG coding.
			CAUTION: A decoder with inverse color transform
			support is required for this feature.  Reversible
			color transform support is not yet widely implemented,
			so many decoders will be unable to view a reversible
			color transformed JPEG file at all.

	-bgycc		Create big gamut YCC JPEG file.
			In this type of encoding the color difference
			components are quantized further by a factor of 2
			compared to the normal Cb/Cr values, thus creating

src/Source/LibJPEG/usage.txt  view on Meta::CPAN

Color GIF files are not the ideal input for JPEG; JPEG is really intended for
compressing full-color (24-bit) images.  In particular, don't try to convert
cartoons, line drawings, and other images that have only a few distinct
colors.  GIF works great on these, JPEG does not.  If you want to convert a
GIF to JPEG, you should experiment with cjpeg's -quality and -smooth options
to get a satisfactory conversion.  -smooth 10 or so is often helpful.

Avoid running an image through a series of JPEG compression/decompression
cycles.  Image quality loss will accumulate; after ten or so cycles the image
may be noticeably worse than it was after one cycle.  It's best to use a
lossless format while manipulating an image, then convert to JPEG format when
you are ready to file the image away.

The -optimize option to cjpeg is worth using when you are making a "final"
version for posting or archiving.  It's also a win when you are using low
quality settings to make very small JPEG files; the percentage improvement
is often a lot more than it is on larger files.  (At present, -optimize
mode is always selected when generating progressive JPEG files.)

GIF input files are no longer supported, to avoid the Unisys LZW patent
(now expired).

src/Source/LibJPEG/usage.txt  view on Meta::CPAN


JPEGTRAN

jpegtran performs various useful transformations of JPEG files.
It can translate the coded representation from one variant of JPEG to another,
for example from baseline JPEG to progressive JPEG or vice versa.  It can also
perform some rearrangements of the image data, for example turning an image
from landscape to portrait format by rotation.

jpegtran works by rearranging the compressed data (DCT coefficients), without
ever fully decoding the image.  Therefore, its transformations are lossless:
there is no image degradation at all, which would not be true if you used
djpeg followed by cjpeg to accomplish the same conversion.  But by the same
token, jpegtran cannot perform lossy operations such as changing the image
quality.

jpegtran uses a command line syntax similar to cjpeg or djpeg.
On Unix-like systems, you say:
	jpegtran [switches] [inputfile] >outputfile
On most non-Unix systems, you say:
	jpegtran [switches] inputfile outputfile

src/Source/LibJPEG/usage.txt  view on Meta::CPAN

	-optimize	Perform optimization of entropy encoding parameters.
	-progressive	Create progressive JPEG file.
	-arithmetic	Use arithmetic coding.
	-restart N	Emit a JPEG restart marker every N MCU rows, or every
			N MCU blocks if "B" is attached to the number.
	-scans file	Use the scan script given in the specified text file.
See the previous discussion of cjpeg for more details about these switches.
If you specify none of these switches, you get a plain baseline-JPEG output
file.  The quality setting and so forth are determined by the input file.

The image can be losslessly transformed by giving one of these switches:
	-flip horizontal	Mirror image horizontally (left-right).
	-flip vertical		Mirror image vertically (top-bottom).
	-rotate 90		Rotate image 90 degrees clockwise.
	-rotate 180		Rotate image 180 degrees.
	-rotate 270		Rotate image 270 degrees clockwise (or 90 ccw).
	-transpose		Transpose image (across UL-to-LR axis).
	-transverse		Transverse transpose (across UR-to-LL axis).

The transpose transformation has no restrictions regarding image dimensions.
The other transformations operate rather oddly if the image dimensions are not

src/Source/LibJPEG/usage.txt  view on Meta::CPAN

able to flip all columns.  The other transforms can be built up as sequences
of transpose and flip operations; for consistency, their actions on edge
pixels are defined to be the same as the end result of the corresponding
transpose-and-flip sequence.

For practical use, you may prefer to discard any untransformable edge pixels
rather than having a strange-looking strip along the right and/or bottom edges
of a transformed image.  To do this, add the -trim switch:
	-trim		Drop non-transformable edge blocks.
Obviously, a transformation with -trim is not reversible, so strictly speaking
jpegtran with this switch is not lossless.  Also, the expected mathematical
equivalences between the transformations no longer hold.  For example,
"-rot 270 -trim" trims only the bottom edge, but "-rot 90 -trim" followed by
"-rot 180 -trim" trims both edges.

If you are only interested in perfect transformation, add the -perfect switch:
	-perfect	Fails with an error if the transformation is not
			perfect.
For example you may want to do
  jpegtran -rot 90 -perfect foo.jpg || djpeg foo.jpg | pnmflip -r90 | cjpeg
to do a perfect rotation if available or an approximated one if not.

We also offer a lossless-crop option, which discards data outside a given
image region but losslessly preserves what is inside.  Like the rotate and
flip transforms, lossless crop is restricted by the current JPEG format: the
upper left corner of the selected region must fall on an iMCU boundary.  If
this does not hold for the given crop parameters, we silently move the upper
left corner up and/or left to make it so, simultaneously increasing the
region dimensions to keep the lower right crop corner unchanged.  (Thus, the
output image covers at least the requested region, but may cover more.)
The adjustment of the region dimensions may be optionally disabled.

The image can be losslessly cropped by giving the switch:
	-crop WxH+X+Y	Crop to a rectangular subarea of width W, height H
			starting at point X,Y.

A complementary lossless-wipe option is provided to discard (gray out) data
inside a given image region while losslessly preserving what is outside:
	-wipe WxH+X+Y	Wipe (gray out) a rectangular subarea of
			width W, height H starting at point X,Y.

Other not-strictly-lossless transformation switches are:

	-grayscale	Force grayscale output.
This option discards the chrominance channels if the input image is YCbCr
(ie, a standard color JPEG), resulting in a grayscale JPEG file.  The
luminance channel is preserved exactly, so this is a better method of reducing
to grayscale than decompression, conversion, and recompression.  This switch
is particularly handy for fixing a monochrome picture that was mistakenly
encoded as a color JPEG.  (In such a case, the space savings from getting rid
of the near-empty chroma channels won't be large; but the decoding time for
a grayscale JPEG is substantially less than that for a color JPEG.)

src/Source/LibJPEG/wrjpgcom.c  view on Meta::CPAN

  /* Scan miscellaneous markers until we reach SOFn. */
  for (;;) {
    marker = next_marker();
    switch (marker) {
      /* Note that marker codes 0xC4, 0xC8, 0xCC are not, and must not be,
       * treated as SOFn.  C4 in particular is actually DHT.
       */
    case M_SOF0:		/* Baseline */
    case M_SOF1:		/* Extended sequential, Huffman */
    case M_SOF2:		/* Progressive, Huffman */
    case M_SOF3:		/* Lossless, Huffman */
    case M_SOF5:		/* Differential sequential, Huffman */
    case M_SOF6:		/* Differential progressive, Huffman */
    case M_SOF7:		/* Differential lossless, Huffman */
    case M_SOF9:		/* Extended sequential, arithmetic */
    case M_SOF10:		/* Progressive, arithmetic */
    case M_SOF11:		/* Lossless, arithmetic */
    case M_SOF13:		/* Differential sequential, arithmetic */
    case M_SOF14:		/* Differential progressive, arithmetic */
    case M_SOF15:		/* Differential lossless, arithmetic */
      return marker;

    case M_SOS:			/* should not see compressed data before SOF */
      ERREXIT("SOS without prior SOFn");
      break;

    case M_EOI:			/* in case it's a tables-only JPEG stream */
      return marker;

    case M_COM:			/* Existing COM: conditionally discard */

src/Source/LibJXR/image/decode/strInvTransform.c  view on Meta::CPAN

        PixelI* const p1 = pSC->p1MBbuffer[1 + i];//(0 == i ? pSC->pU1 : pSC->pV1);

        Int iHPQP = 255;
        if (!bHPAbsent)
            iHPQP = pSC->pTile[pSC->cTileColumn].pQuantizerHP[i][pSC->MBInfo.iQIndexHP].iQP;

        //========================================
        // second level inverse transform (422_UV)
        if ((!bottomORright) && pSC->m_Dparam->cThumbnailScale < 16)
        {
            // 1D lossless HT
            p1[0]  -= ((p1[32] + 1) >> 1);
            p1[32] += p1[0];

            if (!pSC->m_param.bScaledArith) {
                strDCT2x2dn(p1 +  0, p1 + 64, p1 + 16, p1 +  80);
                strDCT2x2dn(p1 + 32, p1 + 96, p1 + 48, p1 + 112);
            }
            else {
                strDCT2x2dnDec(p1 +  0, p1 + 64, p1 + 16, p1 +  80);
                strDCT2x2dnDec(p1 + 32, p1 + 96, p1 + 48, p1 + 112);

src/Source/LibJXR/image/decode/strInvTransform.c  view on Meta::CPAN

    // 422_UV
    for (i = 0; i < (YUV_422 == cfColorFormat? 2U : 0U) && tScale < 16; ++i)
    {
        PixelI* const p0 = pSC->p0MBbuffer[1 + i];//(0 == i ? pSC->pU0 : pSC->pV0);
        PixelI* const p1 = pSC->p1MBbuffer[1 + i];//(0 == i ? pSC->pU1 : pSC->pV1);

        //========================================
        // second level inverse transform (422_UV)
        if ((!bottomORright) && pSC->m_Dparam->cThumbnailScale < 16)
        {
            // 1D lossless HT
            p1[0]  -= ((p1[32] + 1) >> 1);
            p1[32] += p1[0];

            if (!pSC->m_param.bScaledArith) {
                strDCT2x2dn(p1 +  0, p1 + 64, p1 + 16, p1 +  80);
                strDCT2x2dn(p1 + 32, p1 + 96, p1 + 48, p1 + 112);
            }
            else {
                strDCT2x2dnDec(p1 +  0, p1 + 64, p1 + 16, p1 +  80);
                strDCT2x2dnDec(p1 + 32, p1 + 96, p1 + 48, p1 + 112);

src/Source/LibJXR/image/decode/strdec.c  view on Meta::CPAN

    Read header of image plane
*************************************************************************/
Int ReadImagePlaneHeader(CWMImageInfo* pII, CWMIStrCodecParam *pSCP,
    CCoreParameters *pSC, SimpleBitIO* pSB)
{
    ERR err = WMP_errSuccess;

    pSC->cfColorFormat = getBit32_SB(pSB, 3); // internal color format
    FailIf((pSC->cfColorFormat < Y_ONLY || pSC->cfColorFormat > NCOMPONENT), WMP_errUnsupportedFormat);
    pSCP->cfColorFormat = pSC->cfColorFormat;  // this should be removed later
    pSC->bScaledArith = getBit32_SB(pSB, 1); // lossless mode

    // subbands
    pSCP->sbSubband = getBit32_SB(pSB, 4);

// color parameters
    switch (pSC->cfColorFormat) {
        case Y_ONLY:
            pSC->cNumChannels = 1;
            break;
        case YUV_420:

src/Source/LibJXR/image/decode/strdec_x86.c  view on Meta::CPAN

        //================
        pop esp
        pop edi
        pop esi
        pop ebx
        pop ebp
        ret 20
    }
}

Int outputMBRow_RGB24_Lossless_1(CWMImageStrCodec* pSC)
{
#ifdef REENTRANT_MODE
    const size_t cHeight = min((pSC->m_Dparam->cROIBottomY + 1) - (pSC->cRow - 1) * 16, 16);
    const size_t iFirstRow = ((pSC->cRow - 1) * 16 > pSC->m_Dparam->cROITopY ? 0 : (pSC->m_Dparam->cROITopY & 0xf));
#endif
    const size_t cbRGB = pSC->WMIBI.cbStride;
    const U8* const pbRGB = (U8*)pSC->WMIBI.pv + cbRGB * (pSC->cRow - 1) * 16;

    U8* const pbY = (U8*)pSC->a0MBbuffer[0];
    U8* const pbU = (U8*)pSC->a0MBbuffer[1];

src/Source/LibJXR/image/decode/strdec_x86.c  view on Meta::CPAN

            pSC->m_Dparam->bDecodeFullFrame &&
            1)
        {
#if defined(WMP_OPT_CC_DEC)
            if (pSC->m_param.bScaledArith || pSC->WMISCP.olOverlap != OL_NONE)
            {
                pSC->Load = outputMBRow_RGB24_Lossy_3;
            }
            else
            {
                pSC->Load = outputMBRow_RGB24_Lossless_1;
            }
#endif // WMP_OPT_CC_DEC
        }

        if (YUV_444 == pSC->m_param.cfColorFormat &&
            pSC->p1MBbuffer[1] - pSC->p1MBbuffer[0] == pSC->p1MBbuffer[2] - pSC->p1MBbuffer[1] &&
            pSC->m_Dparam->bDecodeFullWidth &&
            pSC->m_param.cSubVersion == CODEC_SUBVERSION_NEWSCALING_SOFT_TILES &&
            1 == pSC->m_Dparam->cThumbnailScale)
        {

src/Source/LibJXR/image/encode/strFwdTransform.c  view on Meta::CPAN

        {
            if (!pSC->m_param.bScaledArith) {
                strDCT2x2dn(p0 - 128, p0 - 64, p0 - 112, p0 - 48);
                strDCT2x2dn(p0 -  96, p0 - 32, p0 -  80, p0 - 16);
            }
            else {
                strDCT2x2dnEnc(p0 - 128, p0 - 64, p0 - 112, p0 - 48);
                strDCT2x2dnEnc(p0 -  96, p0 - 32, p0 -  80, p0 - 16);
            }

            // 1D lossless HT
            p0[- 96] -= p0[-128];
            p0[-128] += ((p0[-96] + 1) >> 1);
        }
    }
    assert(NULL == p);
}

src/Source/LibJXR/image/encode/strenc.c  view on Meta::CPAN

/*************************************************************************
    Write header of image plane
*************************************************************************/
Int WriteImagePlaneHeader(CWMImageStrCodec * pSC)
{
    CWMImageInfo * pII = &pSC->WMII;
    CWMIStrCodecParam * pSCP = &pSC->WMISCP;
    BitIOInfo* pIO = pSC->pIOHeader;

    PUTBITS(pIO, (Int) pSC->m_param.cfColorFormat, 3); // internal color format
    PUTBITS(pIO, (Int) pSC->m_param.bScaledArith, 1); // lossless mode

// subbands
    PUTBITS(pIO, (U32)pSCP->sbSubband, 4);

// color parameters
    switch (pSC->m_param.cfColorFormat) {
        case YUV_420:
        case YUV_422:
        case YUV_444:
            PUTBITS(pIO, 0, 4);

src/Source/LibJXR/image/encode/strenc.c  view on Meta::CPAN

    pSC->cTileColumn = pSC->cTileRow = 0;

    if(allocateTileInfo(pSC) != ICERR_OK)
        return ICERR_ERROR;

    if(pSC->m_param.bTranscode == FALSE){
        pSC->m_param.uQPMode = 0x150;   // 101010 000
                                        // 000    == uniform (not per tile) DC, LP, HP
                                        // 101010 == cChMode == 2 == independent (not same) DC, LP, HP

        /** lossless or Y component lossless condition: all subbands present, uniform quantization with QPIndex 1 **/
        pSC->m_param.bScaledArith = !((pSC->m_param.uQPMode & 7) == 0 && 
									  1 == pSC->WMISCP.uiDefaultQPIndex <= 1 && 
									  pSC->WMISCP.sbSubband == SB_ALL && 
									  pSC->m_bUVResolutionChange == FALSE) &&
                                     !pSC->WMISCP.bUnscaledArith;
        if (BD_32 == pSC->WMII.bdBitDepth || BD_32S == pSC->WMII.bdBitDepth || BD_32F == pSC->WMII.bdBitDepth) {
            pSC->m_param.bScaledArith = FALSE;
        }
        pSC->m_param.uQPMode |= 0x600;  // don't use DC QP for LP, LP QP for HP

src/Source/LibJXR/image/encode/strenc.c  view on Meta::CPAN

			pSC->WMISCP.uiDefaultQPIndexULP: iQPIndexU; 
        iQPIndexVLP = pSC->WMISCP.uiDefaultQPIndexVLP!=0? 
			pSC->WMISCP.uiDefaultQPIndexVLP: iQPIndexV; 

		// determine the U,V HP index
        iQPIndexUHP = pSC->WMISCP.uiDefaultQPIndexUHP!=0? 
			pSC->WMISCP.uiDefaultQPIndexUHP: iQPIndexU; 
        iQPIndexVHP = pSC->WMISCP.uiDefaultQPIndexVHP!=0? 
			pSC->WMISCP.uiDefaultQPIndexVHP: iQPIndexV; 

		// clamp the QPIndex - 0 is lossless mode
        if(iQPIndexY < 2)
            iQPIndexY = 0;
        if (iQPIndexYLP < 2)
            iQPIndexYLP = 0;
        if (iQPIndexYHP < 2)
            iQPIndexYHP = 0;
		if(iQPIndexU < 2)
            iQPIndexU = 0;
        if (iQPIndexULP < 2)
            iQPIndexULP = 0;

src/Source/LibJXR/image/sys/strPredQuant.c  view on Meta::CPAN


/* reciprocal (pMantissa, exponent) lookup table */
typedef struct tagQPManExp
{
    int iMan;
    int iExp;
} QPManExp;

static QPManExp gs_QPRecipTable[32] = {
    {0x0, 0}, // 0, invalid
    {0x0, 0}, // 1, lossless
    {0x0, 1}, // 2
    {0xaaaaaaab, 1},
    {0x0, 2}, // 4
    {0xcccccccd, 2},
    {0xaaaaaaab, 2},
    {0x92492493, 2},
    {0x0, 3}, // 8
    {0xe38e38e4, 3},
    {0xcccccccd, 3},
    {0xba2e8ba3, 3},

src/Source/LibJXR/image/sys/strPredQuant.c  view on Meta::CPAN

};

/*************************************************************************
    QPRemapping
*************************************************************************/

Void remapQP(CWMIQuantizer * pQP, I32 iShift, Bool bScaledArith)
{
    U8 uiQPIndex = pQP->iIndex;

    if(uiQPIndex == 0) // Lossless mode!
        pQP->iQP = 1, pQP->iMan = pQP->iExp = pQP->iOffset = 0;
    else if (!bScaledArith) {
        I32 man = 0, exp = 0;
        const I32 ciShift = SHIFTZERO - (SHIFTZERO + QPFRACBITS); // == -QPFRACBITS

        if (pQP->iIndex < 32)
            man = (pQP->iIndex + 3) >> 2, exp = ciShift + 2;
        else if (pQP->iIndex < 48)
            man = (16 + (pQP->iIndex & 0xf) + 1) >> 1, exp = ((pQP->iIndex >> 4) - 1) + 1 + ciShift;
        else



( run in 1.376 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )