view release on metacpan or search on metacpan
src/README.osx view on Meta::CPAN
To clean all files produced during the build process:
make clean
Additional notes
----------------
Building on Mac OS X Leopard :
Install the xcode dev tools from the Leopard disk.
When installing the dev tools make sure to have installed 10.3.9 SDK (it's not selected by default).
src/Source/FreeImage/Halftoning.cpp view on Meta::CPAN
int width, height;
BYTE *bits, *new_bits;
FIBITMAP *new_dib = NULL;
// allocate a 8-bit DIB
width = FreeImage_GetWidth(dib);
height = FreeImage_GetHeight(dib);
new_dib = FreeImage_Allocate(width, height, 8);
if(NULL == new_dib) return NULL;
// select the dithering matrix
int *matrix = NULL;
switch(order) {
case 3:
matrix = &cluster3[0];
break;
case 4:
matrix = &cluster4[0];
break;
case 8:
matrix = &cluster8[0];
src/Source/FreeImage/PSDParser.h view on Meta::CPAN
/**
Table A-7: DisplayInfo Color spaces
This structure contains display information about each channel. It is written as an image resource.
*/
class psdDisplayInfo {
public:
short _ColourSpace;
short _Colour[4];
short _Opacity; //! 0..100
BYTE _Kind; //! selected = 0, protected = 1
BYTE _padding; //! should be zero
public:
psdDisplayInfo();
~psdDisplayInfo();
/**
@return Returns the number of bytes read
*/
int Read(FreeImageIO *io, fi_handle handle);
};
src/Source/FreeImage/PluginDDS.cpp view on Meta::CPAN
// allocate a 32-bit dib
FIBITMAP *dib = FreeImage_Allocate (width, height, 32, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
if (dib == NULL)
return NULL;
int bpp = FreeImage_GetBPP (dib);
int line = CalculateLine (width, bpp);
BYTE *bits = FreeImage_GetBits (dib);
// select the right decoder
switch (type) {
case 1:
LoadDXT_Helper <DXT_BLOCKDECODER_1> (io, handle, page, flags, data, dib, width, height, line);
break;
case 3:
LoadDXT_Helper <DXT_BLOCKDECODER_3> (io, handle, page, flags, data, dib, width, height, line);
break;
case 5:
LoadDXT_Helper <DXT_BLOCKDECODER_5> (io, handle, page, flags, data, dib, width, height, line);
break;
src/Source/FreeImage/PluginPNG.cpp view on Meta::CPAN
png_uint_32 res_x = (png_uint_32)FreeImage_GetDotsPerMeterX(dib);
png_uint_32 res_y = (png_uint_32)FreeImage_GetDotsPerMeterY(dib);
if ((res_x > 0) && (res_y > 0)) {
png_set_pHYs(png_ptr, info_ptr, res_x, res_y, PNG_RESOLUTION_METER);
}
// Set the image information here. Width and height are up to 2^31,
// bit_depth is one of 1, 2, 4, 8, or 16, but valid values also depend on
// the color_type selected. color_type is one of PNG_COLOR_TYPE_GRAY,
// PNG_COLOR_TYPE_GRAY_ALPHA, PNG_COLOR_TYPE_PALETTE, PNG_COLOR_TYPE_RGB,
// or PNG_COLOR_TYPE_RGB_ALPHA. interlace is either PNG_INTERLACE_NONE or
// PNG_INTERLACE_ADAM7, and the compression_type and filter_type MUST
// currently be PNG_COMPRESSION_TYPE_BASE and PNG_FILTER_TYPE_BASE. REQUIRED
width = FreeImage_GetWidth(dib);
height = FreeImage_GetHeight(dib);
pixel_depth = FreeImage_GetBPP(dib);
BOOL bInterlaced = FALSE;
src/Source/FreeImage/PluginRAW.cpp view on Meta::CPAN
}
// wrap the input datastream
LibRaw_freeimage_datastream datastream(io, handle);
// set decoding parameters
// the following parameters affect data reading
// --------------------------------------------
// (-s [0..N-1]) Select one raw image from input file
RawProcessor->imgdata.params.shot_select = 0;
// (-w) Use camera white balance, if possible (otherwise, fallback to auto_wb)
RawProcessor->imgdata.params.use_camera_wb = 1;
// (-M) Use any color matrix from the camera metadata. This option only affects Olympus, Leaf, and Phase One cameras.
RawProcessor->imgdata.params.use_camera_matrix = 1;
// (-h) outputs the image in 50% size
RawProcessor->imgdata.params.half_size = ((flags & RAW_HALFSIZE) == RAW_HALFSIZE) ? 1 : 0;
// open the datastream
if(RawProcessor->open_datastream(&datastream) != LIBRAW_SUCCESS) {
throw "LibRaw : failed to open input stream (unknown format)";
src/Source/FreeImageToolkit/BSplineRotate.cpp view on Meta::CPAN
}
return(Sum / (1.0 - zn * zn));
}
}
/**
GetColumn
@param Image Input image array
@param Width Width of the image
@param x x coordinate of the selected line
@param Line Output linear array
@param Height Length of the line
*/
static void
GetColumn(double *Image, long Width, long x, double *Line, long Height) {
long y;
Image = Image + x;
for(y = 0L; y < Height; y++) {
Line[y] = (double)*Image;
Image += Width;
}
}
/**
GetRow
@param Image Input image array
@param y y coordinate of the selected line
@param Line Output linear array
@param Width Length of the line
*/
static void
GetRow(double *Image, long y, double *Line, long Width) {
long x;
Image = Image + (y * Width);
for(x = 0L; x < Width; x++) {
Line[x] = (double)*Image++;
src/Source/FreeImageToolkit/BSplineRotate.cpp view on Meta::CPAN
InitialAntiCausalCoefficient(double *c, long DataLength, double z) {
// this initialization corresponds to mirror boundaries
return((z / (z * z - 1.0)) * (z * c[DataLength - 2L] + c[DataLength - 1L]));
}
/**
PutColumn
@param Image Output image array
@param Width Width of the image
@param x x coordinate of the selected line
@param Line Input linear array
@param Height Length of the line and height of the image
*/
static void
PutColumn(double *Image, long Width, long x, double *Line, long Height) {
long y;
Image = Image + x;
for(y = 0L; y < Height; y++) {
*Image = (double)Line[y];
Image += Width;
}
}
/**
PutRow
@param Image Output image array
@param y y coordinate of the selected line
@param Line Input linear array
@param Width length of the line and width of the image
*/
static void
PutRow(double *Image, long y, double *Line, long Width) {
long x;
Image = Image + (y * Width);
for(x = 0L; x < Width; x++) {
*Image++ = (double)Line[x];
src/Source/FreeImageToolkit/Background.cpp view on Meta::CPAN
@param red_mask Specifies the bits used to store the red components of a pixel.
@param green_mask Specifies the bits used to store the green components of a pixel.
@param blue_mask Specifies the bits used to store the blue components of a pixel.
@return Returns a pointer to a newly allocated image on success, NULL otherwise.
*/
FIBITMAP * DLL_CALLCONV
FreeImage_AllocateEx(int width, int height, int bpp, const RGBQUAD *color, int options, const RGBQUAD *palette, unsigned red_mask, unsigned green_mask, unsigned blue_mask) {
return FreeImage_AllocateExT(FIT_BITMAP, width, height, bpp, ((void *)color), options, palette, red_mask, green_mask, blue_mask);
}
/** @brief Enlarges or shrinks an image selectively per side and fills newly added areas
with the specified background color.
This function enlarges or shrinks an image selectively per side. The main purpose of this
function is to add borders to an image. To add a border to any of the image's sides, a
positive integer value must be passed in any of the parameters left, top, right or bottom.
This value represents the border's width in pixels. Newly created parts of the image (the
border areas) are filled with the specified color. Specifying a negative integer value for
a certain side, will shrink or crop the image on this side. Consequently, specifying zero
for a certain side will not change the image's extension on that side.
So, calling this function with all parameters left, top, right and bottom set to zero, is
effectively the same as calling function FreeImage_Clone; setting all parameters left, top,
right and bottom to value equal to or smaller than zero, my easily be substituted by a call
src/Source/FreeImageToolkit/Channels.cpp view on Meta::CPAN
if(!FreeImage_HasPixels(src)) return NULL;
FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(src);
unsigned bpp = FreeImage_GetBPP(src);
// 24- or 32-bit
if(image_type == FIT_BITMAP && ((bpp == 24) || (bpp == 32))) {
int c;
// select the channel to extract
switch(channel) {
case FICC_BLUE:
c = FI_RGBA_BLUE;
break;
case FICC_GREEN:
c = FI_RGBA_GREEN;
break;
case FICC_RED:
c = FI_RGBA_RED;
break;
src/Source/FreeImageToolkit/Channels.cpp view on Meta::CPAN
// copy metadata from src to dst
FreeImage_CloneMetadata(dst, src);
return dst;
}
// 48-bit RGB or 64-bit RGBA images
if((image_type == FIT_RGB16) || (image_type == FIT_RGBA16)) {
int c;
// select the channel to extract (always RGB[A])
switch(channel) {
case FICC_BLUE:
c = 2;
break;
case FICC_GREEN:
c = 1;
break;
case FICC_RED:
c = 0;
break;
src/Source/FreeImageToolkit/Channels.cpp view on Meta::CPAN
// copy metadata from src to dst
FreeImage_CloneMetadata(dst, src);
return dst;
}
// 96-bit RGBF or 128-bit RGBAF images
if((image_type == FIT_RGBF) || (image_type == FIT_RGBAF)) {
int c;
// select the channel to extract (always RGB[A])
switch(channel) {
case FICC_BLUE:
c = 2;
break;
case FICC_GREEN:
c = 1;
break;
case FICC_RED:
c = 0;
break;
src/Source/FreeImageToolkit/Channels.cpp view on Meta::CPAN
if((dst_image_type == FIT_BITMAP) && (src_image_type == FIT_BITMAP)) {
// src image should be grayscale, dst image should be 24- or 32-bit
unsigned src_bpp = FreeImage_GetBPP(src);
unsigned dst_bpp = FreeImage_GetBPP(dst);
if((src_bpp != 8) || (dst_bpp != 24) && (dst_bpp != 32))
return FALSE;
// select the channel to modify
switch(channel) {
case FICC_BLUE:
c = FI_RGBA_BLUE;
break;
case FICC_GREEN:
c = FI_RGBA_GREEN;
break;
case FICC_RED:
c = FI_RGBA_RED;
break;
src/Source/FreeImageToolkit/Channels.cpp view on Meta::CPAN
if(((dst_image_type == FIT_RGB16) || (dst_image_type == FIT_RGBA16)) && (src_image_type == FIT_UINT16)) {
// src image should be grayscale, dst image should be 48- or 64-bit
unsigned src_bpp = FreeImage_GetBPP(src);
unsigned dst_bpp = FreeImage_GetBPP(dst);
if((src_bpp != 16) || (dst_bpp != 48) && (dst_bpp != 64))
return FALSE;
// select the channel to modify (always RGB[A])
switch(channel) {
case FICC_BLUE:
c = 2;
break;
case FICC_GREEN:
c = 1;
break;
case FICC_RED:
c = 0;
break;
src/Source/FreeImageToolkit/Channels.cpp view on Meta::CPAN
if(((dst_image_type == FIT_RGBF) || (dst_image_type == FIT_RGBAF)) && (src_image_type == FIT_FLOAT)) {
// src image should be grayscale, dst image should be 96- or 128-bit
unsigned src_bpp = FreeImage_GetBPP(src);
unsigned dst_bpp = FreeImage_GetBPP(dst);
if((src_bpp != 32) || (dst_bpp != 96) && (dst_bpp != 128))
return FALSE;
// select the channel to modify (always RGB[A])
switch(channel) {
case FICC_BLUE:
c = 2;
break;
case FICC_GREEN:
c = 1;
break;
case FICC_RED:
c = 0;
break;
src/Source/FreeImageToolkit/Channels.cpp view on Meta::CPAN
return FALSE;
// src and dst images should have the same width and height
unsigned src_width = FreeImage_GetWidth(src);
unsigned src_height = FreeImage_GetHeight(src);
unsigned dst_width = FreeImage_GetWidth(dst);
unsigned dst_height = FreeImage_GetHeight(dst);
if((src_width != dst_width) || (src_height != dst_height))
return FALSE;
// select the channel to modify
switch(channel) {
case FICC_REAL: // real part
for(y = 0; y < dst_height; y++) {
src_bits = (double *)FreeImage_GetScanLine(src, y);
dst_bits = (FICOMPLEX *)FreeImage_GetScanLine(dst, y);
for(x = 0; x < dst_width; x++) {
dst_bits[x].r = src_bits[x];
}
}
break;
src/Source/FreeImageToolkit/Rescale.cpp view on Meta::CPAN
}
if (src_bottom < src_top) {
INPLACESWAP(src_top, src_bottom);
}
// check the size of the sub image
if((src_left < 0) || (src_right > src_width) || (src_top < 0) || (src_bottom > src_height)) {
return NULL;
}
// select the filter
CGenericFilter *pFilter = NULL;
switch (filter) {
case FILTER_BOX:
pFilter = new(std::nothrow) CBoxFilter();
break;
case FILTER_BICUBIC:
pFilter = new(std::nothrow) CBicubicFilter();
break;
case FILTER_BILINEAR:
pFilter = new(std::nothrow) CBilinearFilter();
src/Source/FreeImageToolkit/Resize.cpp view on Meta::CPAN
FreeImage_Unload(tmp);
}
} else {
// yx filtering
// -------------
// Remark:
// The yx filtering branch could be more optimized by taking into,
// account that (src_width != dst_width) is always true, which
// follows from the above condition, which selects filtering order.
// Since (dst_width <= src_width) == TRUE selects xy filtering,
// both widths must be different when performing yx filtering.
// However, to make the code more robust, not depending on that
// condition and more symmetric to the xy filtering case, these
// (src_width != dst_width) conditions are still in place.
FIBITMAP *tmp = NULL;
if (src_height != dst_height) {
// source and destination heights are different so, we must
// filter vertically
src/Source/LibJPEG/cdjpeg.h view on Meta::CPAN
#define set_quant_slots SetQSlots
#define set_sample_factors SetSFacts
#define read_color_map RdCMap
#define enable_signal_catcher EnSigCatcher
#define start_progress_monitor StProgMon
#define end_progress_monitor EnProgMon
#define read_stdin RdStdin
#define write_stdout WrStdout
#endif /* NEED_SHORT_EXTERNAL_NAMES */
/* Module selection routines for I/O modules. */
EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo));
EXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_ptr cinfo,
boolean is_os2));
EXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo));
EXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo));
EXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo));
EXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo));
EXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo));
EXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo));
src/Source/LibJPEG/cjpeg.c view on Meta::CPAN
#define JMESSAGE(code,string) string ,
static const char * const cdjpeg_message_table[] = {
#include "cderror.h"
NULL
};
/*
* This routine determines what format the input file is,
* and selects the appropriate input-reading module.
*
* To determine which family of input formats the file belongs to,
* we may look only at the first byte of the file, since C does not
* guarantee that more than one character can be pushed back with ungetc.
* Looking at additional bytes would require one of these approaches:
* 1) assume we can fseek() the input file (fails for piped input);
* 2) assume we can push back more than one character (works in
* some C implementations, but unportable);
* 3) provide our own buffering (breaks input readers that want to use
* stdio directly, such as the RLE library);
src/Source/LibJPEG/cjpeg.c view on Meta::CPAN
* We presently apply this method for Targa files. Most of the time Targa
* files start with 0x00, so we recognize that case. Potentially, however,
* a Targa file could start with any byte value (byte 0 is the length of the
* seldom-used ID field), so we provide a switch to force Targa input mode.
*/
static boolean is_targa; /* records user -targa switch */
LOCAL(cjpeg_source_ptr)
select_file_type (j_compress_ptr cinfo, FILE * infile)
{
int c;
if (is_targa) {
#ifdef TARGA_SUPPORTED
return jinit_read_targa(cinfo);
#else
ERREXIT(cinfo, JERR_TGA_NOTCOMP);
#endif
}
src/Source/LibJPEG/cjpeg.c view on Meta::CPAN
} else {
usage(); /* bogus switch */
}
}
/* Post-switch-scanning cleanup */
if (for_real) {
/* Set quantization tables for selected quality. */
/* Some or all may be overridden if -qtables is present. */
if (qualityarg != NULL) /* process -quality if it was present */
if (! set_quality_ratings(cinfo, qualityarg, force_baseline))
usage();
if (qtablefile != NULL) /* process -qtables if it was present */
if (! read_quant_tables(cinfo, qtablefile, force_baseline))
usage();
if (qslotsarg != NULL) /* process -qslots if it was present */
src/Source/LibJPEG/cjpeg.c view on Meta::CPAN
} else {
/* default output file is stdout */
output_file = write_stdout();
}
#ifdef PROGRESS_REPORT
start_progress_monitor((j_common_ptr) &cinfo, &progress);
#endif
/* Figure out the input file format, and set up to read it. */
src_mgr = select_file_type(&cinfo, input_file);
src_mgr->input_file = input_file;
/* Read the input file header to obtain file size & colorspace. */
(*src_mgr->start_input) (&cinfo, src_mgr);
/* Now that we know input colorspace, fix colorspace-dependent defaults */
jpeg_default_colorspace(&cinfo);
/* Adjust default compression parameters by re-parsing the options */
file_index = parse_switches(&cinfo, argc, argv, 0, TRUE);
src/Source/LibJPEG/djpeg.c view on Meta::CPAN
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
/* Add some application-specific error messages (from cderror.h) */
jerr.addon_message_table = cdjpeg_message_table;
jerr.first_addon_message = JMSG_FIRSTADDONCODE;
jerr.last_addon_message = JMSG_LASTADDONCODE;
/* Insert custom marker processor for COM and APP12.
* APP12 is used by some digital camera makers for textual info,
* so we provide the ability to display it as text.
* If you like, additional APPn marker types can be selected for display,
* but don't try to override APP0 or APP14 this way (see libjpeg.doc).
*/
jpeg_set_marker_processor(&cinfo, JPEG_COM, print_text_marker);
jpeg_set_marker_processor(&cinfo, JPEG_APP0+12, print_text_marker);
/* Now safe to enable signal catcher. */
#ifdef NEED_SIGNAL_CATCHER
enable_signal_catcher((j_common_ptr) &cinfo);
#endif
src/Source/LibJPEG/filelist.txt view on Meta::CPAN
Compression side of the library:
jcinit.c Initialization: determines which other modules to use.
jcmaster.c Master control: setup and inter-pass sequencing logic.
jcmainct.c Main buffer controller (preprocessor => JPEG compressor).
jcprepct.c Preprocessor buffer controller.
jccoefct.c Buffer controller for DCT coefficient buffer.
jccolor.c Color space conversion.
jcsample.c Downsampling.
jcdctmgr.c DCT manager (DCT implementation selection & control).
jfdctint.c Forward DCT using slow-but-accurate integer method.
jfdctfst.c Forward DCT using faster, less accurate integer method.
jfdctflt.c Forward DCT using floating-point arithmetic.
jchuff.c Huffman entropy coding.
jcarith.c Arithmetic entropy coding.
jcmarker.c JPEG marker writing.
jdatadst.c Data destination managers for memory and stdio output.
Decompression side of the library:
jdmaster.c Master control: determines which other modules to use.
jdinput.c Input controller: controls input processing modules.
jdmainct.c Main buffer controller (JPEG decompressor => postprocessor).
jdcoefct.c Buffer controller for DCT coefficient buffer.
jdpostct.c Postprocessor buffer controller.
jdmarker.c JPEG marker reading.
jdhuff.c Huffman entropy decoding.
jdarith.c Arithmetic entropy decoding.
jddctmgr.c IDCT manager (IDCT implementation selection & control).
jidctint.c Inverse DCT using slow-but-accurate integer method.
jidctfst.c Inverse DCT using faster, less accurate integer method.
jidctflt.c Inverse DCT using floating-point arithmetic.
jdsample.c Upsampling.
jdcolor.c Color space conversion.
jdmerge.c Merged upsampling/color conversion (faster, lower quality).
jquant1.c One-pass color quantization using a fixed-spacing colormap.
jquant2.c Two-pass color quantization using a custom-generated colormap.
Also handles one-pass quantization to an externally given map.
jdatasrc.c Data source managers for memory and stdio input.
src/Source/LibJPEG/install.txt view on Meta::CPAN
* Configure will build both static and shared libraries, if possible.
If you want to build libjpeg only as a static library, say
./configure --disable-shared
If you want to build libjpeg only as a shared library, say
./configure --disable-static
Configure uses GNU libtool to take care of system-dependent shared library
building methods.
* Configure will use gcc (GNU C compiler) if it's available, otherwise cc.
To force a particular compiler to be selected, use the CC option, for example
./configure CC='cc'
The same method can be used to include any unusual compiler switches.
For example, on HP-UX you probably want to say
./configure CC='cc -Aa'
to get HP's compiler to run in ANSI mode.
* The default CFLAGS setting is "-g" for non-gcc compilers, "-g -O2" for gcc.
You can override this by saying, for example,
./configure CFLAGS='-O2'
if you want to compile without debugging support.
src/Source/LibJPEG/install.txt view on Meta::CPAN
ckconfig.c by hand --- we hope you know at least enough to do that.
ckconfig.c may not compile the first try (in fact, the whole idea is for it
to fail if anything is going to). If you get compile errors, fix them by
editing ckconfig.c according to the directions given in ckconfig.c. Once
you get it to run, it will write a suitable jconfig.h file, and will also
print out some advice about which makefile to use.
You may also want to look at the canned jconfig files, if there is one for a
system similar to yours.
Second, select a makefile and copy it to Makefile (or whatever your system
uses as the standard makefile name). The most generic makefiles we provide
are
makefile.ansi: if your C compiler supports function prototypes
makefile.unix: if not.
(You have function prototypes if ckconfig.c put "#define HAVE_PROTOTYPES"
in jconfig.h.) You may want to start from one of the other makefiles if
there is one for a system similar to yours.
Look over the selected Makefile and adjust options as needed. In particular
you may want to change the CC and CFLAGS definitions. For instance, if you
are using GCC, set CC=gcc. If you had to use any compiler switches to get
ckconfig.c to work, make sure the same switches are in CFLAGS.
If you are on a system that doesn't use makefiles, you'll need to set up
project files (or whatever you do use) to compile all the source files and
link them into executable files cjpeg, djpeg, jpegtran, rdjpgcom, and wrjpgcom.
See the file lists in any of the makefiles to find out which files go into
each program. Note that the provided makefiles all make a "library" file
libjpeg first, but you don't have to do that if you don't want to; the file
src/Source/LibJPEG/install.txt view on Meta::CPAN
code to do this is rather system-dependent. We provide five different
memory managers:
* jmemansi.c This version uses the ANSI-standard library routine tmpfile(),
which not all non-ANSI systems have. On some systems
tmpfile() may put the temporary file in a non-optimal
location; if you don't like what it does, use jmemname.c.
* jmemname.c This version creates named temporary files. For anything
except a Unix machine, you'll need to configure the
select_file_name() routine appropriately; see the comments
near the head of jmemname.c. If you use this version, define
NEED_SIGNAL_CATCHER in jconfig.h to make sure the temp files
are removed if the program is aborted.
* jmemnobs.c (That stands for No Backing Store :-).) This will compile on
almost any system, but it assumes you have enough main memory
or virtual memory to hold the biggest images you work with.
* jmemdos.c This should be used with most 16-bit MS-DOS compilers.
See the system-specific notes about MS-DOS for more info.
src/Source/LibJPEG/install.txt view on Meta::CPAN
notes for Macintosh for more info.
To use a particular memory manager, change the SYSDEPMEM variable in your
makefile to equal the corresponding object file name (for example, jmemansi.o
or jmemansi.obj for jmemansi.c).
If you have plenty of (real or virtual) main memory, just use jmemnobs.c.
"Plenty" means about ten bytes for every pixel in the largest images
you plan to process, so a lot of systems don't meet this criterion.
If yours doesn't, try jmemansi.c first. If that doesn't compile, you'll have
to use jmemname.c; be sure to adjust select_file_name() for local conditions.
You may also need to change unlink() to remove() in close_backing_store().
Except with jmemnobs.c or jmemmac.c, you need to adjust the DEFAULT_MAX_MEM
setting to a reasonable value for your system (either by adding a #define for
DEFAULT_MAX_MEM to jconfig.h, or by adding a -D switch to the Makefile).
This value limits the amount of data space the program will attempt to
allocate. Code and static data space isn't counted, so the actual memory
needs for cjpeg or djpeg are typically 100 to 150Kb more than the max-memory
setting. Larger max-memory settings reduce the amount of I/O needed to
process a large image, but too large a value can result in "insufficient
src/Source/LibJPEG/install.txt view on Meta::CPAN
2. In jconfig.h, undefine BMP_SUPPORTED, RLE_SUPPORTED, and TARGA_SUPPORTED,
because the code for those formats doesn't handle deeper than 8-bit data
and won't even compile. (The PPM code does work, as explained below.
The GIF code works too; it scales 8-bit GIF data to and from 12-bit
depth automatically.)
3. Compile. Don't expect "make test" to pass, since the supplied test
files are for 8-bit data.
Currently, 9-bit to 12-bit support does not work on 16-bit-int machines.
Run-time selection and conversion of data precision are currently not
supported and may be added later.
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 PPM reader (rdppm.c) can read deeper than 8-bit data from either
text-format or binary-format PPM and PGM files. Binary-format PPM/PGM files
which have a maxval greater than 255 are assumed to use 2 bytes per sample,
MSB first (big-endian order). As of early 1995, 2-byte binary format is not
officially supported by the PBMPLUS library, but it is expected that a
src/Source/LibJPEG/install.txt view on Meta::CPAN
standard 1-byte/sample PPM or PGM file. (Yes, this means still another copy
of djpeg to keep around. But hopefully you won't need it for very long.
Poskanzer's supposed to get that new PBMPLUS release out Real Soon Now.)
Of course, if you are working with 9-bit to 12-bit data, you probably have
it stored in some other, nonstandard format. In that case you'll probably
want to write your own I/O modules to read and write your format.
Note:
The standard Huffman tables are only valid for 8-bit data precision. If
you selected more than 8-bit data precision, cjpeg uses arithmetic coding
by default. The Huffman encoder normally uses entropy optimization to
compute usable tables for higher precision. Otherwise, you'll have to
supply different default Huffman tables.
Removing code:
If you need to make a smaller version of the JPEG software, some optional
functions can be removed at compile time. See the xxx_SUPPORTED #defines in
jconfig.h and jmorecfg.h. If at all possible, we recommend that you leave in
decoder support for all valid JPEG files, to ensure that you can read anyone's
src/Source/LibJPEG/install.txt view on Meta::CPAN
multiplication in C, but some compilers can generate one when you use the
right combination of casts. See the MULTIPLYxxx macro definitions in
jdct.h. If your compiler makes "int" be 32 bits and "short" be 16 bits,
defining SHORTxSHORT_32 is fairly likely to work. When experimenting with
alternate definitions, be sure to test not only whether the code still works
(use the self-test), but also whether it is actually faster --- on some
compilers, alternate definitions may compute the right answer, yet be slower
than the default. Timing cjpeg on a large PGM (grayscale) input file is the
best way to check this, as the DCT will be the largest fraction of the runtime
in that mode. (Note: some of the distributed compiler-specific jconfig files
already contain #define switches to select appropriate MULTIPLYxxx
definitions.)
If your machine has sufficiently fast floating point hardware, you may find
that the float DCT method is faster than the integer DCT methods, even
after tweaking the integer multiply macros. In that case you may want to
make the float DCT be the default method. (The only objection to this is
that float DCT results may vary slightly across machines.) To do that, add
"#define JDCT_DEFAULT JDCT_FLOAT" to jconfig.h. Even if you don't change
the default, you should redefine JDCT_FASTEST, which is the method selected
by djpeg's -fast switch. Don't forget to update the documentation files
(usage.txt and/or cjpeg.1, djpeg.1) to agree with what you've done.
If access to "short" arrays is slow on your machine, it may be a win to
define type JCOEF as int rather than short. This will cost a good deal of
memory though, particularly in some multi-pass modes, so don't do it unless
you have memory to burn and short is REALLY slow.
If your compiler can compile function calls in-line, make sure the INLINE
macro in jmorecfg.h is defined as the keyword that marks a function
src/Source/LibJPEG/install.txt view on Meta::CPAN
manager, with temporary files being created on the device named by
"JPEGTMP:".
Atari ST/STE/TT:
Copy the project files makcjpeg.st, makdjpeg.st, maktjpeg.st, and makljpeg.st
to cjpeg.prj, djpeg.prj, jpegtran.prj, and libjpeg.prj respectively. The
project files should work as-is with Pure C. For Turbo C, change library
filenames "pc..." to "tc..." in each project file. Note that libjpeg.prj
selects jmemansi.c as the recommended memory manager. You'll probably want to
adjust the DEFAULT_MAX_MEM setting --- you want it to be a couple hundred K
less than your normal free memory. Put "#define DEFAULT_MAX_MEM nnnn" into
jconfig.h to do this.
To use the 68881/68882 coprocessor for the floating point DCT, add the
compiler option "-8" to the project files and replace pcfltlib.lib with
pc881lib.lib in cjpeg.prj and djpeg.prj. Or if you don't have a
coprocessor, you may prefer to remove the float DCT code by undefining
DCT_FLOAT_SUPPORTED in jmorecfg.h (since without a coprocessor, the float
code will be too slow to be useful). In that case, you can delete
src/Source/LibJPEG/jcapimin.c view on Meta::CPAN
htbl->sent_table = suppress;
if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL)
htbl->sent_table = suppress;
}
}
/*
* Finish JPEG compression.
*
* If a multipass operating mode was selected, this may do a great deal of
* work including most of the actual output.
*/
GLOBAL(void)
jpeg_finish_compress (j_compress_ptr cinfo)
{
JDIMENSION iMCU_row;
if (cinfo->global_state == CSTATE_SCANNING ||
cinfo->global_state == CSTATE_RAW_OK) {
src/Source/LibJPEG/jcapistd.c view on Meta::CPAN
{
if (cinfo->global_state != CSTATE_START)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
if (write_all_tables)
jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */
/* (Re)initialize error mgr and destination modules */
(*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
(*cinfo->dest->init_destination) (cinfo);
/* Perform master selection of active modules */
jinit_compress_master(cinfo);
/* Set up for the first pass */
(*cinfo->master->prepare_for_pass) (cinfo);
/* Ready for application to drive first pass through jpeg_write_scanlines
* or jpeg_write_raw_data.
*/
cinfo->next_scanline = 0;
cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING);
}
src/Source/LibJPEG/jcarith.c view on Meta::CPAN
* (more probable symbol) in the highest bit (mask 0x80), and the
* index into the probability estimation state machine table
* in the lower bits (mask 0x7F).
*/
#define DC_STAT_BINS 64
#define AC_STAT_BINS 256
/* NOTE: Uncomment the following #define if you want to use the
* given formula for calculating the AC conditioning parameter Kx
* for spectral selection progressive coding in section G.1.3.2
* of the spec (Kx = Kmin + SRL (8 + Se - Kmin) 4).
* Although the spec and P&M authors claim that this "has proven
* to give good results for 8 bit precision samples", I'm not
* convinced yet that this is really beneficial.
* Early tests gave only very marginal compression enhancements
* (a few - around 5 or so - bytes even for very large files),
* which would turn out rather negative if we'd suppress the
* DAC (Define Arithmetic Conditioning) marker segments for
* the default parameters in the future.
* Note that currently the marker writing module emits 12-byte
src/Source/LibJPEG/jcarith.c view on Meta::CPAN
entropy->c = 0;
entropy->a = 0x10000L;
entropy->sc = 0;
entropy->zc = 0;
entropy->ct = 11;
entropy->buffer = -1; /* empty */
}
/*
* MCU encoding for DC initial scan (either spectral selection,
* or first pass of successive approximation).
*/
METHODDEF(boolean)
encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
unsigned char *st;
int blkn, ci, tbl;
int v, v2, m;
src/Source/LibJPEG/jcarith.c view on Meta::CPAN
while (m >>= 1)
arith_encode(cinfo, st, (m & v) ? 1 : 0);
}
}
return TRUE;
}
/*
* MCU encoding for AC initial scan (either spectral selection,
* or first pass of successive approximation).
*/
METHODDEF(boolean)
encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
const int * natural_order;
JBLOCKROW block;
unsigned char *st;
src/Source/LibJPEG/jcdctmgr.c view on Meta::CPAN
/*
* jcdctmgr.c
*
* Copyright (C) 1994-1996, Thomas G. Lane.
* Modified 2003-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains the forward-DCT management logic.
* This code selects a particular DCT implementation to be used,
* and it performs related housekeeping chores including coefficient
* quantization.
*/
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
#include "jdct.h" /* Private declarations for DCT subsystem */
src/Source/LibJPEG/jchuff.c view on Meta::CPAN
entropy->saved.last_dc_val[ci] = 0;
} else {
/* Re-initialize all AC-related fields to 0 */
entropy->EOBRUN = 0;
entropy->BE = 0;
}
}
/*
* MCU encoding for DC initial scan (either spectral selection,
* or first pass of successive approximation).
*/
METHODDEF(boolean)
encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
register int temp, temp2;
register int nbits;
int blkn, ci, tbl;
src/Source/LibJPEG/jchuff.c view on Meta::CPAN
entropy->next_restart_num &= 7;
}
entropy->restarts_to_go--;
}
return TRUE;
}
/*
* MCU encoding for AC initial scan (either spectral selection,
* or first pass of successive approximation).
*/
METHODDEF(boolean)
encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
{
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
const int * natural_order;
JBLOCKROW block;
register int temp, temp2;
src/Source/LibJPEG/jcinit.c view on Meta::CPAN
/*
* jcinit.c
*
* Copyright (C) 1991-1997, Thomas G. Lane.
* Modified 2003-2013 by Guido Vollbeding.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains initialization logic for the JPEG compressor.
* This routine is in charge of selecting the modules to be executed and
* making an initialization call to each one.
*
* Logically, this code belongs in jcmaster.c. It's split out because
* linking this routine implies linking the entire compression library.
* For a transcoding-only application, we want to be able to use jcmaster.c
* without linking in the whole library.
*/
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
/*
* Master selection of compression modules.
* This is done once at the start of processing an image. We determine
* which modules will be used and give them appropriate initialization calls.
*/
GLOBAL(void)
jinit_compress_master (j_compress_ptr cinfo)
{
long samplesperrow;
JDIMENSION jd_samplesperrow;
src/Source/LibJPEG/jcmaster.c view on Meta::CPAN
*/
/*
* Compute JPEG 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_calc_jpeg_dimensions (j_compress_ptr cinfo)
/* Do computations that are needed before master selection phase */
{
#ifdef DCT_SCALING_SUPPORTED
/* Sanity check on input image dimensions to prevent overflow in
* following calculation.
* We do check jpeg_width and jpeg_height in initial_setup below,
* but image_width and image_height can come from arbitrary data,
* and we need some space for multiplication by block_size.
*/
if (((long) cinfo->image_width >> 24) || ((long) cinfo->image_height >> 24))
src/Source/LibJPEG/jcmaster.c view on Meta::CPAN
if (cinfo->min_DCT_h_scaled_size != cinfo->min_DCT_v_scaled_size)
ERREXIT2(cinfo, JERR_BAD_DCTSIZE,
cinfo->min_DCT_h_scaled_size, cinfo->min_DCT_v_scaled_size);
cinfo->block_size = cinfo->min_DCT_h_scaled_size;
}
LOCAL(void)
initial_setup (j_compress_ptr cinfo, boolean transcode_only)
/* Do computations that are needed before master selection phase */
{
int ci, ssize;
jpeg_component_info *compptr;
if (transcode_only)
jpeg_calc_trans_dimensions(cinfo);
else
jpeg_calc_jpeg_dimensions(cinfo);
/* Sanity check on block_size */
src/Source/LibJPEG/jcmaster.c view on Meta::CPAN
compptr->h_samp_factor);
cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
compptr->v_samp_factor);
}
/* Compute dimensions of components */
for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
ci++, compptr++) {
/* Fill in the correct component_index value; don't rely on application */
compptr->component_index = ci;
/* In selecting the actual DCT scaling for each component, we try to
* scale down the chroma components via DCT scaling rather than downsampling.
* This saves time if the downsampler gets to use 1:1 scaling.
* Note this code adapts subsampling ratios which are powers of 2.
*/
ssize = 1;
#ifdef DCT_SCALING_SUPPORTED
while (cinfo->min_DCT_h_scaled_size * ssize <=
(cinfo->do_fancy_downsampling ? DCTSIZE : DCTSIZE / 2) &&
(cinfo->max_h_samp_factor % (compptr->h_samp_factor * ssize * 2)) == 0) {
ssize = ssize * 2;
src/Source/LibJPEG/jcmaster.c view on Meta::CPAN
idxout++;
}
cinfo->num_scans = idxout;
}
#endif /* C_MULTISCAN_FILES_SUPPORTED */
LOCAL(void)
select_scan_parameters (j_compress_ptr cinfo)
/* Set up the scan parameters for the current scan */
{
int ci;
#ifdef C_MULTISCAN_FILES_SUPPORTED
if (cinfo->scan_info != NULL) {
/* Prepare for current scan --- the script is already validated */
my_master_ptr master = (my_master_ptr) cinfo->master;
const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number;
src/Source/LibJPEG/jcmaster.c view on Meta::CPAN
METHODDEF(void)
prepare_for_pass (j_compress_ptr cinfo)
{
my_master_ptr master = (my_master_ptr) cinfo->master;
switch (master->pass_type) {
case main_pass:
/* Initial pass: will collect input data, and do either Huffman
* optimization or data output for the first scan.
*/
select_scan_parameters(cinfo);
per_scan_setup(cinfo);
if (! cinfo->raw_data_in) {
(*cinfo->cconvert->start_pass) (cinfo);
(*cinfo->downsample->start_pass) (cinfo);
(*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU);
}
(*cinfo->fdct->start_pass) (cinfo);
(*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding);
(*cinfo->coef->start_pass) (cinfo,
(master->total_passes > 1 ?
src/Source/LibJPEG/jcmaster.c view on Meta::CPAN
/* No immediate data output; postpone writing frame/scan headers */
master->pub.call_pass_startup = FALSE;
} else {
/* Will write frame/scan headers at first jpeg_write_scanlines call */
master->pub.call_pass_startup = TRUE;
}
break;
#ifdef ENTROPY_OPT_SUPPORTED
case huff_opt_pass:
/* Do Huffman optimization for a scan after the first one. */
select_scan_parameters(cinfo);
per_scan_setup(cinfo);
if (cinfo->Ss != 0 || cinfo->Ah == 0) {
(*cinfo->entropy->start_pass) (cinfo, TRUE);
(*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
master->pub.call_pass_startup = FALSE;
break;
}
/* Special case: Huffman DC refinement scans need no Huffman table
* and therefore we can skip the optimization pass for them.
*/
master->pass_type = output_pass;
master->pass_number++;
/*FALLTHROUGH*/
#endif
case output_pass:
/* Do a data-output pass. */
/* We need not repeat per-scan setup if prior optimization pass did it. */
if (! cinfo->optimize_coding) {
select_scan_parameters(cinfo);
per_scan_setup(cinfo);
}
(*cinfo->entropy->start_pass) (cinfo, FALSE);
(*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
/* We emit frame/scan headers now */
if (master->scan_number == 0)
(*cinfo->marker->write_frame_header) (cinfo);
(*cinfo->marker->write_scan_header) (cinfo);
master->pub.call_pass_startup = FALSE;
break;
src/Source/LibJPEG/jconfig.h view on Meta::CPAN
*/
#undef INCOMPLETE_TYPES_BROKEN
/* Define "boolean" as unsigned char, not int, per Windows custom */
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean;
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
/*
* The following options affect code selection within the JPEG library,
* but they don't need to be visible to applications using the library.
* To minimize application namespace pollution, the symbols won't be
* defined unless JPEG_INTERNALS has been defined.
*/
#ifdef JPEG_INTERNALS
/* Define this if your compiler implements ">>" on signed values as a logical
* (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift,
* which is the normal and rational definition.
src/Source/LibJPEG/jconfig.txt view on Meta::CPAN
#define FALSE 0 /* values of boolean */
#endif
#ifndef TRUE
#define TRUE 1
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
#endif
/*
* The following options affect code selection within the JPEG library,
* but they don't need to be visible to applications using the library.
* To minimize application namespace pollution, the symbols won't be
* defined unless JPEG_INTERNALS has been defined.
*/
#ifdef JPEG_INTERNALS
/* Define this if your compiler implements ">>" on signed values as a logical
* (unsigned) shift; leave it undefined if ">>" is a signed (arithmetic) shift,
* which is the normal and rational definition.
src/Source/LibJPEG/jcparam.c view on Meta::CPAN
add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1],
bits_ac_chrominance, val_ac_chrominance);
}
/*
* Default parameter setup for compression.
*
* Applications that don't choose to use this routine must do their
* own setup of all these parameters. Alternately, you can call this
* to establish defaults and then alter parameters selectively. This
* is the recommended approach since, if we add any new parameters,
* your code will still work (they'll be set to reasonable defaults).
*/
GLOBAL(void)
jpeg_set_defaults (j_compress_ptr cinfo)
{
int i;
/* Safety check to ensure start_compress not called yet. */
src/Source/LibJPEG/jcparam.c view on Meta::CPAN
(cinfo->jpeg_color_space == JCS_YCbCr ||
cinfo->jpeg_color_space == JCS_BG_YCC)) {
/* Custom script for YCC color images. */
/* Initial DC scan */
scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
/* Initial AC scan: get some luma data out in a hurry */
scanptr = fill_a_scan(scanptr, 0, 1, 5, 0, 2);
/* Chroma data is too small to be worth expending many scans on */
scanptr = fill_a_scan(scanptr, 2, 1, 63, 0, 1);
scanptr = fill_a_scan(scanptr, 1, 1, 63, 0, 1);
/* Complete spectral selection for luma AC */
scanptr = fill_a_scan(scanptr, 0, 6, 63, 0, 2);
/* Refine next bit of luma AC */
scanptr = fill_a_scan(scanptr, 0, 1, 63, 2, 1);
/* Finish DC successive approximation */
scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
/* Finish AC successive approximation */
scanptr = fill_a_scan(scanptr, 2, 1, 63, 1, 0);
scanptr = fill_a_scan(scanptr, 1, 1, 63, 1, 0);
/* Luma bottom bit comes last since it's usually largest scan */
scanptr = fill_a_scan(scanptr, 0, 1, 63, 1, 0);
src/Source/LibJPEG/jcsample.c view on Meta::CPAN
*outptr = (JSAMPLE) ((membersum + 32768) >> 16);
}
}
#endif /* INPUT_SMOOTHING_SUPPORTED */
/*
* Module initialization routine for downsampling.
* Note that we must select a routine for each component.
*/
GLOBAL(void)
jinit_downsampler (j_compress_ptr cinfo)
{
my_downsample_ptr downsample;
int ci;
jpeg_component_info * compptr;
boolean smoothok = TRUE;
int h_in_group, v_in_group, h_out_group, v_out_group;
src/Source/LibJPEG/jctrans.c view on Meta::CPAN
* that is, writing raw DCT coefficient arrays to an output JPEG file.
* The routines in jcapimin.c will also be needed by a transcoder.
*/
#define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
/* Forward declarations */
LOCAL(void) transencode_master_selection
JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays));
LOCAL(void) transencode_coef_controller
JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays));
/*
* Compression initialization for writing raw-coefficient data.
* Before calling this, all parameters and a data destination must be set up.
* Call jpeg_finish_compress() to actually write the data.
*
src/Source/LibJPEG/jctrans.c view on Meta::CPAN
GLOBAL(void)
jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)
{
if (cinfo->global_state != CSTATE_START)
ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
/* Mark all tables to be written */
jpeg_suppress_tables(cinfo, FALSE);
/* (Re)initialize error mgr and destination modules */
(*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
(*cinfo->dest->init_destination) (cinfo);
/* 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
src/Source/LibJPEG/jctrans.c view on Meta::CPAN
dstinfo->JFIF_minor_version = srcinfo->JFIF_minor_version;
}
dstinfo->density_unit = srcinfo->density_unit;
dstinfo->X_density = srcinfo->X_density;
dstinfo->Y_density = srcinfo->Y_density;
}
}
/*
* Master selection of compression modules for transcoding.
* This substitutes for jcinit.c's initialization of the full compressor.
*/
LOCAL(void)
transencode_master_selection (j_compress_ptr cinfo,
jvirt_barray_ptr * coef_arrays)
{
/* Initialize master control (includes parameter checking/processing) */
jinit_c_master_control(cinfo, TRUE /* transcode only */);
/* Entropy encoding: either Huffman or arithmetic coding. */
if (cinfo->arith_code)
jinit_arith_encoder(cinfo);
else {
jinit_huff_encoder(cinfo);
src/Source/LibJPEG/jdapistd.c view on Meta::CPAN
/* Forward declarations */
LOCAL(boolean) output_pass_setup JPP((j_decompress_ptr cinfo));
/*
* Decompression initialization.
* jpeg_read_header must be completed before calling this.
*
* If a multipass operating mode was selected, this will do all but the
* last pass, and thus may take a great deal of time.
*
* Returns FALSE if suspended. The return value need be inspected only if
* a suspending data source is used.
*/
GLOBAL(boolean)
jpeg_start_decompress (j_decompress_ptr cinfo)
{
if (cinfo->global_state == DSTATE_READY) {
/* First call: initialize master control, select active modules */
jinit_master_decompress(cinfo);
if (cinfo->buffered_image) {
/* No more work here; expecting jpeg_start_output next */
cinfo->global_state = DSTATE_BUFIMAGE;
return TRUE;
}
cinfo->global_state = DSTATE_PRELOAD;
}
if (cinfo->global_state == DSTATE_PRELOAD) {
/* If file has multiple scans, absorb them all into the coef buffer */
src/Source/LibJPEG/jdarith.c view on Meta::CPAN
* Each of these routines decodes and returns one MCU's worth of
* arithmetic-compressed coefficients.
* The coefficients are reordered from zigzag order into natural array order,
* but are not dequantized.
*
* The i'th block of the MCU is stored into the block pointed to by
* MCU_data[i]. WE ASSUME THIS AREA IS INITIALLY ZEROED BY THE CALLER.
*/
/*
* MCU decoding for DC initial scan (either spectral selection,
* or first pass of successive approximation).
*/
METHODDEF(boolean)
decode_mcu_DC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
JBLOCKROW block;
unsigned char *st;
int blkn, ci, tbl, sign;
src/Source/LibJPEG/jdarith.c view on Meta::CPAN
/* Scale and output the DC coefficient (assumes jpeg_natural_order[0]=0) */
(*block)[0] = (JCOEF) (entropy->last_dc_val[ci] << cinfo->Al);
}
return TRUE;
}
/*
* MCU decoding for AC initial scan (either spectral selection,
* or first pass of successive approximation).
*/
METHODDEF(boolean)
decode_mcu_AC_first (j_decompress_ptr cinfo, JBLOCKROW *MCU_data)
{
arith_entropy_ptr entropy = (arith_entropy_ptr) cinfo->entropy;
JBLOCKROW block;
unsigned char *st;
int tbl, sign, k;