home *** CD-ROM | disk | FTP | other *** search
- TABLE OF CONTENTS
-
- jpeg.library/--background--
- jpeg.library/--history--
- jpeg.library/--information--
- jpeg.library/AllocJPEGCompressA
- jpeg.library/AllocJPEGDecompressA
- jpeg.library/AllocRGBFromJPEGA
- jpeg.library/CompressJPEGA
- jpeg.library/DecompressJPEGA
- jpeg.library/FreeJPEGCompress
- jpeg.library/FreeJPEGDecompress
- jpeg.library/FreeJPEGRGBBuffer
- jpeg.library/GetJPEGInfoA
- jpeg.library/--background-- jpeg.library/--background--
-
- PURPOSE
- To allow de/compression of images into/from the jpeg image format.
-
- COPYRIGHT
- The copyright in this library is owned by Paul Huxham.
- This software is based in part on the work of the Independent JPEG Group.
- The jpeg de/compression routines are copyright by the Independent
- JPEG Group, written by Thomas G. Lane.
-
- DISCLAIMER
- jpeg.library and its associated files are supposed to enable jpeg images
- to be de/compressed. Even though every effort has been made to make
- jpeg.library as stable and functional as possible, I cannot rule out the
- possibility that jpeg.library may have bugs that have side effects
- (possibly harmful) on your system.
-
- I hereby reject any liability or responsibility for these or any other
- consequences from the use of jpeg.library whatsoever. This includes, but
- is not limited to, damage to your equipment, to your data, personal
- injuries, financial loss or any other kinds of side effects.
-
- jpeg.library is provided as-is. This means I do not guarantee that
- jpeg.library is fit for any specific purpose and I do not guarantee any
- bug fixes, updates or help during error recovery.
-
- DISTRIBUTION
- jpeg.library should be distributed at no charge to the end user. It may
- be included on Aminet CDs.
-
- The author retains all rights to the enclosed software. Payment is not
- required for the use of jpeg.library.
-
- CONTENTS
- jpeg.library - The jpeg de/compression library.
- jpeg.fd - The function description file.
- jpeg_protos.h - The function prototypes.
- jpeg_pragmas.h - The function pragmas.
- jpeg.h - proof.library definitions.
- jpeg.lib - Stubs link library.
- jpeg.autodoc - jpeg.library documentation.
-
- REQUIREMENTS
- A minimum of Kickstart 2.0 and 68020 CPU is required to use jpeg.library.
-
- COMPLIER
- jpeg.library was written and compiled using CED V3.5 and SAS/C 6.55 on
- an Amiga 4000/060. CyberGuard was used to detect/correct programming
- errors.
-
- BUGS
- Should you find any bugs, please report them so that they can be fixed.
- Likewise any suggestions for improvment of the library should be
- forwarded so that they can be addressed.
-
- THANKYOUS
- Many thanks to
- Dinh Thi Kim Tuyen
- -Who makes the sky blue and the world turn. I love you, forevermore.
-
- Steve Quartly
- - For saying its possible and then helping me do it.
-
- AUTHORS
- You can contact the author via:
- email: paulh@mafeking.scouts.org.au
- or
- P.O. Box 875
- Morley,
- Perth,
- Western Australia 6943
-
- jpeg.library/--history-- jpeg.library/--history--
-
- V4.0
- > Corrected some small typos in the documentation.
-
- > Added DCTMethods for de/compression. These can offset speed versus
- quality. Check jpeg.h for the methods and tag to use.
-
- V3.2
- > Fixed a bug where when decompressing using a render hook, the userdata
- was not passed to the hook.
-
- > Added a new pragmas file which contains pragmas for different
- compilers, thanks to Stephan Rupprecht for his help.
-
- V3.1
- > Fixed a bug where when decompressing to memory using memory pools
- resulted in a 4k memory loss until the freeing of the memory pool.
-
- V3.0
- > Fixed a bug where aborting de/compression returned DE/COMPFAILURE not
- DE/COMPABORTED.
-
- > Some documentation errors and omissions are now fixed.
-
- > Added a render callback hook for use during image decompression.
-
- > Added memory pool support for image compression into a memory
- destination stream.
-
- V2.1
- > Fixed a bug when there is insufficient memory and the library
- attempted to use temporary files (previously would fail to load the
- image). Now it will ask for a JPEGTMP: assignment to store the
- temporary files into.
-
- > Previously the maximum memory to use was fixed at 1 meg. Now it is
- 10% less than the total amount of free memory. If there is still
- insufficient memory, temporary files will be used.
-
- > Implemented progress indicator callback hooks for compression and
- decompression.
-
- > Added some additional error codes such as not a jpeg file etc (see
- jpeg.h)
-
- > Updated the example code to show new features of the library. Fixed
- some documentation problems in the example code.
-
- V1.0
- > Initial release.
-
- jpeg.library/--information-- jpeg.library/--information--
-
- Although the documentation is not extensive, the examples are fairly well
- layed out and easy to follow. They all use different methods of
- accessing jpeg.library. You can choose the one that suits your
- application best.
-
- It is EXTREMELY IMPORTANT to check the colour space of the jpeg image you
- have decoded (or are about to decode). For example, in a JPCS_GRAYSCALE
- only one third the amount of information is returned compared to an rgb
- triplet buffer as the grayscale image data is normally one byte per
- pixel. For JPCS_UNKNOWN, check the number of bytes per pixel to establish
- if the data is grayscale or not. For JPCS_RGB, the image data will be
- returned as an rgb triplet array.
-
- jpeg.library/AllocJPEGCompressA jpeg.library/AllocJPEGCompressA
-
- NAME
- AllocJPEGCompressA -- Allocate a jpeg compression handle (V1)
- AllocJPEGCompress -- Varargs stub (V1)
-
- SYNOPSIS
- err = AllocJPEGCompressA( jph, taglist )
- a0 a1
-
- err = AllocJPEGCompressA( struct JPEGComHandle **jph,
- struct TagItem *taglist )
-
- err = AllocJPEGCompress( jph, tag1, ... )
-
- err = AllocJPEGCompress( struct JPEGComHandle **jph, ULONG tag1, ... )
-
- FUNCTION
- Allocates a new jpeg handle.
-
- Available tags:
- JPG_DestMemStream - A pointer to a UBYTE pointer to take the data
- generated by the compressor (if specified, must
- also specify the JPG_DestMemStreamSize tag).
- See NOTE below about this allocated memory.
- JPG_DestMemStreamSize - A pointer to a ULONG to take the size of the
- compressed data (if specified, must also
- specify the JPG_DestMemStream).
- JPG_DestFile - A BPTR to an already open AmigaDOS file.
-
- New tags requiring V3.0
- JPG_MemoryPool - A pointer to a exec V39 memory pool to store
- the compressed jpeg data into. (NOT freed on
- exit.)
-
- INPUTS
- jph - pointer to a struct JPEGComHandle pointer.
- taglist - pointer to a tag list specifying the destination for the
- compressed data and data size.
-
- RESULT
- err - if non NULL contains an error code. (For a complete list of error
- codes, see jpeg.h)
-
- WARNING
-
- BUGS
-
- NOTES
- You are responsible for freeing the memory allocated to you, by calling
- FreeVec() on the pointer supplied to AllocJPEGCompress() (if it isnt a
- NULL value).
-
- BUT if you are using the new JPG_MemoryPool tag in object allocation,
- call an appropriate pool or puddle free routine.
-
- SEE ALSO
- FreeJPEGCompressA(), CompressJPEGA()
-
- jpeg.library/AllocJPEGDecompressA jpeg.library/AllocJPEGDecompressA
-
- NAME
- AllocJPEGDecompressA -- Allocate a jpeg decompression handle (V1)
- AllocJPEGDecompress -- Varargs stub (V1)
-
- SYNOPSIS
- err = AllocJPEGDecompressA( jph, taglist )
- a0 a1
-
- err = AllocJPEGDecompressA( struct JPEGDecHandle **jph,
- struct TagItem *taglist )
-
- err = AllocJPEGDecompress( jph, tag1, ... )
-
- err = AllocJPEGDecompress( struct JPEGDecHandle **jph, ULONG tag1, ... )
-
- FUNCTION
- Allocates a new jpeg handle.
-
- Available tags:
- JPG_SrcMemStream - The source image is a segment of memory starting
- at this address.
- JPG_SrcMemStreamSize - The length of the memory based segment, in bytes.
- JPG_SrcFile - A BPTR to an already open AmigaDOS file.
-
- INPUTS
- jph - pointer to a struct JPEGDecHandle pointer.
- taglist - pointer to a tag list specifying the jpeg stream source and
- size.
-
- RESULT
- err - if non NULL contains an error code. (For a complete list of error
- codes, see jpeg.h)
-
- WARNING
-
- BUGS
-
- SEE ALSO
- FreeJPEGDecompressA(), DecompressJPEGA()
-
- jpeg.library/AllocRGBFromJPEGA jpeg.library/AllocRGBFromJPEGA
-
- NAME
- AllocRGBFromJPEGA -- Allocate an RGB triplet buffer (V1)
- AllocRGBFromJPEG -- Varargs stub (V1)
-
- SYNOPSIS
- buffer = AllocRGBFromJPEGA( jph, taglist )
- a0 a1
-
- void *AllocRGBFromJPEGA( struct JPEGDecHandle *jph,
- struct TagItem *taglist )
-
- buffer = AllocRGBFromJPEG( jph, tag1, ... )
-
- void *AllocRGBFromJPEG( struct JPEGDecHandle *jph, ULONG tag1, ... )
-
- FUNCTION
- Allocates enough memory to hold the decompressed version of the jpeg in
- memory as a stream of RGB triplets.
-
- INPUTS
- taglist - pointer to an optional tag list specifying how to modify the
- image data.
-
- Modifiers (used, but not saved in the jpeg handle):
- JPG_ScaleNum - Return values as though scaled with this value.
- JPG_ScaleDenom - Return values as though scaled with this value.
-
- RESULT
- buffer - is NULL for any error, or a pointer to the memory allocated.
-
- WARNING
-
- BUGS
- Technically, this function does not allocate an RGB sized buffer, but
- rather allocates enough memory to hold the decoded image. (eg if the data
- is of JPCS_GRAYSCALE, only one third the amount of memory is allocated as
- compared to a JPCS_RGB image.)
-
- NOTES
- If you obtained your image sizes from GetJPEGInfo() and used scale tags,
- you SHOULD also pass those same tag values to this function to allocate
- the buffer, otherwise the buffer allocated will be the original size of
- the image.
-
- SEE ALSO
- FreeJPEGRGBBuffer()
-
- jpeg.library/CompressJPEGA jpeg.library/CompressJPEGA
-
- NAME
- CompressJPEGA -- Compress a jpeg stream (V1)
- CompressJPEG -- Varargs stub (V1)
-
- SYNOPSIS
- err = CompressJPEGA( jph, taglist )
- a0 a1
-
- err = CompressJPEGA( struct JPEGComHandle *jph,
- struct TagItem *taglist )
-
- err = CompressJPEG( jph, tag1, ... )
-
- err = CompressJPEG( struct JPEGComHandle **jph, ULONG tag1, ... )
-
- FUNCTION
- Compresses a jpeg stream into the location specified by
- AllocJPGCompress() using the supplied tags.
-
- Available tags:
- JPG_SrcRGBBuffer - An RGB triplet buffer containing the source
- image.
- JPG_CompressHook - Calls a user specified function (see jpeg.h)
- JPG_CompressUserData - User data passed to the hook function.
- JPG_Width - Width of the image (REQUIRED).
- JPG_Height - Height of the image (REQUIRED).
- JPG_Quality - Jpeg save quality (1-100), defaults to 85.
- JPG_BytesPerPixel - The number of bytes per image pixel, defaults
- to 3.
- JPG_ColourSpace - The type of image data stored in the buffer,
- defaults to JPCS_RGB (see jpeg.h for others).
- JPG_Smoothing - Apply image smoothing while saving (0-100),
- defaults to none (0).
-
- New tags requiring V2.1
- JPG_ProgressHook - Calls a user specified function (see jpeg.h).
- DO NOT pass a hook structure pointer here. Put
- a pointer to your function. (See examples).
- Returning a non NULL value from the hook will
- abort a load in progress.
- JPG_ProgressUserData - User data passed to the hook function (void *).
-
- New tags requiring V4.0
- JPG_DCTMethod - The DCT processing method to use for encoding,
- defaults to DCT_ISLOW (see jpeg.h for others).
-
- INPUTS
- jph - pointer to a struct JPEGComHandle.
- taglist - pointer to a tag list.
-
- RESULT
- err - if non NULL contains an error code. (For a complete list of error
- codes, see jpeg.h)
-
- WARNING
-
- BUGS
-
- NOTES
- You are responsible for freeing the memory allocated to you, by calling
- FreeVec() on the pointer supplied to AllocJPEGCompress().
-
- BUT if you are using the new JPG_MemoryPool tag in object allocation,
- call an appropriate pool or puddle free routine.
-
- e.g.
-
- UBYTE *cstream;
- ULONG cstreamsize;
-
- err = AllocJPEGCompress( &jpc, JPG_DestMemStream, &cstream,
- JPG_DestMemStreamSize, &cstreamsize, TAG_DONE );
-
- err = CompressJPEG( jpc, JPG_SrcRGBBuffer, buffer,
- JPG_Width, x, JPG_Height, y, TAG_DONE );
-
- FreeJPEGCompress( jpc );
-
- /* Use the buffer here */
-
- if ( cstream != NULL ) FreeVec( cstream );
-
- SEE ALSO
- AllocJPEGCompressA(), FreeJPEGCompressA()
-
- jpeg.library/DecompressJPEGA jpeg.library/DecompressJPEGA
-
- NAME
- DecompressJPEGA -- Decompress a jpeg stream (V1)
- DecompressJPEG -- Varargs stub (V1)
-
- SYNOPSIS
- err = DecompressJPEGA( jph, taglist )
- a0 a1
-
- err = DecompressJPEGA( struct JPEGDecHandle *jph,
- struct TagItem *taglist )
-
- err = DecompressJPEG( jph, tag1, ... )
-
- err = DecompressJPEG( struct JPEGDecHandle **jph, ULONG tag1, ... )
-
- FUNCTION
- Decompresses a jpeg stream as specified by AllocJPGDecompress() and
- supplied tags.
-
- Available tags:
- JPG_DestRGBBuffer - The decompressed image data is stored as RGB
- triplets starting at this address. You must
- allocate enough memory to take the image. Use
- AllocRGBFromJPEG() to allocate the required
- memory space.
- JPG_DecompressHook - Calls a user specified function (see jpeg.h).
- DO NOT pass a hook structure pointer here. Put
- a pointer to your function. (See examples)
- JPG_DecompressUserData - User data passed to the hook function (void *).
- JPG_ScaleNum - Scale decompressed data with this value.
- JPG_ScaleDenom - Scale decompressed data with this value.
-
- New tags requiring V2.1
- JPG_ProgressHook - Calls a user specified function (see jpeg.h).
- DO NOT pass a hook structure pointer here. Put
- a pointer to your function. (See examples).
- Returning a non NULL value from the hook will
- abort a load in progress.
- JPG_ProgressUserData - User data passed to the hook function (void *).
-
- New tags requiring V3.0
- JPG_RenderHook - Calls a user specified function (see jpeg.h).
- DO NOT pass a hook structure pointer here. Put
- a pointer to your function. (See examples).
- Returning a non NULL value from the hook will
- abort a load in progress.
- JPG_RenderUserData - User data passed to the hook function (void *).
-
- New tags requiring V4.0
- JPG_DCTMethod - The DCT processing method to use for decoding,
- defaults to DCT_ISLOW (see jpeg.h for others).
-
- INPUTS
- jph - pointer to a struct JPEGDecHandle.
- taglist - pointer to a tag list.
-
- RESULT
- err - if non NULL contains an error code. (For a complete list of error
- codes, see jpeg.h)
-
- WARNING
- The jpeg code has a limition on scaling where, num must always be 1 and
- denom can be either: 1, 2, 4, or 8. Undefined results occur if this is
- not adhered to.
-
- BUGS
-
- SEE ALSO
- AllocJPEGDecompressA(), FreeJPEGDecompressA()
-
- jpeg.library/FreeJPEGCompress jpeg.library/FreeJPEGCompress
-
- NAME
- FreeJPEGCompress -- Free a jpeg compression handle (V1)
-
- SYNOPSIS
- err = FreeJPEGCompress( jph )
- a0
-
- err = FreeJPEGCompress( struct JPEGComHandle *jph )
-
- FUNCTION
- Frees a jpeg handle.
-
- INPUTS
- jph - pointer to a struct JPEGComHandle.
-
- RESULT
- err - if non NULL contains an error code. (For a complete list of error
- codes, see jpeg.h)
-
- WARNING
-
- BUGS
-
- NOTES
- You are responsible for freeing the memory allocated to you by
- CompressJPEG(), by calling FreeVec() on the pointer supplied to
- AllocJPEGCompress().
-
- BUT if you are using the new JPG_MemoryPool tag in object allocation,
- call an appropriate pool or puddle free routine.
-
- SEE ALSO
- AllocJPEGCompressA(), CompressJPEGA()
-
- jpeg.library/FreeJPEGDecompress jpeg.library/FreeJPEGDecompress
-
- NAME
- FreeJPEGDecompress -- Free a jpeg decompression handle (V1)
-
- SYNOPSIS
- err = FreeJPEGDecompress( jph )
- a0
-
- err = FreeJPEGDecompress( struct JPEGDecHandle *jph )
-
- FUNCTION
- Frees a jpeg handle.
-
- INPUTS
- jph - pointer to a struct JPEGDecHandle.
-
- RESULT
- err - if non NULL contains an error code. (For a complete list of error
- codes, see jpeg.h)
-
- WARNING
-
- BUGS
-
- SEE ALSO
- AllocJPEGDecompressA(), DecompressJPEGA()
-
- jpeg.library/FreeJPEGRGBBuffer jpeg.library/FreeJPEGRGBBuffer
-
- NAME
- FreeJPEGRGBBuffer -- Free an RGB triplet buffer (V1)
-
- SYNOPSIS
- FreeJPEGRGBBuffer( buffer )
- a0
-
- void FreeJPEGRGBBuffer( void *buffer )
-
- FUNCTION
- Frees an RGB triplet buffer allocated with AllocRGBFromJPEGA().
-
- INPUTS
- buffer - Pointer to the allocated buffer returned by AllocRGBFromJPEG().
-
- RESULT
-
- WARNING
-
- BUGS
-
- SEE ALSO
- AllocRGBFromJPEG()
-
- jpeg.library/GetJPEGInfoA jpeg.library/GetJPEGInfoA
-
- NAME
- GetJPEGInfoA -- Get information about a jpeg handle (V1)
- GetJPEGInfo -- Varargs stub (V1)
-
- SYNOPSIS
- err = GetJPEGInfoA( jph, taglist )
- a0 a1
-
- err = GetJPEGInfoA( struct JPEGDecHandle *jph, struct TagItem *taglist )
-
- err = GetJPEGInfo( jph, tag1, ... )
-
- err = GetJPEGInfo( struct JPEGDecHandle *jph, ULONG tag1, ... )
-
- FUNCTION
- Retrieves information about the jpeg handle and returns the values in
- variables passed in with the taglist.
-
- Available tags:
- JPG_Width - Returns the width of the decoded image (ULONG).
- JPG_Height - Returns the height of the decoded image (ULONG).
- JPG_BytesPerPixel - Returns the number of bytes for every pixel,
- (usually 3 - JPCS_RGB) (ULONG).
- JPG_RowSize - Returns the width in bytes of one pixel row (ULONG).
- JPG_ColourSpace - Returns the type of colour space stored in the jpeg
- image (see jpeg.h for result codes) (UBYTE)
-
- Modifiers (used, but not saved in the jpeg handle):
- JPG_ScaleNum - Return values as though scaled with this value.
- JPG_ScaleDenom - Return values as though scaled with this value.
-
- The jpeg code has a limition on scaling where, num must always be 1 and
- denom can be either: 1, 2, 4, or 8.
-
- Only JPEGDecHandles can have values read from them, JPEGComHandle passed
- to this function returns a JPGERR_NONE and the taglist remains untouched.
-
- INPUTS
- jph - pointer to a struct JPEGDecHandle.
- taglist - pointer to an optional tag list specifying what data items to
- retrieve for this jpeg handle.
-
- RESULT
- err - if non NULL contains an error code. (For a complete list of error
- codes, see jpeg.h)
-
- WARNING
-
- BUGS
-
- EXAMPLE
-
- err = GetJPEGInfo( jph, JPG_Width, &x, JPG_Height, &y, TAG_DONE );
-
- SEE ALSO
-
-
-