diff --git a/index.html b/index.html index 24939c1..c285fab 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,8 @@
Cjas_allocator_s | A memory allocator |
Cjas_cmclrspcconv_t | Color space conversion |
Cjas_cmcmptfmt_t | Component format |
Cjas_cmpixmap_t | Pixmap (i.e., multicomponent) format |
Cjas_cmprof_t | |
Cjas_cmpxform_s | Transform class |
Cjas_cmpxformops_t | Transform operations |
Cjas_cmpxformseq_t | Primitive transform sequence class |
Cjas_cmshaplut_t | Shaper look-up table (LUT) |
Cjas_cmshapmat_t | Shaper matrix |
Cjas_cmshapmatlut_t | Shaper matrix look-up table (LUT) |
Cjas_cmxform_t | Primitive transform class |
Cjas_image_cmpt_t | Image component class |
Cjas_image_cmptparm_t | Component parameters class |
Cjas_image_fmt_t | Entry in image format table |
Cjas_image_fmtinfo_t | Image format information |
Cjas_image_fmtops_t | Image format-dependent operations |
Cjas_image_t | Image class |
Cjas_logtype_t | Type used for the log type |
Cjas_matrix_t | Matrix type |
Cjas_opt_t | Command line option type |
Cjas_seq2d_t | Two-dimensional sequence type |
Cjas_seq_t | One-dimensional sequence type |
Cjas_std_allocator_t | The standard library allocator (i.e., a wrapper for malloc and friends) |
Cjas_stream_t | I/O stream object |
Cjas_taginfo_t | Tag information type |
Cjas_tmr_t | Timer type |
Cjas_tvparser_t | Tag-value parser type |
In order to demonstrate how the JasPer library can be used, several sample application programs are provided in the JasPer software distribution. These programs include the following:
+jasper
. The jasper
program is an image transcoder (i.e., it converts image data from one format to another). For more details, see The jasper Program.jiv
. The jiv
program is a simple image viewer (based on OpenGL). For more details, see The jiv Program.imgcmp
The imgcmp
program is an image comparison utility. It measures the difference between two images using one of numerous distortion metrics (such as peak signal-to-noise ratio, mean squared error, root mean squared error, peak absolute error, and mean absolute error). For more details, see The imgcmp Program.imginfo
The imginfo
program provides basic information about an image, such as its geometry (i.e., number of components, width and height of components, and so on). For more details, see The imginfo Program.Although the above-mentioned programs were initially developed for demonstration purposes, they have also proven quite useful in their own right, especially the jasper
and jiv
programs.
imgcmp
[options]
The imgcmp command compares two images. The two images being compared must have the same geometry (i.e., the same width, height, number of components, component subsampling factors, etc.).
+The following options are supported:
+--help
--version
--verbose
-f $file
$file
.-F $file
$file
.-m $metric
$metric
. The $metric
argument may assume one of the following values:psnr
: peak signal to noise ratio (PSNR)mse
: mean squared error (MSE)rmse
: root mean squared error (RMSE)pae
: peak absolute error (PAE)mae
: mean absolute error (MAE)equal
: equality--memory-limit $n
$n
bytes.--debug-level $level
$level
.The -f
and -F
options must always be specified. There is currently no way to explicitly specify the format of the images. If the format of either image cannot be autodetected, the command will exit with an error.
Suppose that we have two slightly different versions of an image stored in files original.pgm
and reconstructed.pgm
. In order to calculate the difference between these images using the PSNR metric, use the command:
imgcmp -f original.pgm -F reconstructed.pgm -m psnr +
imginfo
[options]
The imginfo
command displays information about an image. This command is really only intended to be used from shell scripts for testing purposes.
The following options are supported:
+--help
--version
--verbose
-f $file
$file
. If this option is not specified, the image is read from standard input.--list-enabled-formats
--memory-limit $n
$n
bytes.--debug-level $level
$level
.--max-samples $n
$n
.--decoder-option $string
$string
to the list of decoder options.To obtain information on how to use the imginfo
program, use the command:
imginfo --help +
Suppose that we would like to print information about an image stored in the file name image.jp2
. This could be accomplished by using the command:
imginfo < image.jp2 +
Alternatively, the following command could be used:
imginfo -f image.jp2 +
jasper
[options]
The jasper command converts image data from one format to another. In other words, this command functions as a general-purpose transcoder. Since the JPEG-2000 format is supported by this software, it can be used as a JPEG-2000 encoder and/or decoder.
+The jasper program accepts the following options:
+--help
--version
.--verbose
--list-enabled-formats
--memory-limit $n
$n
bytes.--debug-level $level
$level
.--input $file
or -f $file
$file
. By default, the input image is read from standard input.--input-format $format
or -t $format
$format
. In most circumstances, this option should not be needed, as the format is normally autodetected by examining the image data directly or deduced from the input file name extension if an input file is specified (via the --input
option).--input-option $option
or -o $option
$option
to the decoder. The valid values for the argument $option
are determined by the input image format. See below for more details.--output $file
or -F $file
$file
. By default, the encoded image is written to standard output.--output-format $format
or -T $format
$format
. The output format must be specified if an output file is not given (via the --output
option). If an output file is given and no output format is specified, an attempt will be made to deduce the correct format from the output file name extension.--output-option $option
or -O $option
$option
to the encoder. The valid values for the argument $option
are determined by the output format. See below for more details.--force-srgb
Assuming that JasPer is built with all codec support included (so that all codecs are available for use), the argument $format
must have one of the following values:
bmp
: Windows BMPheic
: HEIC Formatjp2
: JPEG-2000 JP2jpc
: JPEG-2000 Code Streamjpg
: JPEGpgx
: PGXpnm
: PNM/PGM/PPMmif
: My Image Formatras
: Sun RasterfileA list of the available formats is included in the help information for the program (obtained via the --help
option).
To obtain information on how to use the jasper
program, use the command:
jasper --help +
Suppose that we have an image stored in the PNM/PPM format in a file called lena.ppm
. To encode this image (losslessly) in the JPEG-2000 JP2 format, and store the result in a file called lena.jp2
, use the command:
jasper --input lena.ppm --output lena.jp2 --output-format jp2 +
Or, alternately (using short option names), use the command:
jasper -f lena.ppm -F lena.jp2 -T jp2 +
Suppose that we have a RGB color image stored in the JPEG-2000 JP2 format in a file called lena.jp2
. To encode this image in the PNM/PPM format, and store the result in a file called lena.ppm
, use the command:
jasper --input lena.jp2 --output lena.ppm --output-format pnm +
Or, alternately (using short option names), use the command:
jasper -f lena.jp2 -F lena.ppm -T pnm +
Suppose that we have an image stored in the BMP format in a file called lena.bmp
. To encode this image in a lossy manner at 100:1 compression in the JPEG-2000 (code stream) format, and store the result in a file called lena_lossy.jpc
, use the command:
jasper -f lena.bmp -F lena_lossy.jpc -T jpc -O rate=0.01 +
Suppose that we have an image stored in a file called sachie.pnm
in the PNM/PPM format, and we want to encode the image in the JPEG-2000 (code stream) format and store the result in a file named sachie_new.jpc
. Further, suppose that we want the JPEG-2000 format to employ the following parameters:
In order to accomplish the above, type:
jasper -f sachie.pnm -F sachie_new.jpc -T jpc -O cblkwidth=64 \ + -O cblkheight=32 -O nomct -O numrlvls=4 -O rate=0.015625 +
jiv
[options] [file1 file2 ...]
The jiv command displays an image. Basic pan and zoom functionality is provided. Components of an image may be viewed individually. Color components may also be viewed together as a composite image. At present, the jiv image viewer has only trivial support for color. It recognizes RGB and YCbCr color spaces, but does not use tone reproduction curves and the like in order to accurately reproduce color. For basic testing purposes, however, the color reproduction should suffice.
+The following options are supported:
+--help
--version
--wait $n
$n
seconds in between.--loop
--memory-limit $n
$n
bytes.--debug-level $level
$level
. All bugs reported in JasPer are tracked using the issue-tracking functionality provided by GitHub. If you encounter a problem with JasPer and you would like to know if it is a known problem, please check the issue-tracker page for JasPer on GitHub, which can be found at:
+ +If you happen to find a bug that has not been previously reported, please report it so that it can be fixed. To submit a bug report, visit the above issue-tracker page, and click on the "New issue" button.
+In order to ensure that your bug report can be properly processed, always be sure to include all of the following information:
+It is essential that you include all of the above information. Failure to do so may result in the bug report not being processed.
+Please do not submit bug reports directly to the author of JasPer via email, as bug reports that are not submitted via the above issue-tracking system on GitHub are easy to be lost.
+The JasPer software supports several popular codecs. In some cases, the support is native (i.e., built-in to the JasPer library itself). In other cases, the support is provided indirectly through external software dependencies. The sections that follow describe the various codecs supported by JasPer in more detail.
+Some encoder and decoder options are generic in the sense that they are essentially independent of the codec. Typically, encoders and decoders tend to ignore unrecognized options (although a warning might be issued for such options). So, it is not usually problematic to specify an unsupported option to an encoder or a decoder.
+The following generic options are supported by some encoders:
+debug=$level
. Set the debug level to $level
.The following generic options are supported by some decoders:
+debug=$level
. Set the debug level to $level
.max_samples=$n
. Set the maximum number of samples that are permitted in an image to be decoded to $n
. (An 100 100 RGB-color image has 30000 samples.)One of the most popular image formats on the Microsoft Windows platform is Microsoft's BMP format. The BMP codec in JasPer was written without the benefit of the BMP format specification from Microsoft. This means that the BMP support will inevitably not work correctly for all valid BMP files.
+The BMP encoder does not support any special options.
+The BMP decoder supports the following generic options:
+max_samples
The BMP decoder does not support any options beyond generic ones.
+The HEIC format is quite popular on Apple platforms. The support is experimental and likely has numerous bugs.
+The HEIC encoder supports the following special options:
+version
. Print the version of the Libheif library being used without performing any decoding.quality $quality
. Set the quality factor to $quality
.The HEIC decoder supports the following special options:
+version
. Print the version of the Libheif library being used without performing any decoding.The HEIC decoder does not support any generic options.
+One of the two image formats specified in the JPEG-2000 Part-1 standard (i.e., ISO/IEC 15444-1 [iso15444p1]) is the so called "JP2" format.
+The JP2 encoder supports all of the same options as the JPC encoder.
+The JP2 decoder supports all of the same options as the JPC decoder.
+One of the two image formats specified in the JPEG-2000 Part-1 standard (i.e., ISO/IEC 15444-1 [iso15444p1]) is the so called JPEG-2000 code stream format. The JPC codec in JasPer implements this format.
+The design of the JPEG-2000 codec implementation was driven by several key concerns: execution speed, memory usage, robustness, portability, modularity, maintainability, and extensibility. In some cases, however, during the design process, modularity, portability, and understandability of the code were weighed more heavily than execution speed and memory usage. Code understandability and portability were critical considerations since this software was intended to be used as a reference implementation of the JPEG-2000 Part-1 codec in the JPEG-2000 Part-5 standard [iso15444p5].
+Since the JPEG-2000 standard does not specify any means for encoding color space information in a JPEG-2000 code stream, the decoder must make certain assumptions about the color space of an image. If accurate color representation is important, the JPEG-2000 code stream format should not be employed. The JPEG-2000 JP2 format should be used instead.
+The JPC encoder supports the following special options:
+debug=$level
. Set the debug level to $level
.imgareatlx=$x
. Set the x-coordinate of the top-left corner of the image area to $x
.imgareatly=$y
. Set the y-coordinate of the top-left corner of the image area to $y
.tilegrdtlx=$x
. Set the x-coordinate of the top-left corner of the tiling grid to $x
.tilegrdtly=$y
. Set the y-coordinate of the top-left corner of the tiling grid to $y
.tilewidth=$w
. Set the nominal tile width to $w
.tileheight=$h
. Set the nominal tile height to $h
.prcwidth=$w
. Set the precinct width to $w
. The argument $w
must be an integer power of two. The default value is 32768.prcheight=$h
. Set the precinct height to $h
. The argument $h
must be an integer power of two. The default value is 32768.cblkwidth=$w
. Set the nominal code block width to $w
. The argument $w
must be an integer power of two. The default value is 64.cblkheight=$h
. Set the nominal code block height to $h
. The argument $h
must be an integer power of two. The default value is 64.mode=$m
. Set the coding mode to $m
. The argument $m
must have one of the following values:
int
. integer modereal
. real modeIf lossless coding is desired, the integer mode must be used. By default, the integer mode is employed. The choice of mode also determines which multicomponent and wavelet transforms (if any) are employed.
+rate=$r
. Specify the target rate. The argument $r
is a positive real number. Since a rate of one corresponds to no compression, one should never need to explicitly specify a rate greater than one. By default, the target rate is considered to be infinite.ilyrrates=
[, , , ]. Specify the rates for any intermediate layers. The argument to this option is a comma separated list of rates. Each rate is a positive real number. The rates must increase monotonically. The last rate in the list should be less than or equal to the overall rate (as specified with the rate
option).prg=$p
. Set the progression order to $p
. The argument $p
must have one of the following values:
lrcp
. layer-resolution-component-position (LRCP) progressive (i.e., rate scalable)rlcp
. resolution-layer-component-position (RLCP) progressive (i.e., resolution scalable)rpcl
. resolution-position-component-layer (RPCL) progressivepcrl
. position-component-resolution-layer (PCRL) progressivecprl
. component-position-resolution-layer (CPRL) progressiveBy default, LRCP progressive ordering is employed. Note that the RPCL and PCRL progressions are not valid for all possible image geometries. (See [iso15444p1] for more details.)
+nomct
. Disallow the use of any multicomponent transform.numrlvls=$n
. Set the number of resolution levels to $n
. The argument $n
must be an integer that is greater than or equal to one. The default value is 6.sop
. Generate SOP marker segments.eph
. Generate EPH marker segments.lazy
. Enable lazy coding mode (a.k.a. arithmetic coding bypass).termall
. Terminate all coding passes.segsym
. Use segmentation symbols.vcausal
. Use vertically stripe causal contexts.pterm
. Use predictable termination.resetprob
. Reset the probability models after each coding pass.numgbits=$n
. Set the number of guard bits to $n
._jp2overhead=$n
. This is for internal use only. It allows the rate to compensate for the overhead of a container format in which the JPEG-2000 code stream is embedded.The JPC decoder supports the following special options:
+maxlyrs=$n
. Set the maximum number of layers to decode to $n
.maxpkts=$n
. Set the maximum number of packets to decode to $n
.The following generic options are supported:
+debug
max_samples
All rates are specified in terms of compression factors (i.e., as reciprocals of compression ratio) and not as actual bit rates! Although image coding folks frequently use the number of bits per pixel to specify rate, this quantity is often inconvenient to use when dealing with images that have differing sample precisions. Furthermore, the number of bits per pixel is not well defined for multicomponent images with distinct subsampling factors. The compression factor, however, is independent of sample precision and well defined for all types of images. For these reasons, JasPer uses the compression factor and not the number of bits per pixel to specify rates.
+For lossy coding, one of the most popular image formats is specified in the JPEG standard (i.e., ISO/IEC 10918-1 [iso10918p1]). In JasPer, the JPG codec implements this format.
+The JPEG support in JasPer requires the JPEG library from the Independent JPEG Group (IJG). For legal reasons, the IJG JPEG library source code is not included with JasPer. The source code for this library can be downloaded from the IJG web site (i.e., http://www.ijg.org).
+The JPG encoder supports the following special options:
+quality=$q
. Set the quality factor to $q
. This is used in order to indirectly control the bit rate for lossy coding.The JPG encoder does not support any generic options.
+The JPG decoder supports the following special options:
+version
. Indicate that the decoder should only print the version of the IJG JPEG library in use. (No decoding is performed.)The JPG decoder supports the following generic options:
+max_samples
The JPEG-2000 Verification Model software employs a non-standard format called PGX. In JasPer, this format is handled by the PGX codec. The PGX format can only handle single components images, and consequently, is of limited use.
+The PGX encoder does not support any generic or special options.
+The PGX decoder supports the following special options:
+allow_trunc
. Allow decoding of truncated bitstreams (i.e., reaching EOF during decoding is not deemed to be an error).The PGX decoder supports the following generic options:
+max_samples
The MIF format is not a standard format. This format was invented solely for the purpose of testing the JasPer software. The support for the MIF format is experimental. It is intended to be used for advanced testing of the JasPer JPEG-2000 codec implementation. It is strongly recommended that this codec not be enabled/used in code running in environments where security is a concern.
+The MIF encoder does not support any generic or special options.
+The MIF decoder does not support any generic or special options.
+On UNIX platforms, the Portable Pixmap/Graymap/Bitmap (PNM) format is quite popular for coding image data. The PNM codec in JasPer supports this format. In JasPer, the support for the PNM/PGM/PPM format is complete. Therefore, the use of this format is favored over the BMP format. A (nonstandard) extension has also been added to the support for the PNM format so that it can handle images with signed sample values.
+The PNM encoder supports the following special options:
+text
. Use a non-raw (i.e., non-binary) flavor of PNM format.The PNM decoder supports the following special options:
+allow_trunc
. Allow decoding of truncated bitstreams (i.e., reaching EOF during decoding is not deemed to be an error).The PNM decoder supports the following generic options:
+max_samples
One popular image format on Sun workstations is the Sun Rasterfile format. The RAS codec in JasPer implements this format.
+The encoder does not support any special options.
+The RAS decoder supports the following special options:
+allow_trunc
. Allow decoding of truncated bitstreams (i.e., reaching EOF during decoding is not deemed to be an error).The RAS decoder supports the following generic options:
+max_samples
+Files | |
file | jas_cm.h [code] |
JasPer Color Management. | |
file | jas_compiler.h [code] |
Compiler-related macros. | |
file | jas_debug.h [code] |
JasPer Debugging-Related Functionality. | |
file | jas_dll.h [code] |
Shared Library Macros. | |
file | jas_fix.h [code] |
JasPer Fixed-Point Number Class. | |
file | jas_getopt.h [code] |
Command Line Option Parsing Code. | |
file | jas_icc.h [code] |
ICC Profile. | |
file | jas_image.h [code] |
JasPer Image Class. | |
file | jas_init.h [code] |
JasPer Initialization/Cleanup Code. | |
file | jas_log.h [code] |
JasPer Logging Functionality. | |
file | jas_malloc.h [code] |
JasPer Memory Allocator. | |
file | jas_math.h [code] |
Math-Related Code. | |
file | jas_seq.h [code] |
Sequence/Matrix Library. | |
file | jas_stream.h [code] |
I/O Stream Class. | |
file | jas_string.h [code] |
String Library. | |
file | jas_thread.h [code] |
Threads. | |
file | jas_tmr.h [code] |
Timer Code. | |
file | jas_tvp.h [code] |
Tag/Value Pair Parser. | |
file | jas_types.h [code] |
Primitive Types. | |
file | jas_version.h [code] |
JasPer Version. | |
file | jasper.h [code] |
JasPer Main Header. | |
+Directories | |
directory | include |
bmp_cod.h | |
bmp_enc.h | |
jas_cm.h | JasPer Color Management |
jas_compiler.h | Compiler-related macros |
jas_debug.h | JasPer Debugging-Related Functionality |
jas_dll.h | Shared Library Macros |
jas_fix.h | JasPer Fixed-Point Number Class |
jas_getopt.h | Command Line Option Parsing Code |
jas_icc.h | ICC Profile |
jas_image.h | JasPer Image Class |
jas_init.h | JasPer Initialization/Cleanup Code |
jas_log.h | JasPer Logging Functionality |
jas_malloc.h | JasPer Memory Allocator |
jas_math.h | Math-Related Code |
jas_seq.h | Sequence/Matrix Library |
jas_stream.h | I/O Stream Class |
jas_string.h | String Library |
jas_thread.h | Threads |
jas_tmr.h | Timer Code |
jas_tvp.h | Tag/Value Pair Parser |
jas_types.h | Primitive Types |
jas_version.h | JasPer Version |
jasper.h | JasPer Main Header |
jp2_cod.h | |
jp2_dec.h | |
jpc_bs.h | |
jpc_cod.h | |
jpc_cs.h | |
jpc_dec.h | |
jpc_enc.h | |
jpc_fix.h | |
jpc_flt.h | |
jpc_math.h | |
jpc_mct.h | |
jpc_mqcod.h | |
jpc_mqdec.h | |
jpc_mqenc.h | |
jpc_qmfb.h | |
jpc_t1cod.h | |
jpc_t1dec.h | |
jpc_t1enc.h | |
jpc_t2cod.h | |
jpc_t2dec.h | |
jpc_t2enc.h | |
jpc_tagtree.h | |
jpc_tsfb.h | |
jpc_util.h | |
jpg_cod.h | |
jpg_enc.h | |
jpg_jpeglib.h | |
mif_cod.h | |
pgx_cod.h | |
pgx_enc.h | |
pnm_cod.h | |
pnm_enc.h | |
ras_cod.h | |
ras_enc.h |
Memory Allocation. +More...
++Classes | |
struct | jas_allocator_s |
A memory allocator. More... | |
struct | jas_std_allocator_t |
The standard library allocator (i.e., a wrapper for malloc and friends). More... | |
+Typedefs | |
typedef struct jas_allocator_s | jas_allocator_t |
A memory allocator. More... | |
+Functions | |
JAS_EXPORT void * | jas_malloc (size_t size) |
Allocate memory. More... | |
JAS_EXPORT void | jas_free (void *ptr) |
Free memory. More... | |
JAS_EXPORT void * | jas_realloc (void *ptr, size_t size) |
Resize a block of allocated memory. More... | |
JAS_EXPORT void * | jas_calloc (size_t num_elements, size_t element_size) |
Allocate a block of memory and initialize the contents to zero. More... | |
JAS_EXPORT void * | jas_alloc2 (size_t num_elements, size_t element_size) |
Allocate array (with overflow checking). More... | |
JAS_EXPORT void * | jas_alloc3 (size_t num_arrays, size_t array_size, size_t element_size) |
Allocate array of arrays (with overflow checking). More... | |
JAS_EXPORT void * | jas_realloc2 (void *ptr, size_t num_elements, size_t element_size) |
Resize a block of allocated memory (with overflow checking). More... | |
JAS_EXPORT void | jas_set_max_mem_usage (size_t max_mem) |
Set the maximum memory usage allowed by the allocator wrapper. More... | |
JAS_EXPORT size_t | jas_get_mem_usage (void) |
Get the current memory usage from the allocator wrapper. More... | |
JAS_EXPORT void | jas_std_allocator_init (jas_std_allocator_t *allocator) |
Initialize a memory allocator that uses malloc and related functions for managing memory. More... | |
JAS_EXPORT void | jas_allocator_cleanup (jas_allocator_t *allocator) |
Clean up an allocator that is no longer needed. More... | |
JAS_EXPORT size_t | jas_get_total_mem_size (void) |
Get the total amount of memory available on the system. More... | |
Memory Allocation.
+General information can be found here.
+typedef struct jas_allocator_s jas_allocator_t | +
A memory allocator.
+ +JAS_EXPORT void* jas_alloc2 | +( | +size_t | +num_elements, | +
+ | + | size_t | +element_size | +
+ | ) | ++ |
Allocate array (with overflow checking).
+ +JAS_EXPORT void* jas_alloc3 | +( | +size_t | +num_arrays, | +
+ | + | size_t | +array_size, | +
+ | + | size_t | +element_size | +
+ | ) | ++ |
Allocate array of arrays (with overflow checking).
+ +JAS_EXPORT void jas_allocator_cleanup | +( | +jas_allocator_t * | +allocator | ) | ++ |
Clean up an allocator that is no longer needed.
+This function cleans up an allocator, releasing any resources associated with the allocator. After clean up is performed, the allocator can no longer be used.
+ +JAS_EXPORT void* jas_calloc | +( | +size_t | +num_elements, | +
+ | + | size_t | +element_size | +
+ | ) | ++ |
Allocate a block of memory and initialize the contents to zero.
+This function has an identical behavior as calloc (from the C standard library).
+ +JAS_EXPORT void jas_free | +( | +void * | +ptr | ) | ++ |
Free memory.
+This function has an identical behavior as free (from the C standard library).
+ +JAS_EXPORT size_t jas_get_mem_usage | +( | +void | +) | ++ |
Get the current memory usage from the allocator wrapper.
+This function queries the amount of memory currently in use by the allocator wrapper. This function can only be called if the use of the allocator wrapper is enabled. Calling this function if the allocator wrapper is not enabled results in undefined behavior.
+ +JAS_EXPORT size_t jas_get_total_mem_size | +( | +void | +) | ++ |
Get the total amount of memory available on the system.
+This function may be called prior to the library being initialized. In fact, this function may be useful for determining a reasonable value for the memory limit setting to be used during (run-time) library configuration.
+JAS_EXPORT void* jas_malloc | +( | +size_t | +size | ) | ++ |
Allocate memory.
+This function has an identical behavior as malloc (from the C standard library), except that a zero-sized allocation returns a non-null pointer (assuming no out-of-memory error occurs).
+ +JAS_EXPORT void* jas_realloc | +( | +void * | +ptr, | +
+ | + | size_t | +size | +
+ | ) | ++ |
Resize a block of allocated memory.
+This function has an identical behavior as realloc (from the C standard library).
+ +JAS_EXPORT void* jas_realloc2 | +( | +void * | +ptr, | +
+ | + | size_t | +num_elements, | +
+ | + | size_t | +element_size | +
+ | ) | ++ |
Resize a block of allocated memory (with overflow checking).
+ +JAS_EXPORT void jas_set_max_mem_usage | +( | +size_t | +max_mem | ) | ++ |
Set the maximum memory usage allowed by the allocator wrapper.
+max_mem | The maximum amount of memory (in bytes) that the allocator can use. |
This function sets the maximum amount of memory (in bytes) that the allocator wrapper is permitted to use to max_mem
. If max_mem
is zero, no limit is imposed on the amount of memory used by allocator. This function can only be called if the use of the allocator wrapper is enabled. Calling this function if the allocator wrapper is not enabled results in undefined behavior. The limit on the amount of memory that the allocator can use should never be set to a value less than the amount of memory currently being used by the allocator (as doing so results in undefined behavior).
JAS_EXPORT void jas_std_allocator_init | +( | +jas_std_allocator_t * | +allocator | ) | ++ |
Initialize a memory allocator that uses malloc and related functions for managing memory.
+allocator | A pointer to the storage in memory that will hold the state associated with the allocator. |
The object referenced by allocator
must have a lifetime that extends until jas_allocator_cleanup
is called for the allocator.
Color Management. +More...
++Classes | |
struct | jas_cmcmptfmt_t |
Component format. More... | |
struct | jas_cmpixmap_t |
Pixmap (i.e., multicomponent) format. More... | |
struct | jas_cmpxformops_t |
Transform operations. More... | |
struct | jas_cmshapmatlut_t |
Shaper matrix look-up table (LUT). More... | |
struct | jas_cmshapmat_t |
Shaper matrix. More... | |
struct | jas_cmshaplut_t |
Shaper look-up table (LUT). More... | |
struct | jas_cmclrspcconv_t |
Color space conversion. More... | |
struct | jas_cmpxform_s |
Transform class. More... | |
struct | jas_cmpxformseq_t |
Primitive transform sequence class. More... | |
struct | jas_cmxform_t |
Primitive transform class. More... | |
struct | jas_cmprof_t |
+Macros | |
#define | JAS_CMXFORM_NUMINTENTS 4 |
Number of rendering intents. More... | |
#define | jas_clrspc_create(fam, mbr) (((fam) << 8) | (mbr)) |
Create a color space. More... | |
#define | jas_clrspc_fam(clrspc) ((clrspc) >> 8) |
Get the family of a color space. More... | |
#define | jas_clrspc_mbr(clrspc) ((clrspc) & 0xff) |
Get the (family) member of a color space. More... | |
#define | jas_clrspc_isgeneric(clrspc) (!jas_clrspc_mbr(clrspc)) |
Test if a color space is generic. More... | |
#define | jas_clrspc_isunknown(clrspc) ((clrspc) & JAS_CLRSPC_UNKNOWNMASK) |
Test if a color space is unknown. More... | |
#define | JAS_CLRSPC_FAM_UNKNOWN 0 |
Color space families. More... | |
#define | JAS_CLRSPC_UNKNOWN JAS_CLRSPC_UNKNOWNMASK |
Specific color spaces. More... | |
#define | JAS_CLRSPC_GENRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 0) |
Generic color spaces. More... | |
#define | jas_cmprof_clrspc(prof) ((prof)->clrspc) |
Get the color space associated with a color-management profile. More... | |
+Typedefs | |
typedef unsigned | jas_clrspc_t |
Color space. More... | |
typedef double | jas_cmreal_t |
typedef struct jas_cmpxform_s | jas_cmpxform_t |
Transform class. More... | |
+Enumerations | |
enum | jas_cmxform_op_t |
Transform operations. More... | |
enum | jas_cmxform_intent_t |
Rendering intents. More... | |
enum | jas_cmxform_optm_t |
Transform optimization. More... | |
+Functions | |
JAS_EXPORT jas_cmprof_t * | jas_cmprof_createfromiccprof (const jas_iccprof_t *iccprof) |
Create a color-management profile from an ICC profile. More... | |
JAS_EXPORT jas_cmprof_t * | jas_cmprof_createfromclrspc (jas_clrspc_t clrspc) |
Create a color-management profile from a color space. More... | |
JAS_EXPORT void | jas_cmprof_destroy (jas_cmprof_t *prof) |
Destroy a color-management profile. More... | |
JAS_EXPORT jas_cmprof_t * | jas_cmprof_copy (const jas_cmprof_t *prof) |
Copy a color-management profile. More... | |
JAS_EXPORT jas_iccprof_t * | jas_iccprof_createfromcmprof (const jas_cmprof_t *prof) |
Create a ICC profile from a CM profile. More... | |
JAS_EXPORT jas_cmxform_t * | jas_cmxform_create (const jas_cmprof_t *inprof, const jas_cmprof_t *outprof, const jas_cmprof_t *proofprof, jas_cmxform_op_t op, jas_cmxform_intent_t intent, jas_cmxform_optm_t optimize) |
Create a transform from a CM profile. More... | |
JAS_EXPORT void | jas_cmxform_destroy (jas_cmxform_t *xform) |
Destroy a transform. More... | |
JAS_EXPORT int | jas_cmxform_apply (const jas_cmxform_t *xform, const jas_cmpixmap_t *in, jas_cmpixmap_t *out) |
Apply a transform to data. More... | |
unsigned | jas_clrspc_numchans (jas_clrspc_t clrspc) |
Get the number of channels associated with a particular color space. More... | |
JAS_EXPORT jas_iccprof_t * | jas_iccprof_load (jas_stream_t *in) |
Read an ICC profile from a stream. More... | |
JAS_EXPORT int | jas_iccprof_save (jas_iccprof_t *prof, jas_stream_t *out) |
Write an ICC profile to a stream. More... | |
JAS_EXPORT void | jas_iccprof_destroy (jas_iccprof_t *prof) |
Destroy an ICC profile. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT jas_iccattrval_t * | jas_iccprof_getattr (const jas_iccprof_t *prof, jas_iccattrname_t name) |
Get an attribute of an ICC profile. More... | |
JAS_EXPORT int | jas_iccprof_setattr (jas_iccprof_t *prof, jas_iccattrname_t name, jas_iccattrval_t *val) |
Set an attribute of an ICC profile. More... | |
JAS_EXPORT void | jas_iccprof_dump (const jas_iccprof_t *prof, FILE *out) |
Dump an ICC profile to a stream in human-readable format for debugging purposes. More... | |
JAS_EXPORT jas_iccprof_t * | jas_iccprof_copy (const jas_iccprof_t *prof) |
Create a copy of an ICC profile. More... | |
JAS_EXPORT int | jas_iccprof_gethdr (const jas_iccprof_t *prof, jas_icchdr_t *hdr) |
Get the header for an ICC profile. More... | |
JAS_EXPORT int | jas_iccprof_sethdr (jas_iccprof_t *prof, const jas_icchdr_t *hdr) |
Set the header for an ICC profile. More... | |
JAS_EXPORT void | jas_iccattrval_destroy (jas_iccattrval_t *attrval) |
Destroy an ICC profile attribute. More... | |
JAS_EXPORT int | jas_iccattrval_allowmodify (jas_iccattrval_t **attrval) |
TODO/FIXME. More... | |
JAS_EXPORT jas_iccattrval_t * | jas_iccattrval_clone (jas_iccattrval_t *attrval) |
Create a copy of an ICC profile attribute. More... | |
JAS_EXPORT jas_iccattrval_t * | jas_iccattrval_create (jas_iccuint32_t type) |
Create an ICC profile attribute. More... | |
JAS_EXPORT void | jas_iccattrtab_dump (const jas_iccattrtab_t *attrtab, FILE *out) |
Dump an ICC profile attribute to a stream in human-readable format for debugging purposes. More... | |
JAS_EXPORT jas_iccprof_t * | jas_iccprof_createfrombuf (const jas_uchar *buf, unsigned len) |
Create an ICC profile from a buffer in memory. More... | |
JAS_EXPORT jas_iccprof_t * | jas_iccprof_createfromclrspc (unsigned clrspc) |
Create an ICC profile from a color space. More... | |
Color Management.
+General information can be found here.
+#define jas_clrspc_create | +( | ++ | fam, | +
+ | + | + | mbr | +
+ | ) | +(((fam) << 8) | (mbr)) | +
Create a color space.
+ +#define jas_clrspc_fam | +( | ++ | clrspc | ) | +((clrspc) >> 8) | +
Get the family of a color space.
+ +#define JAS_CLRSPC_FAM_UNKNOWN 0 | +
Color space families.
+ +#define JAS_CLRSPC_GENRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 0) | +
Generic color spaces.
+ +#define jas_clrspc_isgeneric | +( | ++ | clrspc | ) | +(!jas_clrspc_mbr(clrspc)) | +
Test if a color space is generic.
+ +#define jas_clrspc_isunknown | +( | ++ | clrspc | ) | +((clrspc) & JAS_CLRSPC_UNKNOWNMASK) | +
Test if a color space is unknown.
+ +#define jas_clrspc_mbr | +( | ++ | clrspc | ) | +((clrspc) & 0xff) | +
Get the (family) member of a color space.
+ +#define JAS_CLRSPC_UNKNOWN JAS_CLRSPC_UNKNOWNMASK | +
Specific color spaces.
+ +#define jas_cmprof_clrspc | +( | ++ | prof | ) | +((prof)->clrspc) | +
Get the color space associated with a color-management profile.
+#define JAS_CMXFORM_NUMINTENTS 4 | +
Number of rendering intents.
+ +typedef unsigned jas_clrspc_t | +
Color space.
+ +typedef struct jas_cmpxform_s jas_cmpxform_t | +
Transform class.
+ +typedef double jas_cmreal_t | +
Real-number type.
+ +enum jas_cmxform_intent_t | +
Rendering intents.
+ +enum jas_cmxform_op_t | +
Transform operations.
+ +enum jas_cmxform_optm_t | +
Transform optimization.
+ +unsigned jas_clrspc_numchans | +( | +jas_clrspc_t | +clrspc | ) | ++ |
Get the number of channels associated with a particular color space.
+JAS_EXPORT jas_cmprof_t* jas_cmprof_copy | +( | +const jas_cmprof_t * | +prof | ) | ++ |
Copy a color-management profile.
+This function creates a clone (i.e., copy) of a CM profile.
+JAS_EXPORT jas_cmprof_t* jas_cmprof_createfromclrspc | +( | +jas_clrspc_t | +clrspc | ) | ++ |
Create a color-management profile from a color space.
+The function creates a CM profile from a color space.
+JAS_EXPORT jas_cmprof_t* jas_cmprof_createfromiccprof | +( | +const jas_iccprof_t * | +iccprof | ) | ++ |
Create a color-management profile from an ICC profile.
+This function creates a CM profile from an ICC profile.
+JAS_EXPORT void jas_cmprof_destroy | +( | +jas_cmprof_t * | +prof | ) | ++ |
Destroy a color-management profile.
+ +JAS_EXPORT int jas_cmxform_apply | +( | +const jas_cmxform_t * | +xform, | +
+ | + | const jas_cmpixmap_t * | +in, | +
+ | + | jas_cmpixmap_t * | +out | +
+ | ) | ++ |
Apply a transform to data.
+JAS_EXPORT jas_cmxform_t* jas_cmxform_create | +( | +const jas_cmprof_t * | +inprof, | +
+ | + | const jas_cmprof_t * | +outprof, | +
+ | + | const jas_cmprof_t * | +proofprof, | +
+ | + | jas_cmxform_op_t | +op, | +
+ | + | jas_cmxform_intent_t | +intent, | +
+ | + | jas_cmxform_optm_t | +optimize | +
+ | ) | ++ |
Create a transform from a CM profile.
+JAS_EXPORT void jas_cmxform_destroy | +( | +jas_cmxform_t * | +xform | ) | ++ |
Destroy a transform.
+ +JAS_EXPORT void jas_iccattrtab_dump | +( | +const jas_iccattrtab_t * | +attrtab, | +
+ | + | FILE * | +out | +
+ | ) | ++ |
Dump an ICC profile attribute to a stream in human-readable format for debugging purposes.
+ +JAS_EXPORT int jas_iccattrval_allowmodify | +( | +jas_iccattrval_t ** | +attrval | ) | ++ |
TODO/FIXME.
+ +JAS_EXPORT jas_iccattrval_t* jas_iccattrval_clone | +( | +jas_iccattrval_t * | +attrval | ) | ++ |
Create a copy of an ICC profile attribute.
+ +JAS_EXPORT jas_iccattrval_t* jas_iccattrval_create | +( | +jas_iccuint32_t | +type | ) | ++ |
Create an ICC profile attribute.
+ +JAS_EXPORT void jas_iccattrval_destroy | +( | +jas_iccattrval_t * | +attrval | ) | ++ |
Destroy an ICC profile attribute.
+ +JAS_EXPORT jas_iccprof_t* jas_iccprof_copy | +( | +const jas_iccprof_t * | +prof | ) | ++ |
Create a copy of an ICC profile.
+ +JAS_EXPORT jas_iccprof_t* jas_iccprof_createfrombuf | +( | +const jas_uchar * | +buf, | +
+ | + | unsigned | +len | +
+ | ) | ++ |
Create an ICC profile from a buffer in memory.
+ +JAS_EXPORT jas_iccprof_t* jas_iccprof_createfromclrspc | +( | +unsigned | +clrspc | ) | ++ |
Create an ICC profile from a color space.
+ +JAS_EXPORT jas_iccprof_t* jas_iccprof_createfromcmprof | +( | +const jas_cmprof_t * | +prof | ) | ++ |
Create a ICC profile from a CM profile.
+This function creates an ICC profile from a CM profile.
+JAS_EXPORT void jas_iccprof_destroy | +( | +jas_iccprof_t * | +prof | ) | ++ |
Destroy an ICC profile.
+ +JAS_EXPORT void jas_iccprof_dump | +( | +const jas_iccprof_t * | +prof, | +
+ | + | FILE * | +out | +
+ | ) | ++ |
Dump an ICC profile to a stream in human-readable format for debugging purposes.
+ +JAS_ATTRIBUTE_PURE JAS_EXPORT jas_iccattrval_t* jas_iccprof_getattr | +( | +const jas_iccprof_t * | +prof, | +
+ | + | jas_iccattrname_t | +name | +
+ | ) | ++ |
Get an attribute of an ICC profile.
+ +JAS_EXPORT int jas_iccprof_gethdr | +( | +const jas_iccprof_t * | +prof, | +
+ | + | jas_icchdr_t * | +hdr | +
+ | ) | ++ |
Get the header for an ICC profile.
+ +JAS_EXPORT jas_iccprof_t* jas_iccprof_load | +( | +jas_stream_t * | +in | ) | ++ |
Read an ICC profile from a stream.
+ +JAS_EXPORT int jas_iccprof_save | +( | +jas_iccprof_t * | +prof, | +
+ | + | jas_stream_t * | +out | +
+ | ) | ++ |
Write an ICC profile to a stream.
+ +JAS_EXPORT int jas_iccprof_setattr | +( | +jas_iccprof_t * | +prof, | +
+ | + | jas_iccattrname_t | +name, | +
+ | + | jas_iccattrval_t * | +val | +
+ | ) | ++ |
Set an attribute of an ICC profile.
+ +JAS_EXPORT int jas_iccprof_sethdr | +( | +jas_iccprof_t * | +prof, | +
+ | + | const jas_icchdr_t * | +hdr | +
+ | ) | ++ |
Set the header for an ICC profile.
+ +Fixed-Point Arithmetic. +More...
++Macros | |
#define | JAS_FIX_ZERO(fix_t, fracbits) JAS_INTTOFIX(fix_t, fracbits, 0) |
#define | JAS_FIX_ONE(fix_t, fracbits) JAS_INTTOFIX(fix_t, fracbits, 1) |
#define | JAS_FIX_HALF(fix_t, fracbits) (JAS_CAST(fix_t, 1) << ((fracbits) - 1)) |
#define | JAS_INTTOFIX(fix_t, fracbits, x) (JAS_CAST(fix_t, x) << (fracbits)) |
#define | JAS_FIXTOINT(fix_t, fracbits, x) JAS_CAST(int, (x) >> (fracbits)) |
#define | JAS_FIXTODBL(fix_t, fracbits, x) (JAS_CAST(double, x) / JAS_FIX_ONE(fix_t, fracbits)) |
#define | JAS_DBLTOFIX(fix_t, fracbits, x) JAS_CAST(fix_t, ((x) * JAS_CAST(double, JAS_FIX_ONE(fix_t, fracbits)))) |
#define | JAS_FIX_ADD JAS_FIX_ADD_FAST |
#define | JAS_FIX_ADD_FAST(fix_t, fracbits, x, y) ((x) + (y)) |
#define | JAS_FIX_ADD_OFLOW(fix_t, fracbits, x, y) |
#define | JAS_FIX_MUL JAS_FIX_MUL_FAST |
#define | JAS_FIX_MUL_FAST(fix_t, fracbits, bigfix_t, x, y) |
#define | JAS_FIX_MUL_OFLOW(fix_t, fracbits, bigfix_t, x, y) |
#define | JAS_FIX_MULBYINT JAS_FIX_MULBYINT_FAST |
#define | JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y) JAS_CAST(fix_t, ((x) * (y))) |
#define | JAS_FIX_MULBYINT_OFLOW(fix_t, fracbits, x, y) JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y) |
#define | JAS_FIX_DIV JAS_FIX_DIV_FAST |
#define | JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y) JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) << (fracbits)) / (y)) |
#define | JAS_FIX_DIV_UFLOW(fix_t, fracbits, bigfix_t, x, y) JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y) |
#define | JAS_FIX_NEG JAS_FIX_NEG_FAST |
#define | JAS_FIX_NEG_FAST(fix_t, fracbits, x) (-(x)) |
#define | JAS_FIX_NEG_OFLOW(fix_t, fracbits, x) (((x) < 0) ? (-(x) > 0 || JAS_FIX_OFLOW(), -(x)) : (-(x))) |
#define | JAS_FIX_ASL JAS_FIX_ASL_FAST |
#define | JAS_FIX_ASL_FAST(fix_t, fracbits, x, n) ((x) << (n)) |
#define | JAS_FIX_ASL_OFLOW(fix_t, fracbits, x, n) ((((x) << (n)) >> (n)) == (x) || JAS_FIX_OFLOW(), (x) << (n)) |
#define | JAS_FIX_ASR JAS_FIX_ASR_FAST |
#define | JAS_FIX_ASR_FAST(fix_t, fracbits, x, n) ((x) >> (n)) |
#define | JAS_FIX_ASR_UFLOW(fix_t, fracbits, x, n) JAS_FIX_ASR_FAST(fix_t, fracbits, x, n) |
#define | JAS_FIX_SUB(fix_t, fracbits, x, y) JAS_FIX_ADD(fix_t, fracbits, x, JAS_FIX_NEG(fix_t, fracbits, y)) |
#define | JAS_FIX_PLUSEQ(fix_t, fracbits, x, y) ((x) = JAS_FIX_ADD(fix_t, fracbits, x, y)) |
#define | JAS_FIX_MINUSEQ(fix_t, fracbits, x, y) ((x) = JAS_FIX_SUB(fix_t, fracbits, x, y)) |
#define | JAS_FIX_MULEQ(fix_t, fracbits, bigfix_t, x, y) ((x) = JAS_FIX_MUL(fix_t, fracbits, bigfix_t, x, y)) |
#define | JAS_FIX_ABS(fix_t, fracbits, x) (((x) >= 0) ? (x) : (JAS_FIX_NEG(fix_t, fracbits, x))) |
#define | JAS_FIX_ISINT(fix_t, fracbits, x) (JAS_FIX_FLOOR(fix_t, fracbits, x) == (x)) |
#define | JAS_FIX_SGN(fix_t, fracbits, x) ((x) >= 0 ? 1 : (-1)) |
#define | JAS_FIX_CMP(fix_t, fracbits, x, y) ((x) > (y) ? 1 : (((x) == (y)) ? 0 : (-1))) |
#define | JAS_FIX_LT(fix_t, fracbits, x, y) ((x) < (y)) |
#define | JAS_FIX_LTE(fix_t, fracbits, x, y) ((x) <= (y)) |
#define | JAS_FIX_GT(fix_t, fracbits, x, y) ((x) > (y)) |
#define | JAS_FIX_GTE(fix_t, fracbits, x, y) ((x) >= (y)) |
#define | JAS_FIX_ROUND(fix_t, fracbits, x) |
#define | JAS_FIX_FLOOR(fix_t, fracbits, x) ((x) & (~(JAS_FIX_ONE(fix_t, fracbits) - 1))) |
+Typedefs | |
typedef int_least64_t | jas_fix_t |
Fixed-Point Arithmetic.
+#define JAS_DBLTOFIX | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x | +
+ | ) | +JAS_CAST(fix_t, ((x) * JAS_CAST(double, JAS_FIX_ONE(fix_t, fracbits)))) | +
Convert a double to a fixed-point number.
+ +#define JAS_FIX_ABS | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x | +
+ | ) | +(((x) >= 0) ? (x) : (JAS_FIX_NEG(fix_t, fracbits, x))) | +
Calculate the absolute value of a fixed-point number.
+ +#define JAS_FIX_ADD JAS_FIX_ADD_FAST | +
Calculate the sum of two fixed-point numbers.
+ +#define JAS_FIX_ADD_FAST | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +((x) + (y)) | +
Calculate the sum of two fixed-point numbers without overflow checking.
+ +#define JAS_FIX_ADD_OFLOW | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | ++ |
Calculate the sum of two fixed-point numbers with overflow checking.
+ +#define JAS_FIX_ASL JAS_FIX_ASL_FAST | +
Perform an arithmetic shift left of a fixed-point number.
+ +#define JAS_FIX_ASL_FAST | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | n | +
+ | ) | +((x) << (n)) | +
Perform an arithmetic shift left of a fixed-point number without overflow checking.
+ +#define JAS_FIX_ASL_OFLOW | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | n | +
+ | ) | +((((x) << (n)) >> (n)) == (x) || JAS_FIX_OFLOW(), (x) << (n)) | +
Perform an arithmetic shift left of a fixed-point number with overflow checking.
+ +#define JAS_FIX_ASR JAS_FIX_ASR_FAST | +
Perform an arithmetic shift right of a fixed-point number.
+ +#define JAS_FIX_ASR_FAST | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | n | +
+ | ) | +((x) >> (n)) | +
Perform an arithmetic shift right of a fixed-point number without underflow checking.
+ +#define JAS_FIX_ASR_UFLOW | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | n | +
+ | ) | +JAS_FIX_ASR_FAST(fix_t, fracbits, x, n) | +
Perform an arithmetic shift right of a fixed-point number with underflow checking.
+ +#define JAS_FIX_CMP | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +((x) > (y) ? 1 : (((x) == (y)) ? 0 : (-1))) | +
Compare two fixed-point numbers.
+ +#define JAS_FIX_DIV JAS_FIX_DIV_FAST | +
Calculate the quotient of two fixed-point numbers.
+ +#define JAS_FIX_DIV_FAST | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | bigfix_t, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) << (fracbits)) / (y)) | +
Calculate the quotient of two fixed-point numbers without underflow checking.
+ +#define JAS_FIX_DIV_UFLOW | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | bigfix_t, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y) | +
Calculate the quotient of two fixed-point numbers with underflow checking.
+ +#define JAS_FIX_FLOOR | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x | +
+ | ) | +((x) & (~(JAS_FIX_ONE(fix_t, fracbits) - 1))) | +
Round a fixed-point number to the nearest integer in the direction of negative infinity (i.e., the floor function).
+ +#define JAS_FIX_GT | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +((x) > (y)) | +
Greater than.
+ +#define JAS_FIX_GTE | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +((x) >= (y)) | +
Greater than or equal.
+ +#define JAS_FIX_HALF | +( | ++ | fix_t, | +
+ | + | + | fracbits | +
+ | ) | +(JAS_CAST(fix_t, 1) << ((fracbits) - 1)) | +
The representation of the value one half.
+ +#define JAS_FIX_ISINT | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x | +
+ | ) | +(JAS_FIX_FLOOR(fix_t, fracbits, x) == (x)) | +
Is a fixed-point number an integer?
+ +#define JAS_FIX_LT | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +((x) < (y)) | +
Less than.
+ +#define JAS_FIX_LTE | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +((x) <= (y)) | +
Less than or equal.
+ +#define JAS_FIX_MINUSEQ | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +((x) = JAS_FIX_SUB(fix_t, fracbits, x, y)) | +
Subtract one fixed-point number from another.
+ +#define JAS_FIX_MUL JAS_FIX_MUL_FAST | +
Calculate the product of two fixed-point numbers.
+ +#define JAS_FIX_MUL_FAST | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | bigfix_t, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | ++ |
Calculate the product of two fixed-point numbers without overflow checking.
+ +#define JAS_FIX_MUL_OFLOW | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | bigfix_t, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | ++ |
Calculate the product of two fixed-point numbers with overflow checking.
+ +#define JAS_FIX_MULBYINT JAS_FIX_MULBYINT_FAST | +
Calculate the product of a fixed-point number and an int.
+ +#define JAS_FIX_MULBYINT_FAST | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +JAS_CAST(fix_t, ((x) * (y))) | +
Calculate the product of a fixed-point number and an int without overflow checking.
+ +#define JAS_FIX_MULBYINT_OFLOW | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y) | +
Calculate the product of a fixed-point number and an int with overflow checking.
+ +#define JAS_FIX_MULEQ | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | bigfix_t, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +((x) = JAS_FIX_MUL(fix_t, fracbits, bigfix_t, x, y)) | +
Multiply one fixed-point number by another.
+ +#define JAS_FIX_NEG JAS_FIX_NEG_FAST | +
Negate a fixed-point number.
+ +#define JAS_FIX_NEG_FAST | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x | +
+ | ) | +(-(x)) | +
Negate a fixed-point number without overflow checking.
+ +#define JAS_FIX_NEG_OFLOW | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x | +
+ | ) | +(((x) < 0) ? (-(x) > 0 || JAS_FIX_OFLOW(), -(x)) : (-(x))) | +
Negate a fixed-point number with overflow checking.
+ +#define JAS_FIX_ONE | +( | ++ | fix_t, | +
+ | + | + | fracbits | +
+ | ) | +JAS_INTTOFIX(fix_t, fracbits, 1) | +
The representation of the value one.
+ +#define JAS_FIX_PLUSEQ | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +((x) = JAS_FIX_ADD(fix_t, fracbits, x, y)) | +
Add one fixed-point number to another.
+ +#define JAS_FIX_ROUND | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x | +
+ | ) | ++ |
Round a fixed-point number to the nearest integer.
+ +#define JAS_FIX_SGN | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x | +
+ | ) | +((x) >= 0 ? 1 : (-1)) | +
Get the sign of a fixed-point number.
+ +#define JAS_FIX_SUB | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x, | +
+ | + | + | y | +
+ | ) | +JAS_FIX_ADD(fix_t, fracbits, x, JAS_FIX_NEG(fix_t, fracbits, y)) | +
Calculate the difference between two fixed-point numbers.
+ +#define JAS_FIX_ZERO | +( | ++ | fix_t, | +
+ | + | + | fracbits | +
+ | ) | +JAS_INTTOFIX(fix_t, fracbits, 0) | +
The representation of the value zero.
+ +#define JAS_FIXTODBL | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x | +
+ | ) | +(JAS_CAST(double, x) / JAS_FIX_ONE(fix_t, fracbits)) | +
Convert a fixed-point number to a double.
+ +#define JAS_FIXTOINT | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x | +
+ | ) | +JAS_CAST(int, (x) >> (fracbits)) | +
Convert a fixed-point number to an int.
+ +#define JAS_INTTOFIX | +( | ++ | fix_t, | +
+ | + | + | fracbits, | +
+ | + | + | x | +
+ | ) | +(JAS_CAST(fix_t, x) << (fracbits)) | +
Convert an int to a fixed-point number.
+ +typedef int_least64_t jas_fix_t | +
Integral type used for fixed-point representations.
+ +Command-Line Interface (CLI) Option Processing. +More...
++Classes | |
struct | jas_opt_t |
Command line option type. More... | |
+Macros | |
#define | JAS_GETOPT_EOF (-1) |
#define | JAS_GETOPT_ERR '?' |
#define | JAS_OPT_HASARG 0x01 /* option has argument */ |
+Functions | |
JAS_EXPORT int | jas_getopt (int argc, char **argv, const jas_opt_t *opts) |
Get the next option. More... | |
+Variables | |
JAS_EXPORT int | jas_optind |
The current option index. More... | |
JAS_EXPORT const char * | jas_optarg |
The current option argument. More... | |
JAS_EXPORT int | jas_opterr |
The debug level. More... | |
Command-Line Interface (CLI) Option Processing.
+General information can be found here.
+#define JAS_GETOPT_EOF (-1) | +
Last CLI option.
+ +#define JAS_GETOPT_ERR '?' | +
Error while processing CLI options.
+ +#define JAS_OPT_HASARG 0x01 /* option has argument */ | +
Option has argument.
+ +JAS_EXPORT int jas_getopt | +( | +int | +argc, | +
+ | + | char ** | +argv, | +
+ | + | const jas_opt_t * | +opts | +
+ | ) | ++ |
Get the next option.
+Gets the next CLI option.
+jas_optind
, jas_optarg
, and jas_opterr
.
+
|
+ +extern | +
The current option argument.
+ +
+
|
+ +extern | +
The debug level.
+ +
+
|
+ +extern | +
The current option index.
+ +Image Representation. +More...
++Classes | |
struct | jas_image_cmpt_t |
Image component class. More... | |
struct | jas_image_t |
Image class. More... | |
struct | jas_image_cmptparm_t |
Component parameters class. More... | |
struct | jas_image_fmtops_t |
Image format-dependent operations. More... | |
struct | jas_image_fmtinfo_t |
Image format information. More... | |
+Macros | |
#define | JAS_IMAGE_MAXFMTS 32 |
The maximum number of image data formats supported. More... | |
#define | jas_image_width(image) ((image)->brx_ - (image)->tlx_) |
Get the width of the image in units of the image reference grid. More... | |
#define | jas_image_height(image) ((image)->bry_ - (image)->tly_) |
Get the height of the image in units of the image reference grid. More... | |
#define | jas_image_tlx(image) ((image)->tlx_) |
Get the x-coordinate of the top-left corner of the image bounding box on the reference grid. More... | |
#define | jas_image_tly(image) ((image)->tly_) |
Get the y-coordinate of the top-left corner of the image bounding box on the reference grid. More... | |
#define | jas_image_brx(image) ((image)->brx_) |
Get the x-coordinate of the bottom-right corner of the image bounding box on the reference grid (plus one). More... | |
#define | jas_image_bry(image) ((image)->bry_) |
Get the y-coordinate of the bottom-right corner of the image bounding box on the reference grid (plus one). More... | |
#define | jas_image_numcmpts(image) ((image)->numcmpts_) |
Get the number of image components. More... | |
#define | jas_image_clrspc(image) ((image)->clrspc_) |
Get the color model used by the image. More... | |
#define | jas_image_setclrspc(image, clrspc) ((image)->clrspc_ = (clrspc)) |
Set the color model for an image. More... | |
#define | jas_image_cmptwidth(image, cmptno) ((image)->cmpts_[cmptno]->width_) |
Get the width of a component. More... | |
#define | jas_image_cmptheight(image, cmptno) ((image)->cmpts_[cmptno]->height_) |
Get the height of a component. More... | |
#define | jas_image_cmptsgnd(image, cmptno) ((image)->cmpts_[cmptno]->sgnd_) |
Get the signedness of the sample data for a component. More... | |
#define | jas_image_cmptprec(image, cmptno) ((image)->cmpts_[cmptno]->prec_) |
Get the precision of the sample data for a component. More... | |
#define | jas_image_cmpthstep(image, cmptno) ((image)->cmpts_[cmptno]->hstep_) |
Get the horizontal subsampling factor for a component. More... | |
#define | jas_image_cmptvstep(image, cmptno) ((image)->cmpts_[cmptno]->vstep_) |
Get the vertical subsampling factor for a component. More... | |
#define | jas_image_cmpttlx(image, cmptno) ((image)->cmpts_[cmptno]->tlx_) |
Get the x-coordinate of the top-left corner of a component. More... | |
#define | jas_image_cmpttly(image, cmptno) ((image)->cmpts_[cmptno]->tly_) |
Get the y-coordinate of the top-left corner of a component. More... | |
#define | jas_image_cmptbrx(image, cmptno) |
Get the x-coordinate of the bottom-right corner of a component (plus "one"). More... | |
#define | jas_image_cmptbry(image, cmptno) |
Get the y-coordinate of the bottom-right corner of a component (plus "one"). More... | |
#define | jas_image_cmprof(image) ((image)->cmprof_) |
Get the color management profile of an image. More... | |
#define | jas_image_setcmprof(image, cmprof) ((image)->cmprof_ = cmprof) |
Set the color management profile for an image. More... | |
+Typedefs | |
typedef int_fast32_t | jas_image_coord_t |
Image coordinate. More... | |
typedef int_fast16_t | jas_image_colorspc_t |
Color space (e.g., RGB, YCbCr). More... | |
typedef int_fast32_t | jas_image_cmpttype_t |
Component type (e.g., color, opacity). More... | |
typedef int_fast16_t | jas_image_smpltype_t |
Component sample data format (e.g., real/integer, signedness, precision). More... | |
+Functions | |
JAS_EXPORT jas_image_t * | jas_image_create (unsigned numcmpts, const jas_image_cmptparm_t *cmptparms, jas_clrspc_t clrspc) |
Create an image. More... | |
JAS_EXPORT jas_image_t * | jas_image_create0 (void) |
Create an "empty" image. More... | |
JAS_EXPORT jas_image_t * | jas_image_copy (jas_image_t *image) |
Clone an image. More... | |
JAS_EXPORT void | jas_image_destroy (jas_image_t *image) |
Deallocate any resources associated with an image. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT bool | jas_image_cmpt_domains_same (const jas_image_t *image) |
Test if all components are specified at the same positions in space. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT uint_fast32_t | jas_image_rawsize (const jas_image_t *image) |
Get the raw size of an image (i.e., the nominal size of the image without any compression. More... | |
JAS_EXPORT jas_image_t * | jas_image_decode (jas_stream_t *in, int fmt, const char *optstr) |
Create an image from a stream in some specified format. More... | |
JAS_EXPORT int | jas_image_encode (jas_image_t *image, jas_stream_t *out, int fmt, const char *optstr) |
Write an image to a stream in a specified format. More... | |
JAS_EXPORT int | jas_image_readcmpt (jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, jas_matrix_t *data) |
Read a rectangular region of an image component. More... | |
JAS_EXPORT int | jas_image_writecmpt (jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, const jas_matrix_t *data) |
Write a rectangular region of an image component. More... | |
JAS_EXPORT void | jas_image_delcmpt (jas_image_t *image, unsigned cmptno) |
Delete a component from an image. More... | |
JAS_EXPORT int | jas_image_addcmpt (jas_image_t *image, int cmptno, const jas_image_cmptparm_t *cmptparm) |
Add a component to an image. More... | |
JAS_EXPORT int | jas_image_copycmpt (jas_image_t *dstimage, unsigned dstcmptno, jas_image_t *srcimage, unsigned srccmptno) |
Copy a component from one image to another. More... | |
JAS_EXPORT int | jas_image_depalettize (jas_image_t *image, unsigned cmptno, unsigned numlutents, const int_fast32_t *lutents, unsigned dtype, unsigned newcmptno) |
Depalettize an image. More... | |
JAS_EXPORT int | jas_image_readcmptsample (jas_image_t *image, unsigned cmptno, unsigned x, unsigned y) |
Read a component sample for an image. More... | |
JAS_EXPORT void | jas_image_writecmptsample (jas_image_t *image, unsigned cmptno, unsigned x, unsigned y, int_fast32_t v) |
Write a component sample for an image. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT int | jas_image_getcmptbytype (const jas_image_t *image, jas_image_cmpttype_t ctype) |
Get an image component by its type. More... | |
JAS_EXPORT void | jas_image_clearfmts (void) |
Clear the table of image formats. More... | |
JAS_EXPORT const jas_image_fmtinfo_t * | jas_image_getfmtbyind (int index) |
Get a image format entry by its table index. More... | |
JAS_EXPORT int | jas_image_getnumfmts (void) |
Get the number of image format table entries. More... | |
JAS_EXPORT int | jas_image_setfmtenable (int index, int enabled) |
Get the number of image format table entries. More... | |
JAS_EXPORT int | jas_image_addfmt (int id, const char *name, const char *ext, const char *desc, const jas_image_fmtops_t *ops) |
Add entry to table of image formats. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT int | jas_image_strtofmt (const char *s) |
Get the ID for the image format with the specified name. More... | |
JAS_ATTRIBUTE_CONST JAS_EXPORT const char * | jas_image_fmttostr (int fmt) |
Get the name of the image format with the specified ID. More... | |
JAS_ATTRIBUTE_CONST JAS_EXPORT const jas_image_fmtinfo_t * | jas_image_lookupfmtbyid (int id) |
Lookup image format information by the format ID. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT const jas_image_fmtinfo_t * | jas_image_lookupfmtbyname (const char *name) |
Lookup image format information by the format name. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT int | jas_image_fmtfromname (const char *filename) |
Guess the format of an image file based on its name. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT int | jas_image_getfmt (jas_stream_t *in) |
Get the format of image data in a stream. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT int | jas_image_ishomosamp (const jas_image_t *image) |
Test if the sampling of the image is homogeneous. More... | |
JAS_EXPORT int | jas_image_sampcmpt (jas_image_t *image, unsigned cmptno, unsigned newcmptno, jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs, jas_image_coord_t vs, int sgnd, unsigned prec) |
??? More... | |
JAS_EXPORT int | jas_image_writecmpt2 (jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, const long *buf) |
Write sample data in a component of an image. More... | |
JAS_EXPORT int | jas_image_readcmpt2 (jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, long *buf) |
Read sample data in a component of an image. More... | |
JAS_EXPORT jas_image_t * | jas_image_chclrspc (jas_image_t *image, const jas_cmprof_t *outprof, jas_cmxform_intent_t intent) |
Change the color space for an image. More... | |
JAS_EXPORT int | jas_image_dump (jas_image_t *image, FILE *out) |
Dump the information for an image (for debugging). More... | |
Image Representation.
+General information can be found here.
+#define jas_image_brx | +( | ++ | image | ) | +((image)->brx_) | +
Get the x-coordinate of the bottom-right corner of the image bounding box on the reference grid (plus one).
+ +#define jas_image_bry | +( | ++ | image | ) | +((image)->bry_) | +
Get the y-coordinate of the bottom-right corner of the image bounding box on the reference grid (plus one).
+ +#define jas_image_clrspc | +( | ++ | image | ) | +((image)->clrspc_) | +
Get the color model used by the image.
+ +#define jas_image_cmprof | +( | ++ | image | ) | +((image)->cmprof_) | +
Get the color management profile of an image.
+ +#define jas_image_cmptbrx | +( | ++ | image, | +
+ | + | + | cmptno | +
+ | ) | ++ |
Get the x-coordinate of the bottom-right corner of a component (plus "one").
+ +#define jas_image_cmptbry | +( | ++ | image, | +
+ | + | + | cmptno | +
+ | ) | ++ |
Get the y-coordinate of the bottom-right corner of a component (plus "one").
+ +#define jas_image_cmptheight | +( | ++ | image, | +
+ | + | + | cmptno | +
+ | ) | +((image)->cmpts_[cmptno]->height_) | +
Get the height of a component.
+ +#define jas_image_cmpthstep | +( | ++ | image, | +
+ | + | + | cmptno | +
+ | ) | +((image)->cmpts_[cmptno]->hstep_) | +
Get the horizontal subsampling factor for a component.
+ +#define jas_image_cmptprec | +( | ++ | image, | +
+ | + | + | cmptno | +
+ | ) | +((image)->cmpts_[cmptno]->prec_) | +
Get the precision of the sample data for a component.
+ +#define jas_image_cmptsgnd | +( | ++ | image, | +
+ | + | + | cmptno | +
+ | ) | +((image)->cmpts_[cmptno]->sgnd_) | +
Get the signedness of the sample data for a component.
+ +#define jas_image_cmpttlx | +( | ++ | image, | +
+ | + | + | cmptno | +
+ | ) | +((image)->cmpts_[cmptno]->tlx_) | +
Get the x-coordinate of the top-left corner of a component.
+ +#define jas_image_cmpttly | +( | ++ | image, | +
+ | + | + | cmptno | +
+ | ) | +((image)->cmpts_[cmptno]->tly_) | +
Get the y-coordinate of the top-left corner of a component.
+ +#define jas_image_cmptvstep | +( | ++ | image, | +
+ | + | + | cmptno | +
+ | ) | +((image)->cmpts_[cmptno]->vstep_) | +
Get the vertical subsampling factor for a component.
+ +#define jas_image_cmptwidth | +( | ++ | image, | +
+ | + | + | cmptno | +
+ | ) | +((image)->cmpts_[cmptno]->width_) | +
Get the width of a component.
+ +#define jas_image_height | +( | ++ | image | ) | +((image)->bry_ - (image)->tly_) | +
Get the height of the image in units of the image reference grid.
+ +#define JAS_IMAGE_MAXFMTS 32 | +
The maximum number of image data formats supported.
+ +#define jas_image_numcmpts | +( | ++ | image | ) | +((image)->numcmpts_) | +
Get the number of image components.
+ +#define jas_image_setclrspc | +( | ++ | image, | +
+ | + | + | clrspc | +
+ | ) | +((image)->clrspc_ = (clrspc)) | +
Set the color model for an image.
+ +#define jas_image_setcmprof | +( | ++ | image, | +
+ | + | + | cmprof | +
+ | ) | +((image)->cmprof_ = cmprof) | +
Set the color management profile for an image.
+ +#define jas_image_tlx | +( | ++ | image | ) | +((image)->tlx_) | +
Get the x-coordinate of the top-left corner of the image bounding box on the reference grid.
+ +#define jas_image_tly | +( | ++ | image | ) | +((image)->tly_) | +
Get the y-coordinate of the top-left corner of the image bounding box on the reference grid.
+ +#define jas_image_width | +( | ++ | image | ) | +((image)->brx_ - (image)->tlx_) | +
Get the width of the image in units of the image reference grid.
+ +typedef int_fast32_t jas_image_cmpttype_t | +
Component type (e.g., color, opacity).
+ +typedef int_fast16_t jas_image_colorspc_t | +
Color space (e.g., RGB, YCbCr).
+ +typedef int_fast32_t jas_image_coord_t | +
Image coordinate.
+ +typedef int_fast16_t jas_image_smpltype_t | +
Component sample data format (e.g., real/integer, signedness, precision).
+ +JAS_EXPORT int jas_image_addcmpt | +( | +jas_image_t * | +image, | +
+ | + | int | +cmptno, | +
+ | + | const jas_image_cmptparm_t * | +cmptparm | +
+ | ) | ++ |
Add a component to an image.
+ +JAS_EXPORT int jas_image_addfmt | +( | +int | +id, | +
+ | + | const char * | +name, | +
+ | + | const char * | +ext, | +
+ | + | const char * | +desc, | +
+ | + | const jas_image_fmtops_t * | +ops | +
+ | ) | ++ |
Add entry to table of image formats.
+ +JAS_EXPORT jas_image_t* jas_image_chclrspc | +( | +jas_image_t * | +image, | +
+ | + | const jas_cmprof_t * | +outprof, | +
+ | + | jas_cmxform_intent_t | +intent | +
+ | ) | ++ |
Change the color space for an image.
+ +JAS_EXPORT void jas_image_clearfmts | +( | +void | +) | ++ |
Clear the table of image formats.
+ +JAS_ATTRIBUTE_PURE JAS_EXPORT bool jas_image_cmpt_domains_same | +( | +const jas_image_t * | +image | ) | ++ |
Test if all components are specified at the same positions in space.
+ +JAS_EXPORT jas_image_t* jas_image_copy | +( | +jas_image_t * | +image | ) | ++ |
Clone an image.
+ +JAS_EXPORT int jas_image_copycmpt | +( | +jas_image_t * | +dstimage, | +
+ | + | unsigned | +dstcmptno, | +
+ | + | jas_image_t * | +srcimage, | +
+ | + | unsigned | +srccmptno | +
+ | ) | ++ |
Copy a component from one image to another.
+ +JAS_EXPORT jas_image_t* jas_image_create | +( | +unsigned | +numcmpts, | +
+ | + | const jas_image_cmptparm_t * | +cmptparms, | +
+ | + | jas_clrspc_t | +clrspc | +
+ | ) | ++ |
Create an image.
+ +JAS_EXPORT jas_image_t* jas_image_create0 | +( | +void | +) | ++ |
Create an "empty" image.
+ +JAS_EXPORT jas_image_t* jas_image_decode | +( | +jas_stream_t * | +in, | +
+ | + | int | +fmt, | +
+ | + | const char * | +optstr | +
+ | ) | ++ |
Create an image from a stream in some specified format.
+ +JAS_EXPORT void jas_image_delcmpt | +( | +jas_image_t * | +image, | +
+ | + | unsigned | +cmptno | +
+ | ) | ++ |
Delete a component from an image.
+ +JAS_EXPORT int jas_image_depalettize | +( | +jas_image_t * | +image, | +
+ | + | unsigned | +cmptno, | +
+ | + | unsigned | +numlutents, | +
+ | + | const int_fast32_t * | +lutents, | +
+ | + | unsigned | +dtype, | +
+ | + | unsigned | +newcmptno | +
+ | ) | ++ |
Depalettize an image.
+ +JAS_EXPORT void jas_image_destroy | +( | +jas_image_t * | +image | ) | ++ |
Deallocate any resources associated with an image.
+ +JAS_EXPORT int jas_image_dump | +( | +jas_image_t * | +image, | +
+ | + | FILE * | +out | +
+ | ) | ++ |
Dump the information for an image (for debugging).
+ +JAS_EXPORT int jas_image_encode | +( | +jas_image_t * | +image, | +
+ | + | jas_stream_t * | +out, | +
+ | + | int | +fmt, | +
+ | + | const char * | +optstr | +
+ | ) | ++ |
Write an image to a stream in a specified format.
+ +JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_fmtfromname | +( | +const char * | +filename | ) | ++ |
Guess the format of an image file based on its name.
+ +JAS_ATTRIBUTE_CONST JAS_EXPORT const char* jas_image_fmttostr | +( | +int | +fmt | ) | ++ |
Get the name of the image format with the specified ID.
+ +JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_getcmptbytype | +( | +const jas_image_t * | +image, | +
+ | + | jas_image_cmpttype_t | +ctype | +
+ | ) | ++ |
Get an image component by its type.
+ +JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_getfmt | +( | +jas_stream_t * | +in | ) | ++ |
Get the format of image data in a stream.
+Note that only enabled codecs are used in determining the image format.
+ +JAS_EXPORT const jas_image_fmtinfo_t* jas_image_getfmtbyind | +( | +int | +index | ) | ++ |
Get a image format entry by its table index.
+ +JAS_EXPORT int jas_image_getnumfmts | +( | +void | +) | ++ |
Get the number of image format table entries.
+ +JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_ishomosamp | +( | +const jas_image_t * | +image | ) | ++ |
Test if the sampling of the image is homogeneous.
+ +JAS_ATTRIBUTE_CONST JAS_EXPORT const jas_image_fmtinfo_t* jas_image_lookupfmtbyid | +( | +int | +id | ) | ++ |
Lookup image format information by the format ID.
+ +JAS_ATTRIBUTE_PURE JAS_EXPORT const jas_image_fmtinfo_t* jas_image_lookupfmtbyname | +( | +const char * | +name | ) | ++ |
Lookup image format information by the format name.
+ +JAS_ATTRIBUTE_PURE JAS_EXPORT uint_fast32_t jas_image_rawsize | +( | +const jas_image_t * | +image | ) | ++ |
Get the raw size of an image (i.e., the nominal size of the image without any compression.
+ +JAS_EXPORT int jas_image_readcmpt | +( | +jas_image_t * | +image, | +
+ | + | unsigned | +cmptno, | +
+ | + | jas_image_coord_t | +x, | +
+ | + | jas_image_coord_t | +y, | +
+ | + | jas_image_coord_t | +width, | +
+ | + | jas_image_coord_t | +height, | +
+ | + | jas_matrix_t * | +data | +
+ | ) | ++ |
Read a rectangular region of an image component.
+The position and size of the rectangular region to be read is specified relative to the component's coordinate system.
+ +JAS_EXPORT int jas_image_readcmpt2 | +( | +jas_image_t * | +image, | +
+ | + | unsigned | +cmptno, | +
+ | + | jas_image_coord_t | +x, | +
+ | + | jas_image_coord_t | +y, | +
+ | + | jas_image_coord_t | +width, | +
+ | + | jas_image_coord_t | +height, | +
+ | + | long * | +buf | +
+ | ) | ++ |
Read sample data in a component of an image.
+ +JAS_EXPORT int jas_image_readcmptsample | +( | +jas_image_t * | +image, | +
+ | + | unsigned | +cmptno, | +
+ | + | unsigned | +x, | +
+ | + | unsigned | +y | +
+ | ) | ++ |
Read a component sample for an image.
+ +JAS_EXPORT int jas_image_sampcmpt | +( | +jas_image_t * | +image, | +
+ | + | unsigned | +cmptno, | +
+ | + | unsigned | +newcmptno, | +
+ | + | jas_image_coord_t | +ho, | +
+ | + | jas_image_coord_t | +vo, | +
+ | + | jas_image_coord_t | +hs, | +
+ | + | jas_image_coord_t | +vs, | +
+ | + | int | +sgnd, | +
+ | + | unsigned | +prec | +
+ | ) | ++ |
???
+ +JAS_EXPORT int jas_image_setfmtenable | +( | +int | +index, | +
+ | + | int | +enabled | +
+ | ) | ++ |
Get the number of image format table entries.
+JAS_ATTRIBUTE_PURE JAS_EXPORT int jas_image_strtofmt | +( | +const char * | +s | ) | ++ |
Get the ID for the image format with the specified name.
+ +JAS_EXPORT int jas_image_writecmpt | +( | +jas_image_t * | +image, | +
+ | + | unsigned | +cmptno, | +
+ | + | jas_image_coord_t | +x, | +
+ | + | jas_image_coord_t | +y, | +
+ | + | jas_image_coord_t | +width, | +
+ | + | jas_image_coord_t | +height, | +
+ | + | const jas_matrix_t * | +data | +
+ | ) | ++ |
Write a rectangular region of an image component.
+ +JAS_EXPORT int jas_image_writecmpt2 | +( | +jas_image_t * | +image, | +
+ | + | unsigned | +cmptno, | +
+ | + | jas_image_coord_t | +x, | +
+ | + | jas_image_coord_t | +y, | +
+ | + | jas_image_coord_t | +width, | +
+ | + | jas_image_coord_t | +height, | +
+ | + | const long * | +buf | +
+ | ) | ++ |
Write sample data in a component of an image.
+ +JAS_EXPORT void jas_image_writecmptsample | +( | +jas_image_t * | +image, | +
+ | + | unsigned | +cmptno, | +
+ | + | unsigned | +x, | +
+ | + | unsigned | +y, | +
+ | + | int_fast32_t | +v | +
+ | ) | ++ |
Write a component sample for an image.
+ +Configuration, Initialization, and Shutdown. +More...
++Typedefs | |
typedef void * | jas_context_t |
An opaque handle type used to represent a JasPer library context. More... | |
+Functions | |
JAS_EXPORT void | jas_conf_clear (void) |
Configure the JasPer library with the default configuration settings. More... | |
JAS_EXPORT void | jas_conf_set_multithread (int multithread) |
Set the multithreading flag for the library. More... | |
JAS_EXPORT void | jas_conf_set_allocator (jas_allocator_t *allocator) |
Set the memory allocator to be used by the library. More... | |
JAS_EXPORT void | jas_conf_set_debug_level (int debug_level) |
Set the initial debug level for the library. More... | |
JAS_EXPORT void | jas_conf_set_max_mem_usage (size_t max_mem) |
Set the maximum amount of memory that can be used by the library (assuming the allocator wrapper is not disabled). More... | |
JAS_EXPORT void | jas_conf_set_dec_default_max_samples (size_t max_samples) |
Set the default value for the maximum number of samples that is allowed in an image to be decoded. More... | |
JAS_EXPORT void | jas_conf_set_vlogmsgf (jas_vlogmsgf_t *func) |
Set the function used by the library to output error, warning, and informational messages. More... | |
JAS_EXPORT int | jas_init_library (void) |
Initialize the JasPer library with the current configuration settings. More... | |
JAS_EXPORT int | jas_cleanup_library (void) |
Perform clean up for the JasPer library. More... | |
JAS_EXPORT int | jas_init_thread (void) |
Perform per-thread initialization for the JasPer library. More... | |
JAS_EXPORT int | jas_cleanup_thread (void) |
Perform per-thread cleanup for the JasPer library. More... | |
JAS_EXPORT int | jas_init (void) |
Configure and initialize the JasPer library using the default configuration settings. More... | |
JAS_EXPORT void | jas_cleanup (void) |
Perform any clean up for the JasPer library. More... | |
JAS_EXPORT jas_context_t | jas_context_create (void) |
Create a context. More... | |
JAS_EXPORT void | jas_context_destroy (jas_context_t context) |
Destroy a context. More... | |
JAS_EXPORT jas_context_t | jas_get_default_context (void) |
Get the current context for the calling thread. More... | |
JAS_EXPORT jas_context_t | jas_get_context (void) |
Get the current context for the calling thread. More... | |
JAS_EXPORT void | jas_set_context (jas_context_t context) |
Set the current context for the calling thread. More... | |
JAS_EXPORT void | jas_set_debug_level (int debug_level) |
Set the debug level for a particular context. More... | |
static int | jas_get_debug_level (void) |
Get the debug level for a particular context. More... | |
JAS_EXPORT void | jas_set_dec_default_max_samples (size_t max_samples) |
Set the default maximum number of samples that a decoder is permitted to process. More... | |
static size_t | jas_get_dec_default_max_samples (void) |
Get the default maximum number of samples that a decoder is permitted to process. More... | |
JAS_EXPORT void | jas_set_vlogmsgf (jas_vlogmsgf_t *func) |
Set the function to be used for log messages. More... | |
static jas_vlogmsgf_t * | jas_get_vlogmsgf (void) |
Get the function to be used for log messages. More... | |
Configuration, Initialization, and Shutdown.
+General information can be found here.
+typedef void* jas_context_t | +
An opaque handle type used to represent a JasPer library context.
+ +JAS_EXPORT void jas_cleanup | +( | +void | +) | ++ |
Perform any clean up for the JasPer library.
+This function performs any clean up for the JasPer library.
+JAS_EXPORT int jas_cleanup_library | +( | +void | +) | ++ |
Perform clean up for the JasPer library.
+At the point when this function is called, all threads that have called jas_init_thread() must have called jas_cleanup_thread().
+JAS_EXPORT int jas_cleanup_thread | +( | +void | +) | ++ |
Perform per-thread cleanup for the JasPer library.
+ +JAS_EXPORT void jas_conf_clear | +( | +void | +) | ++ |
Configure the JasPer library with the default configuration settings.
+This function configures the JasPer library with the default configuration settings. These settings may be change via the jas_conf_*
family of function prior to invoking jas_init_library().
JAS_EXPORT void jas_conf_set_allocator | +( | +jas_allocator_t * | +allocator | ) | ++ |
Set the memory allocator to be used by the library.
+The object referenced by allocator
must have a live at least until jas_cleanup() is invoked. How the memory in which *allocator
reside is allocated is the responsibility of the caller.
JAS_EXPORT void jas_conf_set_debug_level | +( | +int | +debug_level | ) | ++ |
Set the initial debug level for the library.
+ +JAS_EXPORT void jas_conf_set_dec_default_max_samples | +( | +size_t | +max_samples | ) | ++ |
Set the default value for the maximum number of samples that is allowed in an image to be decoded.
+ +JAS_EXPORT void jas_conf_set_max_mem_usage | +( | +size_t | +max_mem | ) | ++ |
Set the maximum amount of memory that can be used by the library (assuming the allocator wrapper is not disabled).
+JAS_EXPORT void jas_conf_set_multithread | +( | +int | +multithread | ) | ++ |
Set the multithreading flag for the library.
+ +JAS_EXPORT void jas_conf_set_vlogmsgf | +( | +jas_vlogmsgf_t * | +func | ) | ++ |
Set the function used by the library to output error, warning, and informational messages.
+ +JAS_EXPORT jas_context_t jas_context_create | +( | +void | +) | ++ |
Create a context.
+ +JAS_EXPORT void jas_context_destroy | +( | +jas_context_t | +context | ) | ++ |
Destroy a context.
+The context being destroyed must not be the current context.
+ +JAS_EXPORT jas_context_t jas_get_context | +( | +void | +) | ++ |
Get the current context for the calling thread.
+ +
+
|
+ +inlinestatic | +
Get the debug level for a particular context.
+ +
+
|
+ +inlinestatic | +
Get the default maximum number of samples that a decoder is permitted to process.
+ +JAS_EXPORT jas_context_t jas_get_default_context | +( | +void | +) | ++ |
Get the current context for the calling thread.
+ +
+
|
+ +inlinestatic | +
Get the function to be used for log messages.
+ +JAS_EXPORT int jas_init | +( | +void | +) | ++ |
Configure and initialize the JasPer library using the default configuration settings.
+The jas_init() function initializes the JasPer library. The library must be initialized before most code in the library can be used.
+The jas_init() function exists only for reasons of backward compatibility with earlier versions of the library. It is recommended that this function not be used. Instead, the jas_conf_clear() and jas_init_library() functions should be used to configure and initialize the library.
+JAS_EXPORT int jas_init_library | +( | +void | +) | ++ |
Initialize the JasPer library with the current configuration settings.
+The library must be configured by invoking the jas_conf_clear() function prior to calling jas_init_library().
+JAS_EXPORT int jas_init_thread | +( | +void | +) | ++ |
Perform per-thread initialization for the JasPer library.
+The library must be initialized by invoking the jas_init_library() function prior to calling jas_init_thread().
+JAS_EXPORT void jas_set_context | +( | +jas_context_t | +context | ) | ++ |
Set the current context for the calling thread.
+ +JAS_EXPORT void jas_set_debug_level | +( | +int | +debug_level | ) | ++ |
Set the debug level for a particular context.
+ +JAS_EXPORT void jas_set_dec_default_max_samples | +( | +size_t | +max_samples | ) | ++ |
Set the default maximum number of samples that a decoder is permitted to process.
+ +JAS_EXPORT void jas_set_vlogmsgf | +( | +jas_vlogmsgf_t * | +func | ) | ++ |
Set the function to be used for log messages.
+ +I/O streams. +More...
++Classes | |
struct | jas_stream_t |
I/O stream object. More... | |
+Macros | |
#define | jas_stream_eof(stream) (((stream)->flags_ & JAS_STREAM_EOF) != 0) |
Get the EOF indicator for a stream. More... | |
#define | jas_stream_error(stream) (((stream)->flags_ & JAS_STREAM_ERR) != 0) |
Get the error indicator for a stream. More... | |
#define | jas_stream_clearerr(stream) ((stream)->flags_ &= ~(JAS_STREAM_ERR | JAS_STREAM_EOF)) |
Clear the error indicator for a stream. More... | |
#define | jas_stream_getrwlimit(stream) (((const jas_stream_t *)(stream))->rwlimit_) |
Get the read/write limit for a stream. More... | |
#define | jas_stream_getrwcount(stream) (((const jas_stream_t *)(stream))->rwcnt_) |
Get the read/write count for a stream. More... | |
#define | jas_stream_getc(stream) jas_stream_getc_func(stream) |
jas_stream_getc Read a character from a stream. More... | |
#define | jas_stream_putc(stream, c) jas_stream_putc_func(stream, c) |
jas_stream_putc Write a character to a stream. More... | |
#define | jas_stream_peekc(stream) |
Look at the next character to be read from a stream without actually removing the character from the stream. More... | |
+Functions | |
JAS_EXPORT jas_stream_t * | jas_stream_fopen (const char *filename, const char *mode) |
Open a file as a stream. More... | |
JAS_EXPORT jas_stream_t * | jas_stream_memopen (char *buffer, size_t buffer_size) |
Open a memory buffer as a stream. More... | |
JAS_DEPRECATED JAS_EXPORT jas_stream_t * | jas_stream_memopen2 (char *buffer, size_t buffer_size) |
Do not use. More... | |
JAS_EXPORT jas_stream_t * | jas_stream_fdopen (int fd, const char *mode) |
Open a file descriptor as a stream. More... | |
JAS_EXPORT jas_stream_t * | jas_stream_freopen (const char *path, const char *mode, FILE *fp) |
Open a stdio (i.e., C standard library) stream as a stream. More... | |
JAS_EXPORT jas_stream_t * | jas_stream_tmpfile (void) |
Open a temporary file as a stream. More... | |
JAS_EXPORT int | jas_stream_close (jas_stream_t *stream) |
Close a stream. More... | |
JAS_EXPORT long | jas_stream_setrwlimit (jas_stream_t *stream, long rwlimit) |
Set the read/write limit for a stream. More... | |
JAS_EXPORT long | jas_stream_setrwcount (jas_stream_t *stream, long rw_count) |
Set the read/write count for a stream. More... | |
JAS_EXPORT size_t | jas_stream_read (jas_stream_t *stream, void *buffer, size_t count) |
Read characters from a stream into a buffer. More... | |
JAS_EXPORT unsigned | jas_stream_peek (jas_stream_t *stream, void *buffer, size_t count) |
Attempt to retrieve one or more pending characters of input from a stream into a buffer without actually removing the characters from the stream. More... | |
JAS_EXPORT size_t | jas_stream_write (jas_stream_t *stream, const void *buffer, size_t count) |
Write characters from a buffer to a stream. More... | |
JAS_EXPORT int | jas_stream_printf (jas_stream_t *stream, const char *format,...) |
Write formatted output to a stream. More... | |
JAS_EXPORT int | jas_stream_puts (jas_stream_t *stream, const char *s) |
Write a string to a stream. More... | |
JAS_EXPORT char * | jas_stream_gets (jas_stream_t *stream, char *buffer, int buffer_size) |
Read a line of input from a stream. More... | |
JAS_EXPORT int | jas_stream_ungetc (jas_stream_t *stream, int c) |
Put a character back on a stream. More... | |
JAS_EXPORT JAS_ATTRIBUTE_PURE int | jas_stream_isseekable (jas_stream_t *stream) |
Determine if stream supports seeking. More... | |
JAS_EXPORT long | jas_stream_seek (jas_stream_t *stream, long offset, int origin) |
Set the current position within the stream. More... | |
JAS_EXPORT long | jas_stream_tell (jas_stream_t *stream) |
Get the current position within the stream. More... | |
JAS_EXPORT int | jas_stream_rewind (jas_stream_t *stream) |
Seek to the beginning of a stream. More... | |
JAS_EXPORT int | jas_stream_flush (jas_stream_t *stream) |
Flush any pending output to a stream. More... | |
JAS_EXPORT int | jas_stream_copy (jas_stream_t *destination, jas_stream_t *source, ssize_t count) |
Copy data from one stream to another. More... | |
JAS_EXPORT int | jas_stream_display (jas_stream_t *stream, FILE *fp, int count) |
Print a hex dump of data read from a stream. More... | |
JAS_EXPORT ssize_t | jas_stream_gobble (jas_stream_t *stream, size_t count) |
Consume (i.e., discard) characters from stream. More... | |
JAS_EXPORT ssize_t | jas_stream_pad (jas_stream_t *stream, size_t count, int value) |
Write a fill character multiple times to a stream. More... | |
JAS_EXPORT long | jas_stream_length (jas_stream_t *stream) |
Get the size of the file associated with the specified stream. More... | |
I/O streams.
+General information can be found here.
+#define jas_stream_clearerr | +( | ++ | stream | ) | +((stream)->flags_ &= ~(JAS_STREAM_ERR | JAS_STREAM_EOF)) | +
Clear the error indicator for a stream.
+stream | The stream whose error indicator is to be cleared. |
#define jas_stream_eof | +( | ++ | stream | ) | +(((stream)->flags_ & JAS_STREAM_EOF) != 0) | +
Get the EOF indicator for a stream.
+stream | The stream whose EOF indicator is to be queried. |
#define jas_stream_error | +( | ++ | stream | ) | +(((stream)->flags_ & JAS_STREAM_ERR) != 0) | +
Get the error indicator for a stream.
+stream | The stream whose error indicator is to be queried. |
#define jas_stream_getc | +( | ++ | stream | ) | +jas_stream_getc_func(stream) | +
jas_stream_getc Read a character from a stream.
+stream | A pointer to the stream from which to read a character. |
#define jas_stream_getrwcount | +( | ++ | stream | ) | +(((const jas_stream_t *)(stream))->rwcnt_) | +
Get the read/write count for a stream.
+stream | A pointer to the stream whose read/write count is to be queried. |
#define jas_stream_getrwlimit | +( | ++ | stream | ) | +(((const jas_stream_t *)(stream))->rwlimit_) | +
Get the read/write limit for a stream.
+stream | A pointer to the stream whose read/write limit is to be queried. |
#define jas_stream_peekc | +( | ++ | stream | ) | ++ |
Look at the next character to be read from a stream without actually removing the character from the stream.
+stream | A pointer to the stream to be examined. |
This function examines the next character that would be read from the stream and returns this character without actually removing it from the stream.
+#define jas_stream_putc | +( | ++ | stream, | +
+ | + | + | c | +
+ | ) | +jas_stream_putc_func(stream, c) | +
jas_stream_putc Write a character to a stream.
+stream | A pointer to the stream to which to write the character. |
c | The character to be written. |
JAS_EXPORT int jas_stream_close | +( | +jas_stream_t * | +stream | ) | ++ |
Close a stream.
+stream | A (nonnull) pointer to the stream to be closed. |
The close operation will implicitly flush any pending output to the stream before closing. If such a flush operation fails, this will be reflected in the return value of this function. For many systems, it is likely that the main reason that this function can fail is due to an I/O error when flushing buffered output.
+JAS_EXPORT int jas_stream_copy | +( | +jas_stream_t * | +destination, | +
+ | + | jas_stream_t * | +source, | +
+ | + | ssize_t | +count | +
+ | ) | ++ |
Copy data from one stream to another.
+destination | A pointer to the stream that is the destination for the copy. |
source | A pointer to the stream that is the source for the copy. |
count | The number of characters to copy. |
The function copies the specified number of characters from the source stream to the destination stream. In particular, if count
is nonnegative, count
characters are copied from the source stream source
to the destination stream destination
. Otherwise (i.e., if count
is negative), the entire source stream source
(i.e., until EOF is reached) is copied to the destination stream destination
.
JAS_EXPORT int jas_stream_display | +( | +jas_stream_t * | +stream, | +
+ | + | FILE * | +fp, | +
+ | + | int | +count | +
+ | ) | ++ |
Print a hex dump of data read from a stream.
+stream | A pointer to the stream from which to read data. |
fp | A pointer to a stdio stream (i.e., FILE) to which to print the hex dump. |
count | The number of characters to include in the hex dump. |
This function prints a hex dump of data read from a stream to a stdio stream. This function is most likely to be useful for debugging.
+JAS_EXPORT jas_stream_t* jas_stream_fdopen | +( | +int | +fd, | +
+ | + | const char * | +mode | +
+ | ) | ++ |
Open a file descriptor as a stream.
+fd | The file descriptor of the file to open as a stream. |
mode | A pointer to a string specifying the open mode. The format of this string is similar to that of the fdopen function in the C standard library. |
JAS_EXPORT int jas_stream_flush | +( | +jas_stream_t * | +stream | ) | ++ |
Flush any pending output to a stream.
+stream | A pointer to the stream for which output should be flushed. |
The function flushes any buffered output to the underlying file object.
+(This function is analogous to fflush for C standard library streams.)
+JAS_EXPORT jas_stream_t* jas_stream_fopen | +( | +const char * | +filename, | +
+ | + | const char * | +mode | +
+ | ) | ++ |
Open a file as a stream.
+filename | A pointer to the pathname of the file to be opened. |
mode | A pointer to the string specifying the open mode. The open mode is similar to that used by the fopen function in the C standard library. |
JAS_EXPORT jas_stream_t* jas_stream_freopen | +( | +const char * | +path, | +
+ | + | const char * | +mode, | +
+ | + | FILE * | +fp | +
+ | ) | ++ |
Open a stdio (i.e., C standard library) stream as a stream.
+path | A pointer to a null-terminated string containing the pathname of the file to be reopened. |
mode | A pointer to a null-terminated string containing the mode to be used for reopening the file. This string is similar to that used by the fdopen function in the C standard library. |
fp | A pointer to the FILE (i.e., stdio stream) to be reopened. |
It is unspecified whether the open mode specified by mode can be changed from the open mode used for opening the stdio stream.
+JAS_EXPORT char* jas_stream_gets | +( | +jas_stream_t * | +stream, | +
+ | + | char * | +buffer, | +
+ | + | int | +buffer_size | +
+ | ) | ++ |
Read a line of input from a stream.
+stream | A pointer to the stream from which to read input. |
buffer | A pointer to the start of the buffer to hold to input to be read. |
buffer_size | The size of the buffer in characters. |
The function reads a line of input from a stream into a buffer. If a newline character is read, it is placed in the buffer. Since the buffer may be too small to hold the input, this operation can fail due to attempted buffer overrun.
+(This function is analogous to fgets for C standard library streams.)
+JAS_EXPORT ssize_t jas_stream_gobble | +( | +jas_stream_t * | +stream, | +
+ | + | size_t | +count | +
+ | ) | ++ |
Consume (i.e., discard) characters from stream.
+stream | A pointer to the stream from which to discard data. |
count | The number of characters to discard. |
This function reads and discards the specified number of characters from the given stream.
+JAS_EXPORT JAS_ATTRIBUTE_PURE int jas_stream_isseekable | +( | +jas_stream_t * | +stream | ) | ++ |
Determine if stream supports seeking.
+stream | A pointer to the stream to query. |
The function is a predicate that tests if the underlying file object supports seek operations.
+JAS_EXPORT long jas_stream_length | +( | +jas_stream_t * | +stream | ) | ++ |
Get the size of the file associated with the specified stream.
+stream | A pointer to the stream. |
This function queries the size (i.e., length) of the underlying file object associated with the specified stream. The specified stream must be seekable.
+JAS_EXPORT jas_stream_t* jas_stream_memopen | +( | +char * | +buffer, | +
+ | + | size_t | +buffer_size | +
+ | ) | ++ |
Open a memory buffer as a stream.
+buffer | A pointer to the buffer to be used to store stream data. |
buffer_size | The size of the buffer. |
JAS_DEPRECATED JAS_EXPORT jas_stream_t* jas_stream_memopen2 | +( | +char * | +buffer, | +
+ | + | size_t | +buffer_size | +
+ | ) | ++ |
Do not use.
+JAS_EXPORT ssize_t jas_stream_pad | +( | +jas_stream_t * | +stream, | +
+ | + | size_t | +count, | +
+ | + | int | +value | +
+ | ) | ++ |
Write a fill character multiple times to a stream.
+stream | A pointer to the stream to which to write. |
count | The number of times to write the fill character to the stream. |
value | The fill character. |
This function writes the given fill character to a stream a specified number of times. If a count of zero is specified, the function should have no effect.
+JAS_EXPORT unsigned jas_stream_peek | +( | +jas_stream_t * | +stream, | +
+ | + | void * | +buffer, | +
+ | + | size_t | +count | +
+ | ) | ++ |
Attempt to retrieve one or more pending characters of input from a stream into a buffer without actually removing the characters from the stream.
+stream | A pointer to the stream from which to retrieve pending input. |
buffer | A pointer to the start of the buffer. |
count | A count of how many characters to retrieve. |
The extent to which one can peek into the stream is limited. Therefore, this function can fail if count is sufficiently large.
+JAS_EXPORT int jas_stream_printf | +( | +jas_stream_t * | +stream, | +
+ | + | const char * | +format, | +
+ | + | + | ... | +
+ | ) | ++ |
Write formatted output to a stream.
+stream | A pointer to the stream to which to write output. |
format | A pointer to a format string similar to the printf function in the C standard library. |
The function prints the information associated with the format string to the specified stream.
+JAS_EXPORT int jas_stream_puts | +( | +jas_stream_t * | +stream, | +
+ | + | const char * | +s | +
+ | ) | ++ |
Write a string to a stream.
+stream | A pointer to the stream to which the string should be written. |
s | A pointer to a null-terminated string for output. |
The null character is not output.
+(This function is analogous to fputs for C standard library streams.)
+JAS_EXPORT size_t jas_stream_read | +( | +jas_stream_t * | +stream, | +
+ | + | void * | +buffer, | +
+ | + | size_t | +count | +
+ | ) | ++ |
Read characters from a stream into a buffer.
+stream | A pointer to the stream from which to read data. |
buffer | A pointer to the start of the buffer. |
count | A count of the number of characters to read (nominally). |
If count
is zero, the function has no effect (and therefore cannot fail). Otherwise, the function attempts to read count
characters from the stream stream
into the buffer starting at buffer
. The number of characters read can be less than count
, due to end-of-file (EOF) or an I/O error.
(This function is analogous to fread with the two read-count parameters combined into a single size.)
+count
, jas_stream_eof() and/or jas_stream_error() must be used to distinguish between: JAS_EXPORT int jas_stream_rewind | +( | +jas_stream_t * | +stream | ) | ++ |
Seek to the beginning of a stream.
+stream | A pointer to the stream whose position is to be set. |
The stream position is set to the start of the stream. This function is equivalent to returning the value of jas_stream_seek(stream, 0, SEEK_SET).
+(This function is analogous to frewind for C standard library streams.)
+JAS_EXPORT long jas_stream_seek | +( | +jas_stream_t * | +stream, | +
+ | + | long | +offset, | +
+ | + | int | +origin | +
+ | ) | ++ |
Set the current position within the stream.
+stream | A pointer to the stream for which to set the current position. |
offset | The new position for the stream. |
origin | The origin to which this new position is relative. |
The origin can be SEEK_CUR, SEEK_SET, or SEEK_END in a similar fashion as the fseek function in the C standard library (and the lseek function in POSIX).
+JAS_EXPORT long jas_stream_setrwcount | +( | +jas_stream_t * | +stream, | +
+ | + | long | +rw_count | +
+ | ) | ++ |
Set the read/write count for a stream.
+stream | A pointer to the stream whose read/write count is to be set. |
rw_count | The new value for the read/write count. |
JAS_EXPORT long jas_stream_setrwlimit | +( | +jas_stream_t * | +stream, | +
+ | + | long | +rwlimit | +
+ | ) | ++ |
Set the read/write limit for a stream.
+stream | A pointer to the stream whose read/write limit is to be set. |
rwlimit | The new value for the read/write limit. |
A negative read/write limit is treated as if it were infinity (i.e., there is no read/write limit).
+JAS_EXPORT long jas_stream_tell | +( | +jas_stream_t * | +stream | ) | ++ |
Get the current position within the stream.
+stream | A pointer to the stream whose current position is to be queried. |
The current position of the stream is returned.
+(This function is analogous to ftell for C standard library streams.)
+JAS_EXPORT jas_stream_t* jas_stream_tmpfile | +( | +void | +) | ++ |
Open a temporary file as a stream.
+A temporary file is created and opened as a stream. The temporary file is deleted when closed via jas_stream_close(). Some operating systems provide a mechanism for ensuring that a file is removed when closed. Such functionality may be used by the implementation when available.
+JAS_EXPORT int jas_stream_ungetc | +( | +jas_stream_t * | +stream, | +
+ | + | int | +c | +
+ | ) | ++ |
Put a character back on a stream.
+stream | A pointer to the stream to which the character should be put back. |
c | The character to put back. |
The character c
(which was presumably read previously from the stream stream
) is put back on the stream (as if it had not yet been read). In other words, this function undoes the effect of jas_stream_getc(). It is unspecified what happens if the character put back was not the one originally read. The number of characters that can be pushed back onto the stream for subsequent reading is limited. Trying to push back too many characters on a stream will result in an error. The approximate limit is given by the value of JAS_STREAM_MAXPUTBACK.
JAS_EXPORT size_t jas_stream_write | +( | +jas_stream_t * | +stream, | +
+ | + | const void * | +buffer, | +
+ | + | size_t | +count | +
+ | ) | ++ |
Write characters from a buffer to a stream.
+stream | A pointer to the stream to which to write data. |
buffer | A pointer to the start of the buffer. |
count | A count of the number of characters to write. |
If count
is zero, the function has no effect (and therefore cannot fail). Otherwise, the function will attempt to write count
characters from the buffer starting at buffer
to the stream stream
. The number of characters written can be less than count
due to an I/O error or the read/write limit being exceeded.
(This function is analogous to fwrite with the two write-count parameters combined into a single size.)
+count
. The jas_stream_error() and jas_stream_rwlimit() function (TODO/CHECK: the latter of which does not currently exist?) can be used to distinguish between: Logging. +More...
++Classes | |
struct | jas_logtype_t |
Type used for the log type. More... | |
+Macros | |
#define | JAS_LOGTYPE_CLASS_NULL 0 |
#define | JAS_LOGTYPE_CLASS_ERROR 1 |
#define | JAS_LOGTYPE_CLASS_WARN 2 |
#define | JAS_LOGTYPE_CLASS_INFO 3 |
#define | JAS_LOGTYPE_CLASS_DEBUG 4 |
+Typedefs | |
typedef int() | jas_vlogmsgf_t(jas_logtype_t, const char *, va_list) |
Type used for formatted message logging function. More... | |
+Functions | |
static jas_logtype_t | jas_logtype_init (int clas, int priority) |
Create an instance of a logtype. More... | |
static int | jas_logtype_getclass (jas_logtype_t type) |
Get the class of a logtype. More... | |
static int | jas_logtype_getpriority (jas_logtype_t type) |
Get the priority of a logtype. More... | |
JAS_EXPORT int | jas_vlogmsgf (jas_logtype_t type, const char *fmt, va_list ap) |
Print formatted log message. More... | |
JAS_EXPORT int | jas_vlogmsgf_stderr (jas_logtype_t type, const char *fmt, va_list ap) |
Output a log message to standard error. More... | |
JAS_EXPORT int | jas_vlogmsgf_discard (jas_logtype_t type, const char *fmt, va_list ap) |
Output a log message to nowhere (i.e., discard the message). More... | |
Logging.
+General information can be found here.
+#define JAS_LOGTYPE_CLASS_DEBUG 4 | +
Log type class for debugging messages.
+ +#define JAS_LOGTYPE_CLASS_ERROR 1 | +
Log type class for errors.
+ +#define JAS_LOGTYPE_CLASS_INFO 3 | +
Log type class for informational messages.
+ +#define JAS_LOGTYPE_CLASS_NULL 0 | +
Log type class for unclassified messages.
+ +#define JAS_LOGTYPE_CLASS_WARN 2 | +
Log type class for warnings.
+ +typedef int() jas_vlogmsgf_t(jas_logtype_t, const char *, va_list) | +
Type used for formatted message logging function.
+ +
+
|
+ +inlinestatic | +
Get the class of a logtype.
+ +
+
|
+ +inlinestatic | +
Get the priority of a logtype.
+ +
+
|
+ +inlinestatic | +
Create an instance of a logtype.
+ +JAS_EXPORT int jas_vlogmsgf | +( | +jas_logtype_t | +type, | +
+ | + | const char * | +fmt, | +
+ | + | va_list | +ap | +
+ | ) | ++ |
Print formatted log message.
+ +JAS_EXPORT int jas_vlogmsgf_discard | +( | +jas_logtype_t | +type, | +
+ | + | const char * | +fmt, | +
+ | + | va_list | +ap | +
+ | ) | ++ |
Output a log message to nowhere (i.e., discard the message).
+ +JAS_EXPORT int jas_vlogmsgf_stderr | +( | +jas_logtype_t | +type, | +
+ | + | const char * | +fmt, | +
+ | + | va_list | +ap | +
+ | ) | ++ |
Output a log message to standard error.
+ +One- and Two-Dimensional Sequences. +More...
++Classes | |
struct | jas_matrix_t |
Matrix type. More... | |
struct | jas_seq2d_t |
Two-dimensional sequence type. More... | |
struct | jas_seq_t |
One-dimensional sequence type. More... | |
+Functions | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_matrix_numrows (const jas_matrix_t *matrix) |
Get the number of rows in a matrix. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_matrix_numcols (const jas_matrix_t *matrix) |
Get the number of columns in a matrix. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_matrix_size (const jas_matrix_t *matrix) |
Get the number of elements in a matrix. More... | |
static JAS_ATTRIBUTE_PURE bool | jas_matrix_empty (const jas_matrix_t *matrix) |
Test if a matrix is empty (i.e., contains no elements). More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t | jas_matrix_get (const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j) |
Get a matrix element. More... | |
static void | jas_matrix_set (jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j, jas_seqent_t v) |
Set a matrix element. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t | jas_matrix_getv (const jas_matrix_t *matrix, jas_matind_t i) |
Get an element from a matrix that is known to be a row or column vector. More... | |
static void | jas_matrix_setv (jas_matrix_t *matrix, jas_matind_t i, jas_seqent_t v) |
Set an element in a matrix that is known to be a row or column vector. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t * | jas_matrix_getref (const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j) |
Get the address of an element in a matrix. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t * | jas_matrix_getvref (const jas_matrix_t *matrix, jas_matind_t i) |
Get a reference to a particular row of a 2-D sequence. More... | |
JAS_EXPORT jas_matrix_t * | jas_matrix_create (jas_matind_t numrows, jas_matind_t numcols) |
Create a matrix with the specified dimensions. More... | |
JAS_EXPORT void | jas_matrix_destroy (jas_matrix_t *matrix) |
Destroy a matrix. More... | |
JAS_EXPORT int | jas_matrix_resize (jas_matrix_t *matrix, jas_matind_t numrows, jas_matind_t numcols) |
Resize a matrix. The previous contents of the matrix are lost. More... | |
JAS_EXPORT int | jas_matrix_output (jas_matrix_t *matrix, FILE *out) |
Write a matrix to a C standard library stream. More... | |
JAS_EXPORT int | jas_matrix_bindsub (jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t r0, jas_matind_t c0, jas_matind_t r1, jas_matind_t c1) |
Create a matrix that references part of another matrix. More... | |
static int | jas_matrix_bindrow (jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t r) |
Create a matrix that is a reference to a row of another matrix. More... | |
static int | jas_matrix_bindcol (jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t c) |
Create a matrix that is a reference to a column of another matrix. More... | |
JAS_EXPORT void | jas_matrix_clip (jas_matrix_t *matrix, jas_seqent_t minval, jas_seqent_t maxval) |
Clip the values of matrix elements to the specified range. More... | |
JAS_EXPORT void | jas_matrix_asl (jas_matrix_t *matrix, unsigned n) |
Arithmetic shift left of all elements in a matrix. More... | |
JAS_EXPORT void | jas_matrix_asr (jas_matrix_t *matrix, unsigned n) |
Arithmetic shift right of all elements in a matrix. More... | |
JAS_EXPORT void | jas_matrix_divpow2 (jas_matrix_t *matrix, unsigned n) |
Almost-but-not-quite arithmetic shift right of all elements in a matrix. More... | |
JAS_EXPORT void | jas_matrix_setall (jas_matrix_t *matrix, jas_seqent_t val) |
Set all elements of a matrix to the specified value. More... | |
static JAS_ATTRIBUTE_PURE size_t | jas_matrix_rowstep (const jas_matrix_t *matrix) |
The spacing between rows of a matrix. More... | |
static JAS_ATTRIBUTE_PURE size_t | jas_matrix_step (const jas_matrix_t *matrix) |
The spacing between columns of a matrix. More... | |
JAS_EXPORT int | jas_matrix_cmp (jas_matrix_t *mat0, jas_matrix_t *mat1) |
Compare two matrices for equality. More... | |
JAS_EXPORT jas_matrix_t * | jas_matrix_copy (jas_matrix_t *x) |
Copy a matrix. More... | |
JAS_EXPORT jas_matrix_t * | jas_matrix_input (FILE *) |
Read a matrix from a C standard library stream. More... | |
JAS_EXPORT jas_seq2d_t * | jas_seq2d_copy (jas_seq2d_t *x) |
Copy a 2-D sequence. More... | |
JAS_EXPORT jas_matrix_t * | jas_seq2d_create (jas_matind_t xstart, jas_matind_t ystart, jas_matind_t xend, jas_matind_t yend) |
Create a 2-D sequence. More... | |
static void | jas_seq2d_destroy (jas_seq2d_t *s) |
Destroy a 2-D sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq2d_xstart (const jas_seq2d_t *s) |
Get the starting x-coordinate of the sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq2d_ystart (const jas_seq2d_t *s) |
Get the starting y-coordinate of the sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq2d_xend (const jas_seq2d_t *s) |
Get the ending x-coordinate of the sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq2d_yend (const jas_seq2d_t *s) |
Get the ending y-coordinate of the sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t * | jas_seq2d_getref (const jas_seq2d_t *s, jas_matind_t x, jas_matind_t y) |
Get a pointer (i.e., reference) to an element of a 2-D sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t | jas_seq2d_get (const jas_seq2d_t *s, jas_matind_t x, jas_matind_t y) |
Get an element of a 2-D sequence. More... | |
static JAS_ATTRIBUTE_PURE size_t | jas_seq2d_rowstep (const jas_seq2d_t *s) |
Get the stride between successive rows in the sequence. More... | |
static JAS_ATTRIBUTE_PURE unsigned | jas_seq2d_width (const jas_seq2d_t *s) |
Get the number of columns in the sequence. More... | |
static JAS_ATTRIBUTE_PURE unsigned | jas_seq2d_height (const jas_seq2d_t *s) |
Get the number of rows in the sequence. More... | |
static void | jas_seq2d_setshift (jas_seq2d_t *s, jas_matind_t x, jas_matind_t y) |
Set the shift (i.e., starting x- and y-coordinates) of the sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq2d_size (const jas_seq2d_t *s) |
Get the number of elements in the sequence. More... | |
static JAS_ATTRIBUTE_PURE bool | jas_seq2d_empty (const jas_seq2d_t *s) |
Test if the sequence is empty (i.e., contains no elements). More... | |
JAS_EXPORT int | jas_seq2d_bindsub (jas_matrix_t *s, jas_matrix_t *s1, jas_matind_t xstart, jas_matind_t ystart, jas_matind_t xend, jas_matind_t yend) |
Initialize a sequence to reference a subsequence of another sequence. More... | |
static jas_seq_t * | jas_seq_create (jas_matind_t start, jas_matind_t end) |
Create a 1-D sequence. More... | |
static void | jas_seq_destroy (jas_seq_t *seq) |
Destroy a 1-D sequence. More... | |
static void | jas_seq_set (jas_seq_t *seq, jas_matind_t i, jas_seqent_t v) |
Set an element of a sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t * | jas_seq_getref (const jas_seq_t *seq, jas_matind_t i) |
Get a pointer (i.e., reference) to an element of a sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t | jas_seq_get (const jas_seq_t *seq, jas_matind_t i) |
Get an element of a sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq_start (const jas_seq_t *seq) |
Get the starting index of a sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq_end (const jas_seq_t *seq) |
Get the ending index of a sequence. More... | |
One- and Two-Dimensional Sequences.
+JAS_EXPORT void jas_matrix_asl | +( | +jas_matrix_t * | +matrix, | +
+ | + | unsigned | +n | +
+ | ) | ++ |
Arithmetic shift left of all elements in a matrix.
+ +JAS_EXPORT void jas_matrix_asr | +( | +jas_matrix_t * | +matrix, | +
+ | + | unsigned | +n | +
+ | ) | ++ |
Arithmetic shift right of all elements in a matrix.
+ +
+
|
+ +inlinestatic | +
Create a matrix that is a reference to a column of another matrix.
+ +
+
|
+ +inlinestatic | +
Create a matrix that is a reference to a row of another matrix.
+ +JAS_EXPORT int jas_matrix_bindsub | +( | +jas_matrix_t * | +mat0, | +
+ | + | jas_matrix_t * | +mat1, | +
+ | + | jas_matind_t | +r0, | +
+ | + | jas_matind_t | +c0, | +
+ | + | jas_matind_t | +r1, | +
+ | + | jas_matind_t | +c1 | +
+ | ) | ++ |
Create a matrix that references part of another matrix.
+ +JAS_EXPORT void jas_matrix_clip | +( | +jas_matrix_t * | +matrix, | +
+ | + | jas_seqent_t | +minval, | +
+ | + | jas_seqent_t | +maxval | +
+ | ) | ++ |
Clip the values of matrix elements to the specified range.
+ +JAS_EXPORT int jas_matrix_cmp | +( | +jas_matrix_t * | +mat0, | +
+ | + | jas_matrix_t * | +mat1 | +
+ | ) | ++ |
Compare two matrices for equality.
+ +JAS_EXPORT jas_matrix_t* jas_matrix_copy | +( | +jas_matrix_t * | +x | ) | ++ |
Copy a matrix.
+ +JAS_EXPORT jas_matrix_t* jas_matrix_create | +( | +jas_matind_t | +numrows, | +
+ | + | jas_matind_t | +numcols | +
+ | ) | ++ |
Create a matrix with the specified dimensions.
+ +JAS_EXPORT void jas_matrix_destroy | +( | +jas_matrix_t * | +matrix | ) | ++ |
Destroy a matrix.
+ +JAS_EXPORT void jas_matrix_divpow2 | +( | +jas_matrix_t * | +matrix, | +
+ | + | unsigned | +n | +
+ | ) | ++ |
Almost-but-not-quite arithmetic shift right of all elements in a matrix.
+ +
+
|
+ +inlinestatic | +
Test if a matrix is empty (i.e., contains no elements).
+ +
+
|
+ +inlinestatic | +
Get a matrix element.
+ +
+
|
+ +inlinestatic | +
Get the address of an element in a matrix.
+ +
+
|
+ +inlinestatic | +
Get an element from a matrix that is known to be a row or column vector.
+ +
+
|
+ +inlinestatic | +
Get a reference to a particular row of a 2-D sequence.
+ +JAS_EXPORT jas_matrix_t* jas_matrix_input | +( | +FILE * | +) | ++ |
Read a matrix from a C standard library stream.
+ +
+
|
+ +inlinestatic | +
Get the number of columns in a matrix.
+ +
+
|
+ +inlinestatic | +
Get the number of rows in a matrix.
+ +JAS_EXPORT int jas_matrix_output | +( | +jas_matrix_t * | +matrix, | +
+ | + | FILE * | +out | +
+ | ) | ++ |
Write a matrix to a C standard library stream.
+ +JAS_EXPORT int jas_matrix_resize | +( | +jas_matrix_t * | +matrix, | +
+ | + | jas_matind_t | +numrows, | +
+ | + | jas_matind_t | +numcols | +
+ | ) | ++ |
Resize a matrix. The previous contents of the matrix are lost.
+ +
+
|
+ +inlinestatic | +
The spacing between rows of a matrix.
+ +
+
|
+ +inlinestatic | +
Set a matrix element.
+ +JAS_EXPORT void jas_matrix_setall | +( | +jas_matrix_t * | +matrix, | +
+ | + | jas_seqent_t | +val | +
+ | ) | ++ |
Set all elements of a matrix to the specified value.
+ +
+
|
+ +inlinestatic | +
Set an element in a matrix that is known to be a row or column vector.
+ +
+
|
+ +inlinestatic | +
Get the number of elements in a matrix.
+ +
+
|
+ +inlinestatic | +
The spacing between columns of a matrix.
+ +JAS_EXPORT int jas_seq2d_bindsub | +( | +jas_matrix_t * | +s, | +
+ | + | jas_matrix_t * | +s1, | +
+ | + | jas_matind_t | +xstart, | +
+ | + | jas_matind_t | +ystart, | +
+ | + | jas_matind_t | +xend, | +
+ | + | jas_matind_t | +yend | +
+ | ) | ++ |
Initialize a sequence to reference a subsequence of another sequence.
+ +JAS_EXPORT jas_seq2d_t* jas_seq2d_copy | +( | +jas_seq2d_t * | +x | ) | ++ |
Copy a 2-D sequence.
+ +JAS_EXPORT jas_matrix_t* jas_seq2d_create | +( | +jas_matind_t | +xstart, | +
+ | + | jas_matind_t | +ystart, | +
+ | + | jas_matind_t | +xend, | +
+ | + | jas_matind_t | +yend | +
+ | ) | ++ |
Create a 2-D sequence.
+ +
+
|
+ +inlinestatic | +
Destroy a 2-D sequence.
+ +
+
|
+ +inlinestatic | +
Test if the sequence is empty (i.e., contains no elements).
+ +
+
|
+ +inlinestatic | +
Get an element of a 2-D sequence.
+ +
+
|
+ +inlinestatic | +
Get a pointer (i.e., reference) to an element of a 2-D sequence.
+ +
+
|
+ +inlinestatic | +
Get the number of rows in the sequence.
+ +
+
|
+ +inlinestatic | +
Get the stride between successive rows in the sequence.
+ +
+
|
+ +inlinestatic | +
Set the shift (i.e., starting x- and y-coordinates) of the sequence.
+ +
+
|
+ +inlinestatic | +
Get the number of elements in the sequence.
+ +
+
|
+ +inlinestatic | +
Get the number of columns in the sequence.
+ +
+
|
+ +inlinestatic | +
Get the ending x-coordinate of the sequence.
+ +
+
|
+ +inlinestatic | +
Get the starting x-coordinate of the sequence.
+ +
+
|
+ +inlinestatic | +
Get the ending y-coordinate of the sequence.
+ +
+
|
+ +inlinestatic | +
Get the starting y-coordinate of the sequence.
+ +
+
|
+ +inlinestatic | +
Create a 1-D sequence.
+ +
+
|
+ +inlinestatic | +
Destroy a 1-D sequence.
+ +
+
|
+ +inlinestatic | +
Get the ending index of a sequence.
+ +
+
|
+ +inlinestatic | +
Get an element of a sequence.
+ +
+
|
+ +inlinestatic | +
Get a pointer (i.e., reference) to an element of a sequence.
+ +
+
|
+ +inlinestatic | +
Set an element of a sequence.
+ +
+
|
+ +inlinestatic | +
Get the starting index of a sequence.
+ +String Processing. +More...
++Functions | |
JAS_EXPORT char * | jas_strdup (const char *) |
Create a copy of a null-terminated string. More... | |
JAS_EXPORT char * | jas_strtok (char *str, const char *delim, char **saveptr) |
Extract tokens from a string. More... | |
JAS_EXPORT int | jas_stringtokenize (const char *string, const char *delim, char ***tokens_buf, size_t *max_tokens_buf, size_t *num_tokens_buf) |
Split a string into tokens based on specified delimiters. More... | |
String Processing.
+General information can be found here.
+JAS_EXPORT char* jas_strdup | +( | +const char * | +s | ) | ++ |
Create a copy of a null-terminated string.
+This function has a behavior similar to the well-known strdup function.
+ +JAS_EXPORT int jas_stringtokenize | +( | +const char * | +string, | +
+ | + | const char * | +delim, | +
+ | + | char *** | +tokens_buf, | +
+ | + | size_t * | +max_tokens_buf, | +
+ | + | size_t * | +num_tokens_buf | +
+ | ) | ++ |
Split a string into tokens based on specified delimiters.
+string | A pointer to a null-terminated string to be split into tokens. |
delim | A pointer to a null-terminated string contained characters used to delimit tokens. |
tokens_buf | A pointer to the output token array. |
max_tokens_buf | A pointer to the allocated size of the token array. |
num_tokens_buf | A pointer to the number of elements in the token array. |
The memory to hold token information is allocated via jas_malloc() and friends.
+JAS_EXPORT char* jas_strtok | +( | +char * | +str, | +
+ | + | const char * | +delim, | +
+ | + | char ** | +saveptr | +
+ | ) | ++ |
Extract tokens from a string.
+This function has a similar behavior as strtok_r
in the POSIX standard.
Timers. +More...
++Classes | |
struct | jas_tmr_t |
Timer type. More... | |
+Functions | |
JAS_EXPORT void | jas_tmr_start (jas_tmr_t *tmr) |
Start a timer. More... | |
JAS_EXPORT void | jas_tmr_stop (jas_tmr_t *tmr) |
Stop a timer. More... | |
JAS_EXPORT double | jas_tmr_get (jas_tmr_t *tmr) |
Get the elapsed time for a timer. More... | |
Timers.
+General information can be found here.
+JAS_EXPORT double jas_tmr_get | +( | +jas_tmr_t * | +tmr | ) | ++ |
Get the elapsed time for a timer.
+ +JAS_EXPORT void jas_tmr_start | +( | +jas_tmr_t * | +tmr | ) | ++ |
Start a timer.
+ +JAS_EXPORT void jas_tmr_stop | +( | +jas_tmr_t * | +tmr | ) | ++ |
Stop a timer.
+ +Tag-Value Pair (TVP) Parsing. +More...
++Classes | |
struct | jas_taginfo_t |
Tag information type. More... | |
struct | jas_tvparser_t |
Tag-value parser type. More... | |
+Functions | |
JAS_ATTRIBUTE_PURE JAS_EXPORT const jas_taginfo_t * | jas_taginfos_lookup (const jas_taginfo_t *taginfos, const char *name) |
Lookup a tag by name. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT const jas_taginfo_t * | jas_taginfo_nonull (const jas_taginfo_t *taginfo) |
Ensure a nonnull taginfo pointer. More... | |
JAS_EXPORT jas_tvparser_t * | jas_tvparser_create (const char *s) |
Create a tag-value parser for the specified string. More... | |
JAS_EXPORT void | jas_tvparser_destroy (jas_tvparser_t *tvparser) |
Destroy a tag-value parser. More... | |
JAS_EXPORT int | jas_tvparser_next (jas_tvparser_t *tvparser) |
Get the next tag-value pair. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT const char * | jas_tvparser_gettag (const jas_tvparser_t *tvparser) |
Get the tag name for the current tag-value pair. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT const char * | jas_tvparser_getval (const jas_tvparser_t *tvparser) |
Get the value for the current tag-value pair. More... | |
Tag-Value Pair (TVP) Parsing.
+General information can be found here.
+JAS_ATTRIBUTE_PURE JAS_EXPORT const jas_taginfo_t* jas_taginfo_nonull | +( | +const jas_taginfo_t * | +taginfo | ) | ++ |
Ensure a nonnull taginfo pointer.
+This function returns a pointer to the specified taginfo object if it exists (i.e., the pointer is nonnull); otherwise, a pointer to a dummy object is returned. This is useful in some situations to avoid checking for a null pointer.
+ +JAS_ATTRIBUTE_PURE JAS_EXPORT const jas_taginfo_t* jas_taginfos_lookup | +( | +const jas_taginfo_t * | +taginfos, | +
+ | + | const char * | +name | +
+ | ) | ++ |
Lookup a tag by name.
+ +JAS_EXPORT jas_tvparser_t* jas_tvparser_create | +( | +const char * | +s | ) | ++ |
Create a tag-value parser for the specified string.
+ +JAS_EXPORT void jas_tvparser_destroy | +( | +jas_tvparser_t * | +tvparser | ) | ++ |
Destroy a tag-value parser.
+ +JAS_ATTRIBUTE_PURE JAS_EXPORT const char* jas_tvparser_gettag | +( | +const jas_tvparser_t * | +tvparser | ) | ++ |
Get the tag name for the current tag-value pair.
+ +JAS_ATTRIBUTE_PURE JAS_EXPORT const char* jas_tvparser_getval | +( | +const jas_tvparser_t * | +tvparser | ) | ++ |
Get the value for the current tag-value pair.
+ +JAS_EXPORT int jas_tvparser_next | +( | +jas_tvparser_t * | +tvparser | ) | ++ |
Get the next tag-value pair.
+ +JasPer is a collection of software (i.e., a library and application programs) for the coding and manipulation of images. This software can handle image data in a variety of formats. One such format supported by JasPer is the JPEG-2000 format defined in ISO/IEC 15444-1. This software was developed by Michael Adams from the Department of Electrical and Computer Engineering at the University of Victoria, Victoria, BC, Canada.
+Some of the features of the JasPer library are as follows:
+Several application programs are also provided:
+jasper
, an image transcoder program for converting between image formatsimginfo
, a program for querying the properties of an image, such as: width, height, number of components, and the number of bits per sampleimgcmp
, a program for comparing two images using various distance metrics, such as peak absolute error (PAE), mean absolute error (MAE), and peak signal to noise ratio (PSNR)jiv
, an image viewerIn release 3.0.0 of JasPer, the following notable changes were made to the API and/or behavior of the library relative to earlier releases (and therefore impact backward compatibility):
+jas_init()
and jas_cleanup()
functions have been marked as deprecated. The replacements for these functions are described in Configuration, Initialization, and Shutdown.jas_init()
function no longer registers jas_cleanup()
as an atexit handler. So, the library user is now responsible for invoking jas_cleanup()
at an appropriate time. This change was needed in order to better support the use of the JasPer library on some platforms.size_t/ssize_t
in
order to address some longstanding API issues:
+jas_stream_memopen2()
function has been deprecated.As part of the work done in preparing the JasPer 3.0.0 release, support for JasPer 3.0.0 was merged into the popular XV software, which can be obtained at:
+ +4.1.1 (2023-11-28) +================== + +* Disallow in-source builds by default. +* Fix a potential integer overflow problem in the jas_get_total_mem_size + function (for the Windows platform). + +4.1.0 (2023-11-04) +================== + +* Add support for building several JasPer application programs for + WebAssembly target with WASI support. + +4.0.1 (2023-11-04) +================== + +* Fix integer overflow bug in PNM decoder (#353). +* Fix a few minor build issues. + +4.0.0 (2022-11-05) +================== + +* Improve static linking (#336). +* Fix path relocation in mingw environment (#335). +* Improve logging and build scripts. +* Improve JPEG-2000 conformance test results. +* Enable PIC by default. +* Fix memory leaks in function cmdopts_parse (#332) (CVE-2022-2963). +* imgcmp: + + Add quiet (-q) option. + + Add debug-level option. + + Fix memory leak. +* imginfo: + + Add quiet (-q) option. +* Fix bug in parsing PGX header. +* Fix integer overflow bug (#345) (CVE-2022-40755). + +3.0.6 (2022-07-13) +================== + +* Fix bug in manual deployment script. + +3.0.5 (2022-06-23) +================== + +* Fix a minor build issue (#328). + +3.0.4 (2022-06-02) +================== + +* Eliminate some bogus calls to abort. +* Fix a typo in jas_safeui64_div (#323). +* Add some additional logging messages. +* Fix the source of a potential compiler warning (#321). + +3.0.3 (2022-03-15) +================== + +* Fix some portability issues in a few scripts. + +3.0.2 (2022-02-14) +================== + +* Fix a build issue that occurs when a cross-compiler is used (e.g., #319). + +3.0.1 (2022-02-12) +================== + +* Fix some build/portability issues (e.g., #317, #318). + +3.0.0 (2022-02-05) +================== + +VERY IMPORTANT NOTE: +This release of the JasPer software introduced some changes in the API +and/or behavior of the library relative to earlier releases, which may +necessitate some small changes in code using the library (e.g., to avoid +memory leaks or other problems). Please refer to the "News" section +of the JasPer Reference Manual for more details. For convenience, +this manual is available online (for various JasPer releases) at: + https://jasper-software.github.io/jasper-manual + +* Greatly improve documentation. +* Add support for multithreading. +* Add some customization points in the library, such as the memory allocator + and error logging function. +* Add improved memory usage tracking and limiting. +* Add experimental partial encoding/decoding support for the HEIC format. +* Fix some longstanding issues in the JasPer I/O streams API. +* Add the running of the full test suite in CI builds for the Windows platform. + (Previously, the full test suite was only run for CI builds on Unix-based + platforms.) +* Fix many bugs (e.g., #305, #307, #308, #309, #312, #314, and many others + not associated with any issue numbers). + +* Merged support for JasPer 3.0.0 into the XV software at: + https://github.com/jasper-software/xv.git + +2.0.33 (2021-08-01) +=================== + +* Fix a JP2/JPC decoder bug. (#291) +* Fix a build issue impacting some platforms. (#296) + +2.0.32 (2021-04-18) +=================== + +* Test release performed with GitHub Actions. + +2.0.29 (2021-04-16) +=================== + +* Loosen some overly tight restrictions on JP2 codestreams, which caused + some valid codestreams to be rejected. (#289) + +2.0.28 (2021-03-29) +=================== + +* Fix potential null pointer dereference in the JP2/JPC decoder. (#269) + (CVE-2021-3443) +* Fix ignoring of JAS_STREAM_FILEOBJ_NOCLOSE at stream close time. (#286) +* Fix integral type sizing problem in JP2 codec. (#284) + +2.0.27 (2021-03-18) +=================== + +* Check for an image containing no samples in the PGX + decoder. (#271, #272, #273, #274, #275, #276, #281) +* Check for dimensions of zero in the JPC and JPEG decoders. +* Fix an arguably incorrect type for an integer literal + in the PGX decoder. (#270) +* Check for an invalid component reference in the + JP2 decoder. (#269) +* Check on integer size in JP2 decoder. (#278) + +2.0.26 (2021-03-05) +=================== + +* Fix JP2 decoder bug that can cause a null pointer dereference for + some invalid CDEF boxes. (#268) (CVE-2021-3467) + +2.0.25 (2021-02-07) +=================== + +* Fix memory-related bugs in the JPEG-2000 codec resulting from + attempting to decode invalid code streams. (#264, #265) + This fix is associated with CVE-2021-26926 and CVE-2021-26927. +* Fix wrong return value under some compilers (#260) +* Fix CVE-2021-3272 heap buffer overflow in jp2_decode (#259) + +2.0.24 (2021-01-03) +=================== + +* Add JAS_VERSION_MAJOR, JAS_VERSION_MINOR, JAS_VERSION_PATCH + for easier access to the JasPer version. +* Fixes stack overflow bug on Windows, where variable-length + arrays are not available. (#256) + +2.0.23 (2020-12-08) +=================== + +* Fix CVE-2020-27828, heap-overflow in cp_create() in jpc_enc.c + https://github.com/jasper-software/jasper/issues/252 + +2.0.22 (2020-10-05) +=================== + +* Update manual + +* Remove JPEG dummy codec. Jasper needs libjpeg for JPEG support + +* Fix test suite build failure regarding disabled MIF codec (#249) + +* Fix OpenGL/glut detection (#247) + +2.0.21 (2020-09-20) +=================== + +* Fix ZDI-15-529 + https://github.com/jasper-software/jasper/pull/245 + +* Fix CVE-2018-19541 in decoder + https://github.com/jasper-software/jasper/pull/244 + +2.0.20 (2020-09-05) +=================== + +* Fix several ISO/IEC 15444-4 conformance bugs + +* Fix new variant of CVE-2016-9398 + +* Disable the MIF codec by default for security reasons (but it is still + included in the library); + in a future release, the MIF codec may also be excluded from the + library by default + +* Add documentation for the I/O streams library API + +2.0.19 (2020-07-11) +=================== + +* Fix CVE-2021-27845 + https://github.com/mdadams/jasper/issues/194 (part 1) + +* Fix CVE-2018-9154 + https://github.com/jasper-software/jasper/issues/215 + https://github.com/jasper-software/jasper/issues/166 + https://github.com/jasper-software/jasper/issues/175 + https://github.com/jasper-maint/jasper/issues/8 + +* Fix CVE-2018-19541 in encoder + https://github.com/jasper-software/jasper/pull/199 + https://github.com/jasper-maint/jasper/issues/6 + +* Fix CVE-2016-9399, CVE-2017-13751 + https://github.com/jasper-maint/jasper/issues/1 + +* Fix CVE-2018-19540 + https://github.com/jasper-software/jasper/issues/182 + https://github.com/jasper-maint/jasper/issues/22 + +* Fix CVE-2018-9055 + https://github.com/jasper-maint/jasper/issues/9 + +* Fix CVE-2017-13748 + https://github.com/jasper-software/jasper/issues/168 + +* Fix CVE-2017-5503, CVE-2017-5504, CVE-2017-5505 + https://github.com/jasper-maint/jasper/issues/3 + https://github.com/jasper-maint/jasper/issues/4 + https://github.com/jasper-maint/jasper/issues/5 + https://github.com/jasper-software/jasper/issues/88 + https://github.com/jasper-software/jasper/issues/89 + https://github.com/jasper-software/jasper/issues/90 + +* Fix CVE-2018-9252 + https://github.com/jasper-maint/jasper/issues/16 + +* Fix CVE-2018-19139 + https://github.com/jasper-maint/jasper/issues/14 + +* Fix CVE-2018-19543, CVE-2017-9782 + https://github.com/jasper-maint/jasper/issues/13 + https://github.com/jasper-maint/jasper/issues/18 + https://github.com/jasper-software/jasper/issues/140 + https://github.com/jasper-software/jasper/issues/182 + +* Fix CVE-2018-20570 + https://github.com/jasper-maint/jasper/issues/11 + https://github.com/jasper-software/jasper/issues/191 + +* Fix CVE-2018-20622 + https://github.com/jasper-maint/jasper/issues/12 + https://github.com/jasper-software/jasper/issues/193 + +* Fix CVE-2016-9398 + https://github.com/jasper-maint/jasper/issues/10 + +* Fix CVE-2017-14132 + https://github.com/jasper-maint/jasper/issues/17 + +* Fix CVE-2017-5499 + https://github.com/jasper-maint/jasper/issues/2 + https://github.com/jasper-software/jasper/issues/63 + +* Fix CVE-2018-18873 + https://github.com/jasper-maint/jasper/issues/15 + https://github.com/jasper-software/jasper/issues/184 + +* Fix https://github.com/jasper-software/jasper/issues/207 + +* Fix https://github.com/jasper-software/jasper/issues/194 part 1 + +* Fix CVE-2017-13750 + https://github.com/jasper-software/jasper/issues/165 + https://github.com/jasper-software/jasper/issues/174 + +* New option -DJAS_ENABLE_HIDDEN=true to not export internal symbols in the public symbol table + +* Fix various memory leaks + +* Plenty of code cleanups, and performance improvements + +* Some macros were changed to inline functions. This has to potential to + impact some code that made assumptions about the implementation. Some + potentially impacted macros include: + jas_matrix_numrows, jas_matrix_numcols + jas_matrix_get + jas_seq_get, jas_seq_start, jas_seq_end + jpc_ms_gettype + jas_matrix_set and jas_seq_set is affected differently; the old macro was + an actual expression returning the value, while the new function does not. + The following macros have been changed, too, but are likely not + affected, since they have been an rvalue-expression anyway: + JP2_DTYPETOBPC, JP2_BPCTODTYPE + JAS_IMAGE_CDT_{SETSGND,GETSGND,SETPREC,GETPREC} + jas_image_cmptdtype + macros from here + jas_matrix_setv, jas_matrix_getvref + jas_matrix_bind{row,col} + the jpc_fix_ family + the JPC_QCX and JPC_COX families +
As the JasPer software continues to evolve over time, it is important to be able to identify particular releases of the software. Every release of the JasPer software is named by a version identifier. A version identifier is comprised of three integers separated by dots. In order, the three integers correspond to the major, minor, and micro version numbers for the software. For example, the version identifier "1.500.0" corresponds to a major version of 1, a minor version of 500, and a micro version of 0. In instances where the micro version is zero, the version identifier may be truncated after the minor version number. For example, the version identifier "1.500" is completely valid and simply an abbreviation for "1.500.0".
+Given two different releases of the JasPer software, one can easily determine which one is more recent by comparing the version identifiers, as follows:
+The latest version of the JasPer software can be downloaded from the following locations:
+The JasPer software is distributed in the form of a gzipped tar archive. Therefore, in order to extract the contents of this file, a program capable of handling gzipped tar archives is required. Such software is readily available for most modern computing platforms.
+The JasPer code should compile and run on any platform with a C language implementation conforming to ISO/IEC 9899:2011 [iso9899-2011] (i.e., the ISO C language standard) and supporting a subset of ISO/IEC 9945-1 [iso9945p1] (i.e., the POSIX C API). Only limited POSIX support is required (e.g., the open
, close
, read
, write
, and lseek
functions must be supported).
If you need a C compiler that is reasonably compliant with the ISO/IEC 9899:2011 standard, you can obtain GNU C from the GNU Project web site (i.e., http://www.gnu.org). If you need the CMake software, this can be obtained from the official CMake web site (i.e., https://cmake.org).
+If you are unfortunate enough to have a compiler that is not compliant with ISO/IEC 9899:2011, you may need to make some changes to the code. Unfortunately, even some of the most popular C language implementations do not strictly comply with the standard. One such example is Microsoft Visual C 6.0. Due to the popularity of Visual C, however, several workarounds have been added to the JasPer code to ensure that it will compile successfully with Visual C.
+Portability was a major consideration during the design of the JasPer software. For this reason, the software makes minimal assumptions about the runtime environment. The code uses very little floating-point arithmetic, most of which can be attributed to floating-point conversions in invocations of the printf
function. This minimal use of floating-point arithmetic should make the code much easier to port to platforms lacking hardware support for floating-point arithmetic.
In order to have access to the full functionality of the JasPer sofware, you may need to install some additional software on your system. This software must be installed before you attempt to build JasPer.
+In order to build the JasPer software with JPEG support, you will need to download and install the free IJG JPEG library which is available from the IJG web site:
+ +In order to build the JasPer software with HEIC support, the Libheif library is needed. This library is available from:
+ +In order to build the jiv application, you will need the OpenGL and GLUT libraries installed on your system. Most modern systems include OpenGL support (including Linux, MacOS, and Microsoft Windows). The GLUT library is relatively less common and, therefore, may not be installed on your system. To obtain the GLUT library, one can visit:
+ +For more information on the OpenGL library, see:
+ +Obviously, before the software can be built, the contents of the archive file containing the JasPer distribution must be extracted.
+The JasPer software is intended to be built using CMake, a very popular cross-platform build tool. The current version of the JasPer software should compile on most modern Unix variants such as Linux and MacOS as well as Microsoft Windows. The continuous integration (CI) framework on GitHub used for JasPer development includes builds for the following environments:
+Also, the lead JasPer developer uses both the GCC and Clang compilers on Fedora Linux for much of their work. So, the JasPer software should build fairly reliably in these environments. Of course, the software should compile successfully in many other environments as well.
+Installation +============ + +The process required to install JasPer is described below. + +Installation on Systems Running Unix +------------------------------------ + +In what follows, let $SOURCE_DIR denote the top-level directory of the JasPer +software source tree (i.e., the directory containing the files named LICENSE +and INSTALL) and let $INSTALL_DIR denote the target directory for installation. +To build the software, the following steps are required (in order): + + 1. Select an empty directory to use for building the software. + Let $BUILD_DIR denote this directory. + + 2. Configure the software using CMake. + To do this, invoke the command: + + cmake -H$SOURCE_DIR -B$BUILD_DIR -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ + $OPTIONS + + where $OPTIONS corresponds to zero or more -D options as described below + under the heading "Cmake Options". + + This process allows important information about the system configuration + to be determined. Unless you know what you are doing (or have problems + with the default build settings), it is STRONGLY RECOMMENDED that you + not override the default build settings. + + 3. Build the software using CMake. + To do this, invoke the command: + + cmake --build $BUILD_DIR + + (Assuming that the build operation was successful, the executables + for the JasPer application programs should be located in the directory + $BUILD_DIR/src/app.) + + 4. Run the test suite to ensure that the software seems to be working + correctly. To do this, invoke the commands: + + cd $BUILD_DIR + ctest --output-on-failure + + 5. Install the software (i.e., the library, application programs, + header files, and other auxiliary data). + To do this, invoke the command: + + cmake --build $BUILD_DIR --target install + + This step may require special (e.g., administrator) privileges depending + on the target directory for installation. (On Unix-based systems, + the default installation directory is typically under usr/local.) + + Assuming that the software was installed successfully, the executables + for the JasPer application programs should be found somewhere under + the $CMAKE_INSTALL_PREFIX directory (e.g., $CMAKE_INSTALL_PREFIX/bin). + +Additional Remarks: + +When building the JasPer software under Mac OSX, only the use of the native +framework for OpenGL is officially supported. If the Freeglut library +is installed on your system, you will need to ensure that the native GLUT +library (as opposed to the Freeglut library) is used by the build process. +This can be accomplished by adding an extra option to the cmake command line +that resembles the following: + + -DGLUT_glut_LIBRARY=/System/Library/Frameworks/GLUT.framework + +Installation on Systems Running Microsoft Windows +------------------------------------------------- + +In what follows, let %SOURCE_DIR% denote the top-level directory of the +JasPer software source tree (i.e., the directory containing the files +named LICENSE and INSTALL) and let %INSTALL_DIR% denote the target +directory for installation. + +1) Select an empty directory to use for building the software. +Let %BUILD_DIR% denote this directory. + +2) Generate the project file needed to build the software with Microsoft +Visual Studio. To do this, invoke the command: + + cmake -G "Visual Studio 12 2013 Win64" -H%SOURCE_DIR% -B%BUILD_DIR% ^ + -DCMAKE_INSTALL_PREFIX=%INSTALL_DIR% %OPTIONS% + +where %OPTIONS% corresponds to zero or more -D options as described +below under the heading "Cmake Options". (Note the caret symbol "^" +above denotes line continuation.) + +3) Build and install the software. To do this, invoke the command: + + msbuild %build_dir%\INSTALL.vcxproj + +Other Remarks +------------- + +In some cases, it may be necessary to explicitly disable the use of the +IJG JPEG library (i.e., libjpeg). This is accomplished through a CMake +configuration option. (See the "CMake Options" section below.) For example, +such action may be required if the version of the JPEG library installed +on your system is not compatible with the version of JasPer being built. +Also, when building under the Cygwin environment, it may be necessary to +explicitly disable the use of the JPEG library. + +In some situations, it may be necessary to explicitly disable the use of the +OpenGL libraries. This is accomplished through a CMake configuration option. +(See the "CMake Options" section below.) + +CMake Options +------------- + +The option OPTION can be set to the value VALUE with a command-line option +of the form -DOPTION=VALUE +The following options are supported: + +CMAKE_INSTALL_PREFIX + Specify the installation directory. + Value: A directory name. + +CMAKE_BUILD_TYPE + Specify the build type (i.e., release or debug). + Valid values: Debug or Release + +JAS_ENABLE_MULTITHREADING_SUPPORT + Specify if the library should include multithreading support. + Valid values: true and false + +JAS_PREFER_PTHREAD + Specify if the POSIX Threads library should be preferred over native + C11 threading support. + Valid values: true and false + +JAS_ENABLE_PROGRAMS + Specify if the demo application programs should be built/installed. + Valid values: true and false + +JAS_ENABLE_DOC + Enable the building of the documentation (which requires LaTeX). + Valid values: true and false + +JAS_ENABLE_LIBJPEG + Enable the use of the JPEG library + Valid values: true and false + +JAS_ENABLE_OPENGL + Enable the use of the OpenGL and GLUT libraries. + Valid values: true and false + +JAS_ENABLE_SHARED + Enable the building of shared libraries. + Valid values: true or false + +JAS_ENABLE_HIDDEN + Hide internal symbols? Enabling this results in a smaller binary. + Valid values: true or false + +JAS_ENABLE_32BIT + Force the use of 32 bit integers? On 64 bit CPUs, JasPer + historically used 64 bit integers which consumes more memory, is + slower and has no advantages. This produces a different ABI, so + the resulting library is not compatible with other builds. + Valid values: true or false + +JAS_DEFAULT_MAX_MEM_USAGE + Specify the maximum amount of memory (in bytes) that may be used by + the library. + This value is only a default and can be overridden at run time. + Valid value: a (strictly) positive integer + +JAS_INCLUDE_BMP_CODEC +JAS_INCLUDE_JP2_CODEC +JAS_INCLUDE_JPC_CODEC +JAS_INCLUDE_JPG_CODEC +JAS_INCLUDE_MIF_CODEC +JAS_INCLUDE_PGX_CODEC +JAS_INCLUDE_PNM_CODEC +JAS_INCLUDE_RAS_CODEC + Include support for the specified codec in the library. + (This support can still be disabled at run time.) + Valid values: true or false + +JAS_ENABLE_BMP_CODEC +JAS_ENABLE_JP2_CODEC +JAS_ENABLE_JPC_CODEC +JAS_ENABLE_JPG_CODEC +JAS_ENABLE_MIF_CODEC +JAS_ENABLE_PGX_CODEC +JAS_ENABLE_PNM_CODEC +JAS_ENABLE_RAS_CODEC + Enable support for the specified codec by default at run time. + Valid values: true or false + +JAS_ENABLE_ASAN + Enable the Address Sanitizer. + Valid values: true or false + +JAS_ENABLE_UBSAN + Enable the Undefined-Behavior Sanitizer. + Valid values: true or false + +JAS_ENABLE_LSAN + Enable the Leak Sanitizer. + Valid values: true or false + +JAS_ENABLE_MSAN + Enable the Memory Sanitizer. + Valid values: true or false +
Digital imagery is used in many of today's computer software applications. Consequently, software modules that facilitate the handling of such data are often needed. Almost any application program that deals with images must address the problem of image interchange and import/export. That is, a means must exist for moving image data between an application and its external environment. Moreover, applications must often be capable of rendering an image for display on a particular output device (such as a monitor or printer) with reasonably accurate color/tone reproduction.
+Although image import/export and rendering are very basic functionalities, they are often not easily implemented. Usually, an image is represented in a coded format (such as JPEG-2000 JP2 [iso15444p1] or JPEG [iso10918p1]). Since coding formats are frequently quite complex, the import/export of image data can be a daunting task. Rendering an image in such a way as to accurately reproduce color/tone requires a color management scheme of some sort. Unfortunately, developing an effective color management engine can require considerable effort.
+A search for a solution to the above problems led to the development of the JasPer software. The remainder of this document provides a detailed description of the this software.
+In simple terms, JasPer is a software tool kit for the handling of image data. The software provides a means for representing images, and facilitates the manipulation of image data, as well as the import/export of such data in numerous formats (e.g., JPEG-2000 JP2 [iso15444p1], JPEG [iso10918p1], PNM [netpbm_web], BMP [Luse1994a], Sun Rasterfile [sun_openwinref], and PGX [iso15444p4]). The import functionality supports the auto-detection (i.e., automatic determination) of the image format, eliminating the need to explicitly identify the format of coded input data. A simple color management engine is also provided in order to allow the accurate representation of color. Partial support is included for the ICC color profile file format [icc_fffcp], an industry standard for specifying color.
+The JasPer software consists of a library and several application programs. The code is written in the C programming language [iso9899-2011] [Kernighan1988a]. This language was chosen primarily due to the availability of C development environments for most of today's computing platforms. At present, JasPer consists of approximately 40K lines of code. Although written in C, the JasPer library can be easily integrated into applications written in the C++ programming language as well.
+JasPer software development is based on an open-source model. A copy of the software license can be found in License.
+For more information about the JasPer software, please visit the following web pages:
+For more information about the JasPer software and JPEG-2000 standard, the reader is referred to [Adams2000c] [wg1n2412].
+The JasPer software is named, in part, after Jasper National Park, the largest national park in the Canadian Rockies with 10,878 square kilometres of mountain wilderness. As it happens, jasper is also the name of an opaque cryptocrystalline variety of quartz used for ornamentation or as a gemstone—hence, the implication that the software is precious (i.e., like a gemstone). Lastly, the name "jasper" was also chosen because it contains a letter "J" followed subsequently by a letter "P", not unlike the abbreviation "JP" that is associated with the JPEG-2000 standard.
+JasPer Color Management. +More...
+ +Go to the source code of this file.
++Classes | |
struct | jas_cmcmptfmt_t |
Component format. More... | |
struct | jas_cmpixmap_t |
Pixmap (i.e., multicomponent) format. More... | |
struct | jas_cmpxformops_t |
Transform operations. More... | |
struct | jas_cmshapmatlut_t |
Shaper matrix look-up table (LUT). More... | |
struct | jas_cmshapmat_t |
Shaper matrix. More... | |
struct | jas_cmshaplut_t |
Shaper look-up table (LUT). More... | |
struct | jas_cmclrspcconv_t |
Color space conversion. More... | |
struct | jas_cmpxform_s |
Transform class. More... | |
struct | jas_cmpxformseq_t |
Primitive transform sequence class. More... | |
struct | jas_cmxform_t |
Primitive transform class. More... | |
struct | jas_cmprof_t |
+Macros | |
#define | JAS_CMXFORM_NUMINTENTS 4 |
Number of rendering intents. More... | |
#define | jas_clrspc_create(fam, mbr) (((fam) << 8) | (mbr)) |
Create a color space. More... | |
#define | jas_clrspc_fam(clrspc) ((clrspc) >> 8) |
Get the family of a color space. More... | |
#define | jas_clrspc_mbr(clrspc) ((clrspc) & 0xff) |
Get the (family) member of a color space. More... | |
#define | jas_clrspc_isgeneric(clrspc) (!jas_clrspc_mbr(clrspc)) |
Test if a color space is generic. More... | |
#define | jas_clrspc_isunknown(clrspc) ((clrspc) & JAS_CLRSPC_UNKNOWNMASK) |
Test if a color space is unknown. More... | |
#define | JAS_CLRSPC_FAM_UNKNOWN 0 |
Color space families. More... | |
#define | JAS_CLRSPC_UNKNOWN JAS_CLRSPC_UNKNOWNMASK |
Specific color spaces. More... | |
#define | JAS_CLRSPC_GENRGB jas_clrspc_create(JAS_CLRSPC_FAM_RGB, 0) |
Generic color spaces. More... | |
#define | jas_cmprof_clrspc(prof) ((prof)->clrspc) |
Get the color space associated with a color-management profile. More... | |
+Typedefs | |
typedef unsigned | jas_clrspc_t |
Color space. More... | |
typedef double | jas_cmreal_t |
typedef struct jas_cmpxform_s | jas_cmpxform_t |
Transform class. More... | |
+Enumerations | |
enum | jas_cmxform_op_t |
Transform operations. More... | |
enum | jas_cmxform_intent_t |
Rendering intents. More... | |
enum | jas_cmxform_optm_t |
Transform optimization. More... | |
+Functions | |
JAS_EXPORT jas_cmprof_t * | jas_cmprof_createfromiccprof (const jas_iccprof_t *iccprof) |
Create a color-management profile from an ICC profile. More... | |
JAS_EXPORT jas_cmprof_t * | jas_cmprof_createfromclrspc (jas_clrspc_t clrspc) |
Create a color-management profile from a color space. More... | |
JAS_EXPORT void | jas_cmprof_destroy (jas_cmprof_t *prof) |
Destroy a color-management profile. More... | |
JAS_EXPORT jas_cmprof_t * | jas_cmprof_copy (const jas_cmprof_t *prof) |
Copy a color-management profile. More... | |
JAS_EXPORT jas_iccprof_t * | jas_iccprof_createfromcmprof (const jas_cmprof_t *prof) |
Create a ICC profile from a CM profile. More... | |
JAS_EXPORT jas_cmxform_t * | jas_cmxform_create (const jas_cmprof_t *inprof, const jas_cmprof_t *outprof, const jas_cmprof_t *proofprof, jas_cmxform_op_t op, jas_cmxform_intent_t intent, jas_cmxform_optm_t optimize) |
Create a transform from a CM profile. More... | |
JAS_EXPORT void | jas_cmxform_destroy (jas_cmxform_t *xform) |
Destroy a transform. More... | |
JAS_EXPORT int | jas_cmxform_apply (const jas_cmxform_t *xform, const jas_cmpixmap_t *in, jas_cmpixmap_t *out) |
Apply a transform to data. More... | |
unsigned | jas_clrspc_numchans (jas_clrspc_t clrspc) |
Get the number of channels associated with a particular color space. More... | |
JasPer Color Management.
+Compiler-related macros. +More...
+#include <jasper/jas_config.h>
Go to the source code of this file.
++Macros | |
#define | JAS_UNUSED(x) ((void) x) |
Indicate that a variable may be unused (in order to avoid a compiler warning). More... | |
Compiler-related macros.
+#define JAS_UNUSED | +( | ++ | x | ) | +((void) x) | +
Indicate that a variable may be unused (in order to avoid a compiler warning).
+ +JasPer Debugging-Related Functionality. +More...
+#include <jasper/jas_config.h>
#include "jasper/jas_init.h"
#include "jasper/jas_debug.h"
#include <stdio.h>
#include <stdarg.h>
Go to the source code of this file.
++Macros | |
#define | JAS_STRINGIFY(x) #x |
Convert to a string literal. More... | |
#define | JAS_STRINGIFYX(x) JAS_STRINGIFY(x) |
Convert to a string literal after macro expansion. More... | |
+Functions | |
JAS_EXPORT void | jas_deprecated (const char *fmt,...) |
Warn about the use of deprecated functionality. More... | |
static JAS_DEPRECATED int | jas_getdbglevel (void) |
Get the library debug level. More... | |
JAS_EXPORT int | jas_setdbglevel (int dbglevel) |
Set the library debug level. More... | |
JAS_EXPORT int | jas_eprintf (const char *fmt,...) |
Print formatted text for the standard error stream (i.e., stderr). More... | |
JAS_EXPORT int | jas_logprintf (const char *fmt,...) |
Generate a generic log message. More... | |
JAS_EXPORT int | jas_logerrorf (const char *fmt,...) |
Generate an error log message. More... | |
JAS_EXPORT int | jas_logwarnf (const char *fmt,...) |
Generate a warning log message. More... | |
JAS_EXPORT int | jas_loginfof (const char *fmt,...) |
Generate an informational log message. More... | |
JAS_EXPORT int | jas_logdebugf (int priority, const char *fmt,...) |
Generate a debugging log message. More... | |
int | jas_logmemdump (const void *data, size_t len) |
Dump memory. More... | |
JAS_EXPORT int | jas_memdump (FILE *out, const void *data, size_t len) |
Dump memory to a stream. More... | |
JasPer Debugging-Related Functionality.
+#define JAS_STRINGIFY | +( | ++ | x | ) | +#x | +
Convert to a string literal.
+ +#define JAS_STRINGIFYX | +( | ++ | x | ) | +JAS_STRINGIFY(x) | +
Convert to a string literal after macro expansion.
+ +JAS_EXPORT void jas_deprecated | +( | +const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Warn about the use of deprecated functionality.
+ +JAS_EXPORT int jas_eprintf | +( | +const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Print formatted text for the standard error stream (i.e., stderr).
+ +
+
|
+ +inlinestatic | +
Get the library debug level.
+JAS_EXPORT int jas_logdebugf | +( | +int | +priority, | +
+ | + | const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Generate a debugging log message.
+ +JAS_EXPORT int jas_logerrorf | +( | +const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Generate an error log message.
+ +JAS_EXPORT int jas_loginfof | +( | +const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Generate an informational log message.
+ +int jas_logmemdump | +( | +const void * | +data, | +
+ | + | size_t | +len | +
+ | ) | ++ |
Dump memory.
+ +JAS_EXPORT int jas_logprintf | +( | +const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Generate a generic log message.
+ +JAS_EXPORT int jas_logwarnf | +( | +const char * | +fmt, | +
+ | + | + | ... | +
+ | ) | ++ |
Generate a warning log message.
+ +JAS_EXPORT int jas_memdump | +( | +FILE * | +out, | +
+ | + | const void * | +data, | +
+ | + | size_t | +len | +
+ | ) | ++ |
Dump memory to a stream.
+ +JAS_EXPORT int jas_setdbglevel | +( | +int | +dbglevel | ) | ++ |
Set the library debug level.
+ +Shared Library Macros. +More...
+#include <jasper/jas_config.h>
#include <jasper/jas_export_cmake.h>
Go to the source code of this file.
+Shared Library Macros.
+JasPer Fixed-Point Number Class. +More...
+ +Go to the source code of this file.
++Macros | |
#define | JAS_FIX_ZERO(fix_t, fracbits) JAS_INTTOFIX(fix_t, fracbits, 0) |
#define | JAS_FIX_ONE(fix_t, fracbits) JAS_INTTOFIX(fix_t, fracbits, 1) |
#define | JAS_FIX_HALF(fix_t, fracbits) (JAS_CAST(fix_t, 1) << ((fracbits) - 1)) |
#define | JAS_INTTOFIX(fix_t, fracbits, x) (JAS_CAST(fix_t, x) << (fracbits)) |
#define | JAS_FIXTOINT(fix_t, fracbits, x) JAS_CAST(int, (x) >> (fracbits)) |
#define | JAS_FIXTODBL(fix_t, fracbits, x) (JAS_CAST(double, x) / JAS_FIX_ONE(fix_t, fracbits)) |
#define | JAS_DBLTOFIX(fix_t, fracbits, x) JAS_CAST(fix_t, ((x) * JAS_CAST(double, JAS_FIX_ONE(fix_t, fracbits)))) |
#define | JAS_FIX_ADD JAS_FIX_ADD_FAST |
#define | JAS_FIX_ADD_FAST(fix_t, fracbits, x, y) ((x) + (y)) |
#define | JAS_FIX_ADD_OFLOW(fix_t, fracbits, x, y) |
#define | JAS_FIX_MUL JAS_FIX_MUL_FAST |
#define | JAS_FIX_MUL_FAST(fix_t, fracbits, bigfix_t, x, y) |
#define | JAS_FIX_MUL_OFLOW(fix_t, fracbits, bigfix_t, x, y) |
#define | JAS_FIX_MULBYINT JAS_FIX_MULBYINT_FAST |
#define | JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y) JAS_CAST(fix_t, ((x) * (y))) |
#define | JAS_FIX_MULBYINT_OFLOW(fix_t, fracbits, x, y) JAS_FIX_MULBYINT_FAST(fix_t, fracbits, x, y) |
#define | JAS_FIX_DIV JAS_FIX_DIV_FAST |
#define | JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y) JAS_CAST(fix_t, (JAS_CAST(bigfix_t, x) << (fracbits)) / (y)) |
#define | JAS_FIX_DIV_UFLOW(fix_t, fracbits, bigfix_t, x, y) JAS_FIX_DIV_FAST(fix_t, fracbits, bigfix_t, x, y) |
#define | JAS_FIX_NEG JAS_FIX_NEG_FAST |
#define | JAS_FIX_NEG_FAST(fix_t, fracbits, x) (-(x)) |
#define | JAS_FIX_NEG_OFLOW(fix_t, fracbits, x) (((x) < 0) ? (-(x) > 0 || JAS_FIX_OFLOW(), -(x)) : (-(x))) |
#define | JAS_FIX_ASL JAS_FIX_ASL_FAST |
#define | JAS_FIX_ASL_FAST(fix_t, fracbits, x, n) ((x) << (n)) |
#define | JAS_FIX_ASL_OFLOW(fix_t, fracbits, x, n) ((((x) << (n)) >> (n)) == (x) || JAS_FIX_OFLOW(), (x) << (n)) |
#define | JAS_FIX_ASR JAS_FIX_ASR_FAST |
#define | JAS_FIX_ASR_FAST(fix_t, fracbits, x, n) ((x) >> (n)) |
#define | JAS_FIX_ASR_UFLOW(fix_t, fracbits, x, n) JAS_FIX_ASR_FAST(fix_t, fracbits, x, n) |
#define | JAS_FIX_SUB(fix_t, fracbits, x, y) JAS_FIX_ADD(fix_t, fracbits, x, JAS_FIX_NEG(fix_t, fracbits, y)) |
#define | JAS_FIX_PLUSEQ(fix_t, fracbits, x, y) ((x) = JAS_FIX_ADD(fix_t, fracbits, x, y)) |
#define | JAS_FIX_MINUSEQ(fix_t, fracbits, x, y) ((x) = JAS_FIX_SUB(fix_t, fracbits, x, y)) |
#define | JAS_FIX_MULEQ(fix_t, fracbits, bigfix_t, x, y) ((x) = JAS_FIX_MUL(fix_t, fracbits, bigfix_t, x, y)) |
#define | JAS_FIX_ABS(fix_t, fracbits, x) (((x) >= 0) ? (x) : (JAS_FIX_NEG(fix_t, fracbits, x))) |
#define | JAS_FIX_ISINT(fix_t, fracbits, x) (JAS_FIX_FLOOR(fix_t, fracbits, x) == (x)) |
#define | JAS_FIX_SGN(fix_t, fracbits, x) ((x) >= 0 ? 1 : (-1)) |
#define | JAS_FIX_CMP(fix_t, fracbits, x, y) ((x) > (y) ? 1 : (((x) == (y)) ? 0 : (-1))) |
#define | JAS_FIX_LT(fix_t, fracbits, x, y) ((x) < (y)) |
#define | JAS_FIX_LTE(fix_t, fracbits, x, y) ((x) <= (y)) |
#define | JAS_FIX_GT(fix_t, fracbits, x, y) ((x) > (y)) |
#define | JAS_FIX_GTE(fix_t, fracbits, x, y) ((x) >= (y)) |
#define | JAS_FIX_ROUND(fix_t, fracbits, x) |
#define | JAS_FIX_FLOOR(fix_t, fracbits, x) ((x) & (~(JAS_FIX_ONE(fix_t, fracbits) - 1))) |
+Typedefs | |
typedef int_least64_t | jas_fix_t |
JasPer Fixed-Point Number Class.
+Command Line Option Parsing Code. +More...
+#include <jasper/jas_config.h>
Go to the source code of this file.
++Classes | |
struct | jas_opt_t |
Command line option type. More... | |
+Macros | |
#define | JAS_GETOPT_EOF (-1) |
#define | JAS_GETOPT_ERR '?' |
#define | JAS_OPT_HASARG 0x01 /* option has argument */ |
+Functions | |
JAS_EXPORT int | jas_getopt (int argc, char **argv, const jas_opt_t *opts) |
Get the next option. More... | |
+Variables | |
JAS_EXPORT int | jas_optind |
The current option index. More... | |
JAS_EXPORT const char * | jas_optarg |
The current option argument. More... | |
JAS_EXPORT int | jas_opterr |
The debug level. More... | |
Command Line Option Parsing Code.
+ICC Profile. +More...
+#include <jasper/jas_config.h>
#include <jasper/jas_types.h>
#include <jasper/jas_stream.h>
#include <stdio.h>
Go to the source code of this file.
++Functions | |
JAS_EXPORT jas_iccprof_t * | jas_iccprof_load (jas_stream_t *in) |
Read an ICC profile from a stream. More... | |
JAS_EXPORT int | jas_iccprof_save (jas_iccprof_t *prof, jas_stream_t *out) |
Write an ICC profile to a stream. More... | |
JAS_EXPORT void | jas_iccprof_destroy (jas_iccprof_t *prof) |
Destroy an ICC profile. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT jas_iccattrval_t * | jas_iccprof_getattr (const jas_iccprof_t *prof, jas_iccattrname_t name) |
Get an attribute of an ICC profile. More... | |
JAS_EXPORT int | jas_iccprof_setattr (jas_iccprof_t *prof, jas_iccattrname_t name, jas_iccattrval_t *val) |
Set an attribute of an ICC profile. More... | |
JAS_EXPORT void | jas_iccprof_dump (const jas_iccprof_t *prof, FILE *out) |
Dump an ICC profile to a stream in human-readable format for debugging purposes. More... | |
JAS_EXPORT jas_iccprof_t * | jas_iccprof_copy (const jas_iccprof_t *prof) |
Create a copy of an ICC profile. More... | |
JAS_EXPORT int | jas_iccprof_gethdr (const jas_iccprof_t *prof, jas_icchdr_t *hdr) |
Get the header for an ICC profile. More... | |
JAS_EXPORT int | jas_iccprof_sethdr (jas_iccprof_t *prof, const jas_icchdr_t *hdr) |
Set the header for an ICC profile. More... | |
JAS_EXPORT void | jas_iccattrval_destroy (jas_iccattrval_t *attrval) |
Destroy an ICC profile attribute. More... | |
JAS_EXPORT int | jas_iccattrval_allowmodify (jas_iccattrval_t **attrval) |
TODO/FIXME. More... | |
JAS_EXPORT jas_iccattrval_t * | jas_iccattrval_clone (jas_iccattrval_t *attrval) |
Create a copy of an ICC profile attribute. More... | |
JAS_EXPORT jas_iccattrval_t * | jas_iccattrval_create (jas_iccuint32_t type) |
Create an ICC profile attribute. More... | |
JAS_EXPORT void | jas_iccattrtab_dump (const jas_iccattrtab_t *attrtab, FILE *out) |
Dump an ICC profile attribute to a stream in human-readable format for debugging purposes. More... | |
JAS_EXPORT jas_iccprof_t * | jas_iccprof_createfrombuf (const jas_uchar *buf, unsigned len) |
Create an ICC profile from a buffer in memory. More... | |
JAS_EXPORT jas_iccprof_t * | jas_iccprof_createfromclrspc (unsigned clrspc) |
Create an ICC profile from a color space. More... | |
ICC Profile.
+JasPer Image Class. +More...
+#include <jasper/jas_config.h>
#include <jasper/jas_stream.h>
#include <jasper/jas_types.h>
#include <jasper/jas_seq.h>
#include <jasper/jas_cm.h>
#include <stdio.h>
Go to the source code of this file.
++Classes | |
struct | jas_image_cmpt_t |
Image component class. More... | |
struct | jas_image_t |
Image class. More... | |
struct | jas_image_cmptparm_t |
Component parameters class. More... | |
struct | jas_image_fmtops_t |
Image format-dependent operations. More... | |
struct | jas_image_fmtinfo_t |
Image format information. More... | |
+Macros | |
#define | JAS_IMAGE_MAXFMTS 32 |
The maximum number of image data formats supported. More... | |
#define | jas_image_width(image) ((image)->brx_ - (image)->tlx_) |
Get the width of the image in units of the image reference grid. More... | |
#define | jas_image_height(image) ((image)->bry_ - (image)->tly_) |
Get the height of the image in units of the image reference grid. More... | |
#define | jas_image_tlx(image) ((image)->tlx_) |
Get the x-coordinate of the top-left corner of the image bounding box on the reference grid. More... | |
#define | jas_image_tly(image) ((image)->tly_) |
Get the y-coordinate of the top-left corner of the image bounding box on the reference grid. More... | |
#define | jas_image_brx(image) ((image)->brx_) |
Get the x-coordinate of the bottom-right corner of the image bounding box on the reference grid (plus one). More... | |
#define | jas_image_bry(image) ((image)->bry_) |
Get the y-coordinate of the bottom-right corner of the image bounding box on the reference grid (plus one). More... | |
#define | jas_image_numcmpts(image) ((image)->numcmpts_) |
Get the number of image components. More... | |
#define | jas_image_clrspc(image) ((image)->clrspc_) |
Get the color model used by the image. More... | |
#define | jas_image_setclrspc(image, clrspc) ((image)->clrspc_ = (clrspc)) |
Set the color model for an image. More... | |
#define | jas_image_cmptwidth(image, cmptno) ((image)->cmpts_[cmptno]->width_) |
Get the width of a component. More... | |
#define | jas_image_cmptheight(image, cmptno) ((image)->cmpts_[cmptno]->height_) |
Get the height of a component. More... | |
#define | jas_image_cmptsgnd(image, cmptno) ((image)->cmpts_[cmptno]->sgnd_) |
Get the signedness of the sample data for a component. More... | |
#define | jas_image_cmptprec(image, cmptno) ((image)->cmpts_[cmptno]->prec_) |
Get the precision of the sample data for a component. More... | |
#define | jas_image_cmpthstep(image, cmptno) ((image)->cmpts_[cmptno]->hstep_) |
Get the horizontal subsampling factor for a component. More... | |
#define | jas_image_cmptvstep(image, cmptno) ((image)->cmpts_[cmptno]->vstep_) |
Get the vertical subsampling factor for a component. More... | |
#define | jas_image_cmpttlx(image, cmptno) ((image)->cmpts_[cmptno]->tlx_) |
Get the x-coordinate of the top-left corner of a component. More... | |
#define | jas_image_cmpttly(image, cmptno) ((image)->cmpts_[cmptno]->tly_) |
Get the y-coordinate of the top-left corner of a component. More... | |
#define | jas_image_cmptbrx(image, cmptno) |
Get the x-coordinate of the bottom-right corner of a component (plus "one"). More... | |
#define | jas_image_cmptbry(image, cmptno) |
Get the y-coordinate of the bottom-right corner of a component (plus "one"). More... | |
#define | jas_image_cmprof(image) ((image)->cmprof_) |
Get the color management profile of an image. More... | |
#define | jas_image_setcmprof(image, cmprof) ((image)->cmprof_ = cmprof) |
Set the color management profile for an image. More... | |
+Typedefs | |
typedef int_fast32_t | jas_image_coord_t |
Image coordinate. More... | |
typedef int_fast16_t | jas_image_colorspc_t |
Color space (e.g., RGB, YCbCr). More... | |
typedef int_fast32_t | jas_image_cmpttype_t |
Component type (e.g., color, opacity). More... | |
typedef int_fast16_t | jas_image_smpltype_t |
Component sample data format (e.g., real/integer, signedness, precision). More... | |
+Functions | |
JAS_EXPORT jas_image_t * | jas_image_create (unsigned numcmpts, const jas_image_cmptparm_t *cmptparms, jas_clrspc_t clrspc) |
Create an image. More... | |
JAS_EXPORT jas_image_t * | jas_image_create0 (void) |
Create an "empty" image. More... | |
JAS_EXPORT jas_image_t * | jas_image_copy (jas_image_t *image) |
Clone an image. More... | |
JAS_EXPORT void | jas_image_destroy (jas_image_t *image) |
Deallocate any resources associated with an image. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT bool | jas_image_cmpt_domains_same (const jas_image_t *image) |
Test if all components are specified at the same positions in space. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT uint_fast32_t | jas_image_rawsize (const jas_image_t *image) |
Get the raw size of an image (i.e., the nominal size of the image without any compression. More... | |
JAS_EXPORT jas_image_t * | jas_image_decode (jas_stream_t *in, int fmt, const char *optstr) |
Create an image from a stream in some specified format. More... | |
JAS_EXPORT int | jas_image_encode (jas_image_t *image, jas_stream_t *out, int fmt, const char *optstr) |
Write an image to a stream in a specified format. More... | |
JAS_EXPORT int | jas_image_readcmpt (jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, jas_matrix_t *data) |
Read a rectangular region of an image component. More... | |
JAS_EXPORT int | jas_image_writecmpt (jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, const jas_matrix_t *data) |
Write a rectangular region of an image component. More... | |
JAS_EXPORT void | jas_image_delcmpt (jas_image_t *image, unsigned cmptno) |
Delete a component from an image. More... | |
JAS_EXPORT int | jas_image_addcmpt (jas_image_t *image, int cmptno, const jas_image_cmptparm_t *cmptparm) |
Add a component to an image. More... | |
JAS_EXPORT int | jas_image_copycmpt (jas_image_t *dstimage, unsigned dstcmptno, jas_image_t *srcimage, unsigned srccmptno) |
Copy a component from one image to another. More... | |
JAS_EXPORT int | jas_image_depalettize (jas_image_t *image, unsigned cmptno, unsigned numlutents, const int_fast32_t *lutents, unsigned dtype, unsigned newcmptno) |
Depalettize an image. More... | |
JAS_EXPORT int | jas_image_readcmptsample (jas_image_t *image, unsigned cmptno, unsigned x, unsigned y) |
Read a component sample for an image. More... | |
JAS_EXPORT void | jas_image_writecmptsample (jas_image_t *image, unsigned cmptno, unsigned x, unsigned y, int_fast32_t v) |
Write a component sample for an image. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT int | jas_image_getcmptbytype (const jas_image_t *image, jas_image_cmpttype_t ctype) |
Get an image component by its type. More... | |
JAS_EXPORT void | jas_image_clearfmts (void) |
Clear the table of image formats. More... | |
JAS_EXPORT const jas_image_fmtinfo_t * | jas_image_getfmtbyind (int index) |
Get a image format entry by its table index. More... | |
JAS_EXPORT int | jas_image_getnumfmts (void) |
Get the number of image format table entries. More... | |
JAS_EXPORT int | jas_image_setfmtenable (int index, int enabled) |
Get the number of image format table entries. More... | |
JAS_EXPORT int | jas_image_addfmt (int id, const char *name, const char *ext, const char *desc, const jas_image_fmtops_t *ops) |
Add entry to table of image formats. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT int | jas_image_strtofmt (const char *s) |
Get the ID for the image format with the specified name. More... | |
JAS_ATTRIBUTE_CONST JAS_EXPORT const char * | jas_image_fmttostr (int fmt) |
Get the name of the image format with the specified ID. More... | |
JAS_ATTRIBUTE_CONST JAS_EXPORT const jas_image_fmtinfo_t * | jas_image_lookupfmtbyid (int id) |
Lookup image format information by the format ID. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT const jas_image_fmtinfo_t * | jas_image_lookupfmtbyname (const char *name) |
Lookup image format information by the format name. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT int | jas_image_fmtfromname (const char *filename) |
Guess the format of an image file based on its name. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT int | jas_image_getfmt (jas_stream_t *in) |
Get the format of image data in a stream. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT int | jas_image_ishomosamp (const jas_image_t *image) |
Test if the sampling of the image is homogeneous. More... | |
JAS_EXPORT int | jas_image_sampcmpt (jas_image_t *image, unsigned cmptno, unsigned newcmptno, jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs, jas_image_coord_t vs, int sgnd, unsigned prec) |
??? More... | |
JAS_EXPORT int | jas_image_writecmpt2 (jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, const long *buf) |
Write sample data in a component of an image. More... | |
JAS_EXPORT int | jas_image_readcmpt2 (jas_image_t *image, unsigned cmptno, jas_image_coord_t x, jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, long *buf) |
Read sample data in a component of an image. More... | |
JAS_EXPORT jas_image_t * | jas_image_chclrspc (jas_image_t *image, const jas_cmprof_t *outprof, jas_cmxform_intent_t intent) |
Change the color space for an image. More... | |
JAS_EXPORT int | jas_image_dump (jas_image_t *image, FILE *out) |
Dump the information for an image (for debugging). More... | |
JasPer Image Class.
+JasPer Initialization/Cleanup Code. +More...
+#include <jasper/jas_config.h>
#include "jasper/jas_malloc.h"
#include "jasper/jas_image.h"
#include "jasper/jas_log.h"
#include <stdarg.h>
Go to the source code of this file.
++Typedefs | |
typedef void * | jas_context_t |
An opaque handle type used to represent a JasPer library context. More... | |
+Functions | |
JAS_EXPORT void | jas_conf_clear (void) |
Configure the JasPer library with the default configuration settings. More... | |
JAS_EXPORT void | jas_conf_set_multithread (int multithread) |
Set the multithreading flag for the library. More... | |
JAS_EXPORT void | jas_conf_set_allocator (jas_allocator_t *allocator) |
Set the memory allocator to be used by the library. More... | |
JAS_EXPORT void | jas_conf_set_debug_level (int debug_level) |
Set the initial debug level for the library. More... | |
JAS_EXPORT void | jas_conf_set_max_mem_usage (size_t max_mem) |
Set the maximum amount of memory that can be used by the library (assuming the allocator wrapper is not disabled). More... | |
JAS_EXPORT void | jas_conf_set_dec_default_max_samples (size_t max_samples) |
Set the default value for the maximum number of samples that is allowed in an image to be decoded. More... | |
JAS_EXPORT void | jas_conf_set_vlogmsgf (jas_vlogmsgf_t *func) |
Set the function used by the library to output error, warning, and informational messages. More... | |
JAS_EXPORT int | jas_init_library (void) |
Initialize the JasPer library with the current configuration settings. More... | |
JAS_EXPORT int | jas_cleanup_library (void) |
Perform clean up for the JasPer library. More... | |
JAS_EXPORT int | jas_init_thread (void) |
Perform per-thread initialization for the JasPer library. More... | |
JAS_EXPORT int | jas_cleanup_thread (void) |
Perform per-thread cleanup for the JasPer library. More... | |
JAS_EXPORT int | jas_init (void) |
Configure and initialize the JasPer library using the default configuration settings. More... | |
JAS_EXPORT void | jas_cleanup (void) |
Perform any clean up for the JasPer library. More... | |
JAS_EXPORT jas_context_t | jas_context_create (void) |
Create a context. More... | |
JAS_EXPORT void | jas_context_destroy (jas_context_t context) |
Destroy a context. More... | |
JAS_EXPORT jas_context_t | jas_get_default_context (void) |
Get the current context for the calling thread. More... | |
JAS_EXPORT jas_context_t | jas_get_context (void) |
Get the current context for the calling thread. More... | |
JAS_EXPORT void | jas_set_context (jas_context_t context) |
Set the current context for the calling thread. More... | |
JAS_EXPORT void | jas_set_debug_level (int debug_level) |
Set the debug level for a particular context. More... | |
static int | jas_get_debug_level (void) |
Get the debug level for a particular context. More... | |
JAS_EXPORT void | jas_set_dec_default_max_samples (size_t max_samples) |
Set the default maximum number of samples that a decoder is permitted to process. More... | |
static size_t | jas_get_dec_default_max_samples (void) |
Get the default maximum number of samples that a decoder is permitted to process. More... | |
JAS_EXPORT void | jas_set_vlogmsgf (jas_vlogmsgf_t *func) |
Set the function to be used for log messages. More... | |
static jas_vlogmsgf_t * | jas_get_vlogmsgf (void) |
Get the function to be used for log messages. More... | |
JasPer Initialization/Cleanup Code.
+JasPer Logging Functionality. +More...
+#include <jasper/jas_config.h>
#include <stdio.h>
#include <stdarg.h>
Go to the source code of this file.
++Macros | |
#define | JAS_LOGTYPE_CLASS_NULL 0 |
#define | JAS_LOGTYPE_CLASS_ERROR 1 |
#define | JAS_LOGTYPE_CLASS_WARN 2 |
#define | JAS_LOGTYPE_CLASS_INFO 3 |
#define | JAS_LOGTYPE_CLASS_DEBUG 4 |
+Typedefs | |
typedef int() | jas_vlogmsgf_t(jas_logtype_t, const char *, va_list) |
Type used for formatted message logging function. More... | |
+Functions | |
static jas_logtype_t | jas_logtype_init (int clas, int priority) |
Create an instance of a logtype. More... | |
static int | jas_logtype_getclass (jas_logtype_t type) |
Get the class of a logtype. More... | |
static int | jas_logtype_getpriority (jas_logtype_t type) |
Get the priority of a logtype. More... | |
JAS_EXPORT int | jas_vlogmsgf (jas_logtype_t type, const char *fmt, va_list ap) |
Print formatted log message. More... | |
JAS_EXPORT int | jas_vlogmsgf_stderr (jas_logtype_t type, const char *fmt, va_list ap) |
Output a log message to standard error. More... | |
JAS_EXPORT int | jas_vlogmsgf_discard (jas_logtype_t type, const char *fmt, va_list ap) |
Output a log message to nowhere (i.e., discard the message). More... | |
JasPer Logging Functionality.
+JasPer Memory Allocator. +More...
+#include <jasper/jas_config.h>
#include <jasper/jas_types.h>
#include <jasper/jas_thread.h>
#include <stdio.h>
Go to the source code of this file.
++Classes | |
struct | jas_allocator_s |
A memory allocator. More... | |
struct | jas_std_allocator_t |
The standard library allocator (i.e., a wrapper for malloc and friends). More... | |
+Typedefs | |
typedef struct jas_allocator_s | jas_allocator_t |
A memory allocator. More... | |
+Functions | |
JAS_EXPORT void * | jas_malloc (size_t size) |
Allocate memory. More... | |
JAS_EXPORT void | jas_free (void *ptr) |
Free memory. More... | |
JAS_EXPORT void * | jas_realloc (void *ptr, size_t size) |
Resize a block of allocated memory. More... | |
JAS_EXPORT void * | jas_calloc (size_t num_elements, size_t element_size) |
Allocate a block of memory and initialize the contents to zero. More... | |
JAS_EXPORT void * | jas_alloc2 (size_t num_elements, size_t element_size) |
Allocate array (with overflow checking). More... | |
JAS_EXPORT void * | jas_alloc3 (size_t num_arrays, size_t array_size, size_t element_size) |
Allocate array of arrays (with overflow checking). More... | |
JAS_EXPORT void * | jas_realloc2 (void *ptr, size_t num_elements, size_t element_size) |
Resize a block of allocated memory (with overflow checking). More... | |
JAS_EXPORT void | jas_set_max_mem_usage (size_t max_mem) |
Set the maximum memory usage allowed by the allocator wrapper. More... | |
JAS_EXPORT size_t | jas_get_mem_usage (void) |
Get the current memory usage from the allocator wrapper. More... | |
JAS_EXPORT void | jas_std_allocator_init (jas_std_allocator_t *allocator) |
Initialize a memory allocator that uses malloc and related functions for managing memory. More... | |
JAS_EXPORT void | jas_allocator_cleanup (jas_allocator_t *allocator) |
Clean up an allocator that is no longer needed. More... | |
JAS_EXPORT size_t | jas_get_total_mem_size (void) |
Get the total amount of memory available on the system. More... | |
JasPer Memory Allocator.
+Math-Related Code. +More...
+#include <jasper/jas_config.h>
#include <jasper/jas_compiler.h>
#include <jasper/jas_types.h>
#include <assert.h>
#include <string.h>
#include <stdint.h>
#include <limits.h>
Go to the source code of this file.
+Math-Related Code.
+Sequence/Matrix Library. +More...
+#include <jasper/jas_config.h>
#include <jasper/jas_types.h>
#include <jasper/jas_fix.h>
#include <jasper/jas_math.h>
#include <stdio.h>
Go to the source code of this file.
++Classes | |
struct | jas_matrix_t |
Matrix type. More... | |
+Functions | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_matrix_numrows (const jas_matrix_t *matrix) |
Get the number of rows in a matrix. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_matrix_numcols (const jas_matrix_t *matrix) |
Get the number of columns in a matrix. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_matrix_size (const jas_matrix_t *matrix) |
Get the number of elements in a matrix. More... | |
static JAS_ATTRIBUTE_PURE bool | jas_matrix_empty (const jas_matrix_t *matrix) |
Test if a matrix is empty (i.e., contains no elements). More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t | jas_matrix_get (const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j) |
Get a matrix element. More... | |
static void | jas_matrix_set (jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j, jas_seqent_t v) |
Set a matrix element. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t | jas_matrix_getv (const jas_matrix_t *matrix, jas_matind_t i) |
Get an element from a matrix that is known to be a row or column vector. More... | |
static void | jas_matrix_setv (jas_matrix_t *matrix, jas_matind_t i, jas_seqent_t v) |
Set an element in a matrix that is known to be a row or column vector. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t * | jas_matrix_getref (const jas_matrix_t *matrix, jas_matind_t i, jas_matind_t j) |
Get the address of an element in a matrix. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t * | jas_matrix_getvref (const jas_matrix_t *matrix, jas_matind_t i) |
Get a reference to a particular row of a 2-D sequence. More... | |
JAS_EXPORT jas_matrix_t * | jas_matrix_create (jas_matind_t numrows, jas_matind_t numcols) |
Create a matrix with the specified dimensions. More... | |
JAS_EXPORT void | jas_matrix_destroy (jas_matrix_t *matrix) |
Destroy a matrix. More... | |
JAS_EXPORT int | jas_matrix_resize (jas_matrix_t *matrix, jas_matind_t numrows, jas_matind_t numcols) |
Resize a matrix. The previous contents of the matrix are lost. More... | |
JAS_EXPORT int | jas_matrix_output (jas_matrix_t *matrix, FILE *out) |
Write a matrix to a C standard library stream. More... | |
JAS_EXPORT int | jas_matrix_bindsub (jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t r0, jas_matind_t c0, jas_matind_t r1, jas_matind_t c1) |
Create a matrix that references part of another matrix. More... | |
static int | jas_matrix_bindrow (jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t r) |
Create a matrix that is a reference to a row of another matrix. More... | |
static int | jas_matrix_bindcol (jas_matrix_t *mat0, jas_matrix_t *mat1, jas_matind_t c) |
Create a matrix that is a reference to a column of another matrix. More... | |
JAS_EXPORT void | jas_matrix_clip (jas_matrix_t *matrix, jas_seqent_t minval, jas_seqent_t maxval) |
Clip the values of matrix elements to the specified range. More... | |
JAS_EXPORT void | jas_matrix_asl (jas_matrix_t *matrix, unsigned n) |
Arithmetic shift left of all elements in a matrix. More... | |
JAS_EXPORT void | jas_matrix_asr (jas_matrix_t *matrix, unsigned n) |
Arithmetic shift right of all elements in a matrix. More... | |
JAS_EXPORT void | jas_matrix_divpow2 (jas_matrix_t *matrix, unsigned n) |
Almost-but-not-quite arithmetic shift right of all elements in a matrix. More... | |
JAS_EXPORT void | jas_matrix_setall (jas_matrix_t *matrix, jas_seqent_t val) |
Set all elements of a matrix to the specified value. More... | |
static JAS_ATTRIBUTE_PURE size_t | jas_matrix_rowstep (const jas_matrix_t *matrix) |
The spacing between rows of a matrix. More... | |
static JAS_ATTRIBUTE_PURE size_t | jas_matrix_step (const jas_matrix_t *matrix) |
The spacing between columns of a matrix. More... | |
JAS_EXPORT int | jas_matrix_cmp (jas_matrix_t *mat0, jas_matrix_t *mat1) |
Compare two matrices for equality. More... | |
JAS_EXPORT jas_matrix_t * | jas_matrix_copy (jas_matrix_t *x) |
Copy a matrix. More... | |
JAS_EXPORT jas_matrix_t * | jas_matrix_input (FILE *) |
Read a matrix from a C standard library stream. More... | |
JAS_EXPORT jas_seq2d_t * | jas_seq2d_copy (jas_seq2d_t *x) |
Copy a 2-D sequence. More... | |
JAS_EXPORT jas_matrix_t * | jas_seq2d_create (jas_matind_t xstart, jas_matind_t ystart, jas_matind_t xend, jas_matind_t yend) |
Create a 2-D sequence. More... | |
static void | jas_seq2d_destroy (jas_seq2d_t *s) |
Destroy a 2-D sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq2d_xstart (const jas_seq2d_t *s) |
Get the starting x-coordinate of the sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq2d_ystart (const jas_seq2d_t *s) |
Get the starting y-coordinate of the sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq2d_xend (const jas_seq2d_t *s) |
Get the ending x-coordinate of the sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq2d_yend (const jas_seq2d_t *s) |
Get the ending y-coordinate of the sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t * | jas_seq2d_getref (const jas_seq2d_t *s, jas_matind_t x, jas_matind_t y) |
Get a pointer (i.e., reference) to an element of a 2-D sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t | jas_seq2d_get (const jas_seq2d_t *s, jas_matind_t x, jas_matind_t y) |
Get an element of a 2-D sequence. More... | |
static JAS_ATTRIBUTE_PURE size_t | jas_seq2d_rowstep (const jas_seq2d_t *s) |
Get the stride between successive rows in the sequence. More... | |
static JAS_ATTRIBUTE_PURE unsigned | jas_seq2d_width (const jas_seq2d_t *s) |
Get the number of columns in the sequence. More... | |
static JAS_ATTRIBUTE_PURE unsigned | jas_seq2d_height (const jas_seq2d_t *s) |
Get the number of rows in the sequence. More... | |
static void | jas_seq2d_setshift (jas_seq2d_t *s, jas_matind_t x, jas_matind_t y) |
Set the shift (i.e., starting x- and y-coordinates) of the sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq2d_size (const jas_seq2d_t *s) |
Get the number of elements in the sequence. More... | |
static JAS_ATTRIBUTE_PURE bool | jas_seq2d_empty (const jas_seq2d_t *s) |
Test if the sequence is empty (i.e., contains no elements). More... | |
JAS_EXPORT int | jas_seq2d_bindsub (jas_matrix_t *s, jas_matrix_t *s1, jas_matind_t xstart, jas_matind_t ystart, jas_matind_t xend, jas_matind_t yend) |
Initialize a sequence to reference a subsequence of another sequence. More... | |
static jas_seq_t * | jas_seq_create (jas_matind_t start, jas_matind_t end) |
Create a 1-D sequence. More... | |
static void | jas_seq_destroy (jas_seq_t *seq) |
Destroy a 1-D sequence. More... | |
static void | jas_seq_set (jas_seq_t *seq, jas_matind_t i, jas_seqent_t v) |
Set an element of a sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t * | jas_seq_getref (const jas_seq_t *seq, jas_matind_t i) |
Get a pointer (i.e., reference) to an element of a sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_seqent_t | jas_seq_get (const jas_seq_t *seq, jas_matind_t i) |
Get an element of a sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq_start (const jas_seq_t *seq) |
Get the starting index of a sequence. More... | |
static JAS_ATTRIBUTE_PURE jas_matind_t | jas_seq_end (const jas_seq_t *seq) |
Get the ending index of a sequence. More... | |
Sequence/Matrix Library.
+I/O Stream Class. +More...
+ +Go to the source code of this file.
++Classes | |
struct | jas_stream_t |
I/O stream object. More... | |
+Macros | |
#define | jas_stream_eof(stream) (((stream)->flags_ & JAS_STREAM_EOF) != 0) |
Get the EOF indicator for a stream. More... | |
#define | jas_stream_error(stream) (((stream)->flags_ & JAS_STREAM_ERR) != 0) |
Get the error indicator for a stream. More... | |
#define | jas_stream_clearerr(stream) ((stream)->flags_ &= ~(JAS_STREAM_ERR | JAS_STREAM_EOF)) |
Clear the error indicator for a stream. More... | |
#define | jas_stream_getrwlimit(stream) (((const jas_stream_t *)(stream))->rwlimit_) |
Get the read/write limit for a stream. More... | |
#define | jas_stream_getrwcount(stream) (((const jas_stream_t *)(stream))->rwcnt_) |
Get the read/write count for a stream. More... | |
#define | jas_stream_getc(stream) jas_stream_getc_func(stream) |
jas_stream_getc Read a character from a stream. More... | |
#define | jas_stream_putc(stream, c) jas_stream_putc_func(stream, c) |
jas_stream_putc Write a character to a stream. More... | |
#define | jas_stream_peekc(stream) |
Look at the next character to be read from a stream without actually removing the character from the stream. More... | |
+Functions | |
JAS_EXPORT jas_stream_t * | jas_stream_fopen (const char *filename, const char *mode) |
Open a file as a stream. More... | |
JAS_EXPORT jas_stream_t * | jas_stream_memopen (char *buffer, size_t buffer_size) |
Open a memory buffer as a stream. More... | |
JAS_DEPRECATED JAS_EXPORT jas_stream_t * | jas_stream_memopen2 (char *buffer, size_t buffer_size) |
Do not use. More... | |
JAS_EXPORT jas_stream_t * | jas_stream_fdopen (int fd, const char *mode) |
Open a file descriptor as a stream. More... | |
JAS_EXPORT jas_stream_t * | jas_stream_freopen (const char *path, const char *mode, FILE *fp) |
Open a stdio (i.e., C standard library) stream as a stream. More... | |
JAS_EXPORT jas_stream_t * | jas_stream_tmpfile (void) |
Open a temporary file as a stream. More... | |
JAS_EXPORT int | jas_stream_close (jas_stream_t *stream) |
Close a stream. More... | |
JAS_EXPORT long | jas_stream_setrwlimit (jas_stream_t *stream, long rwlimit) |
Set the read/write limit for a stream. More... | |
JAS_EXPORT long | jas_stream_setrwcount (jas_stream_t *stream, long rw_count) |
Set the read/write count for a stream. More... | |
JAS_EXPORT size_t | jas_stream_read (jas_stream_t *stream, void *buffer, size_t count) |
Read characters from a stream into a buffer. More... | |
JAS_EXPORT unsigned | jas_stream_peek (jas_stream_t *stream, void *buffer, size_t count) |
Attempt to retrieve one or more pending characters of input from a stream into a buffer without actually removing the characters from the stream. More... | |
JAS_EXPORT size_t | jas_stream_write (jas_stream_t *stream, const void *buffer, size_t count) |
Write characters from a buffer to a stream. More... | |
JAS_EXPORT int | jas_stream_printf (jas_stream_t *stream, const char *format,...) |
Write formatted output to a stream. More... | |
JAS_EXPORT int | jas_stream_puts (jas_stream_t *stream, const char *s) |
Write a string to a stream. More... | |
JAS_EXPORT char * | jas_stream_gets (jas_stream_t *stream, char *buffer, int buffer_size) |
Read a line of input from a stream. More... | |
JAS_EXPORT int | jas_stream_ungetc (jas_stream_t *stream, int c) |
Put a character back on a stream. More... | |
JAS_EXPORT JAS_ATTRIBUTE_PURE int | jas_stream_isseekable (jas_stream_t *stream) |
Determine if stream supports seeking. More... | |
JAS_EXPORT long | jas_stream_seek (jas_stream_t *stream, long offset, int origin) |
Set the current position within the stream. More... | |
JAS_EXPORT long | jas_stream_tell (jas_stream_t *stream) |
Get the current position within the stream. More... | |
JAS_EXPORT int | jas_stream_rewind (jas_stream_t *stream) |
Seek to the beginning of a stream. More... | |
JAS_EXPORT int | jas_stream_flush (jas_stream_t *stream) |
Flush any pending output to a stream. More... | |
JAS_EXPORT int | jas_stream_copy (jas_stream_t *destination, jas_stream_t *source, ssize_t count) |
Copy data from one stream to another. More... | |
JAS_EXPORT int | jas_stream_display (jas_stream_t *stream, FILE *fp, int count) |
Print a hex dump of data read from a stream. More... | |
JAS_EXPORT ssize_t | jas_stream_gobble (jas_stream_t *stream, size_t count) |
Consume (i.e., discard) characters from stream. More... | |
JAS_EXPORT ssize_t | jas_stream_pad (jas_stream_t *stream, size_t count, int value) |
Write a fill character multiple times to a stream. More... | |
JAS_EXPORT long | jas_stream_length (jas_stream_t *stream) |
Get the size of the file associated with the specified stream. More... | |
I/O Stream Class.
+String Library. +More...
+ +Go to the source code of this file.
++Functions | |
JAS_EXPORT char * | jas_strdup (const char *) |
Create a copy of a null-terminated string. More... | |
JAS_EXPORT char * | jas_strtok (char *str, const char *delim, char **saveptr) |
Extract tokens from a string. More... | |
JAS_EXPORT int | jas_stringtokenize (const char *string, const char *delim, char ***tokens_buf, size_t *max_tokens_buf, size_t *num_tokens_buf) |
Split a string into tokens based on specified delimiters. More... | |
String Library.
+Threads. +More...
+#include <jasper/jas_config.h>
#include "jasper/jas_compiler.h"
#include "jasper/jas_types.h"
#include <stdlib.h>
#include <assert.h>
#include <threads.h>
#include <stdatomic.h>
Go to the source code of this file.
+Threads.
+Timer Code. +More...
+#include <jasper/jas_config.h>
#include <time.h>
Go to the source code of this file.
++Functions | |
JAS_EXPORT void | jas_tmr_start (jas_tmr_t *tmr) |
Start a timer. More... | |
JAS_EXPORT void | jas_tmr_stop (jas_tmr_t *tmr) |
Stop a timer. More... | |
JAS_EXPORT double | jas_tmr_get (jas_tmr_t *tmr) |
Get the elapsed time for a timer. More... | |
Timer Code.
+Tag/Value Pair Parser. +More...
+#include <jasper/jas_config.h>
Go to the source code of this file.
++Classes | |
struct | jas_taginfo_t |
Tag information type. More... | |
struct | jas_tvparser_t |
Tag-value parser type. More... | |
+Functions | |
JAS_ATTRIBUTE_PURE JAS_EXPORT const jas_taginfo_t * | jas_taginfos_lookup (const jas_taginfo_t *taginfos, const char *name) |
Lookup a tag by name. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT const jas_taginfo_t * | jas_taginfo_nonull (const jas_taginfo_t *taginfo) |
Ensure a nonnull taginfo pointer. More... | |
JAS_EXPORT jas_tvparser_t * | jas_tvparser_create (const char *s) |
Create a tag-value parser for the specified string. More... | |
JAS_EXPORT void | jas_tvparser_destroy (jas_tvparser_t *tvparser) |
Destroy a tag-value parser. More... | |
JAS_EXPORT int | jas_tvparser_next (jas_tvparser_t *tvparser) |
Get the next tag-value pair. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT const char * | jas_tvparser_gettag (const jas_tvparser_t *tvparser) |
Get the tag name for the current tag-value pair. More... | |
JAS_ATTRIBUTE_PURE JAS_EXPORT const char * | jas_tvparser_getval (const jas_tvparser_t *tvparser) |
Get the value for the current tag-value pair. More... | |
Tag/Value Pair Parser.
+Primitive Types. +More...
+#include <jasper/jas_config.h>
#include <stddef.h>
#include <stdint.h>
#include <limits.h>
#include <stdbool.h>
#include <inttypes.h>
Go to the source code of this file.
+Primitive Types.
+JasPer Version. +More...
+#include <jasper/jas_config.h>
Go to the source code of this file.
+JasPer Version.
+JasPer Main Header. +More...
+#include <jasper/jas_config.h>
#include <jasper/jas_types.h>
#include <jasper/jas_version.h>
#include <jasper/jas_init.h>
#include <jasper/jas_cm.h>
#include <jasper/jas_icc.h>
#include <jasper/jas_fix.h>
#include <jasper/jas_debug.h>
#include <jasper/jas_getopt.h>
#include <jasper/jas_image.h>
#include <jasper/jas_math.h>
#include <jasper/jas_malloc.h>
#include <jasper/jas_seq.h>
#include <jasper/jas_stream.h>
#include <jasper/jas_string.h>
#include <jasper/jas_tmr.h>
#include <jasper/jas_tvp.h>
#include <jasper/jas_thread.h>
#include <jasper/jas_log.h>
Go to the source code of this file.
+JasPer Main Header.
+The heart of the JasPer software is the JasPer library. In fact, most of the code in JasPer is associated with this library (as opposed to the JasPer sample application programs). The JasPer library provides classes for representing images, color profiles (i.e., color space definitions), and other related entities. Each of these classes has a well-defined interface through which an application may interact with class objects. The library can be used to manipulate images, import/export image data in a variety of formats, and perform basic color management operations.
+Conceptually, the JasPer library is structured as shown in Figure fig__swstruct. The library consists of two distinct types of code:
+The core code provides the basic framework upon which the library is built, while the codec drivers only provide the means for encoding/decoding image data in various formats. All application interfaces are through the core code. The codec drivers are only ever directly called by the core code, never by an application.
+The codec support in the JasPer library is both modular and extensible. A well-defined interface exists between the core code and codec drivers. Moreover, support for a new image format can be easily added without having to modify the library in any way. To do so, a codec driver for the new format simply needs to be provided. Furthermore, an application need only include codec drivers for the image formats that it will use. In this way, an application can avoid the cost of increased memory consumption for codec drivers that are never to be employed.
+To avoid name space collisions, all of the identifiers used by the core code are prefixed with either jas_
or JAS_
. The core code provides a number of key classes. Some of these classes include the following:
jas_image_t
). This class is used to represent an image. Methods are provided for such things as:jas_cmprof_t
). This class is used to define a color space. Such a definition is made relative to a reference color space such as CIE XYZ or CIE Lab [icc_fffcp].jas_cmxform_t
). This class is used to apply a color space conversion to image data. A color space transform is created from two or more color profiles.jas_stream_t
). This class provides I/O streams similar to that of standard C library [iso9899-2011], but with additional functionality required by other code in the JasPer library. This extra functionality includes:jas_tvp_t
). This class is used to parse strings containing one or more tag-value pairs. A tag-value pair is a string of the form "tag=value". Tag-value pairs are used by some interfaces within JasPer in order to pass parameters. For example, such pairs are used to pass options to codec drivers for encoding/decoding operations. Methods are provides for such things as:In addition to the above classes, some other functionality is provided, including command line parsing routines (similar in spirit to UNIX getopt
).
The core code provides a framework for housing codec drivers. A codec driver provides the means for encoding/decoding of image data in a particular format. Each driver provides three methods:
+The encoding method emits the coded version of an image (i.e., a jas_image_t
object) to a stream (i.e., a jas_stream_t
object). The decoding method creates an image (i.e., a jas_image_t
object) from the coded data in a stream. The validation method is used to quickly test if the data in a stream is formatted correctly for the image format in question. This particular method is used for the autodetection of image formats.
The codec drivers provided with the JasPer distribution are written in order to accommodate streamed data. In other words, image data streams are always processed in a single pass. This design philosophy eliminates the need for a stream object to be seekable. As a result, it is possible to write application programs that receive data from, or send data to, pipelines or other entities that do not support random access to data.
+The set of applications for which JasPer may be a useful tool is dictated, in part, by the image model that JasPer employs. Therefore, it is prudent to introduce this model here. The image model employed by JasPer is quite general and partially inspired by the one used in the JPEG-2000 standard.
+An image is comprised of one or more components. In turn, each component consists of rectangular array of samples. This structure is depicted in Figures fig__imgmodel_a and fig__imgmodel_b. The sample values for each component are integer valued, and can be signed or unsigned with precision from 1 to (nominally) 16 bits/sample. The maximum allowable precision is platform dependent. Most common platforms, however, should be able to accommodate at least 16 bits/sample. The signedness and precision of the sample data are specified on a per-component basis. All of the components are associated with same spatial extent in an image, but represent different types of information.
+There is considerable flexibility in the interpretation of components. A component may represent spectral information (e.g., a color plane) or auxiliary information (e.g., an opacity plane). For example, a RGB image would have three components, where one component is associated with each of the red, green, and blue color planes. A RGBA (i.e., RGB with transparency) image would have four components, one associated with each of the red, green, blue, and alpha planes. The various components need not be sampled at the same resolution. In other words, different components may have different sampling periods. For example, when color images are represented in a luminance-chrominance color space, it is not uncommon for the luminance information to be more finely sampled than the chrominance information.
+Since an image can have a number of components, a means must exist for specifying how these components are combined together in order to form a composite image. For this purpose, we employ an integer lattice known as the reference grid. The reference grid provides an anchor point for the various components of an image, and establishes their alignment relative to one another.
+Each component is associated with a rectangular sampling grid. Such a grid is uniquely specified by four parameters:
+The samples of a component are then mapped onto the points where the sampling grid intersects the reference grid. In this way, sample $(i,j)$ of a component is mapped to the position $(\text{HO} + i \text{HS}, \text{VO} + j \text{VS})$ on the reference grid.
+To clarify the above text, we now present an illustrative example. Consider an image with three components. For the $k$th component, let us denote the horizontal grid offset, vertical grid offset, horizontal grid spacing, and vertical grid spacing, as $\text{HO}_k$, $\text{VO}_k$, $\text{HS}_k$, and $\text{VS}_k$, respectively. Suppose, for example, that these parameters have the following values:
+$k$ | $(\text{HO}_k, \text{VO}_k)$ | $(\text{HS}_k, \text{VS}_k)$ |
---|---|---|
0 | (0, 0) | (2, 2) |
1 | (2, 3) | (3, 4) |
2 | (3, 2) | (4, 3) |
In this scenario, the component samples would be aligned on the reference grid as illustrated in Figure fig__refgridex. Perhaps, it is worth nothing that the above set of parameter values was chosen in order to provide an enlightening example, and is not meant to represent a set of values that is likely to be used with great frequency by applications.
+From above, we can see that the image model used by JasPer is quite general. The main constraint imposed by this model is that rectangular sampling must be employed. The vast majority of applications, however, use such sampling. Also, with JasPer, one can easily accommodate grayscale, color, and other multi-band data (with or without opacity information).
+Since the image model employed is true color (i.e., not palettized), the codec drivers are responsible for palettization and depalettization in the case of image formats that utilized palettized representations.
+In order to use the JasPer library, a C source file normally must include the main JasPer library header file jasper/jasper.h
. This can be accomplished with the following preprocessor directive:
#include <jasper/jasper.h> +
The main header file includes all of the other library header files. Therefore, in order to insulate application code from possible changes to the names of the other library header files, one should only ever include the main library header directly.
+The first usage of the library must always be to initialize it. This is accomplished as described in Configuration, Initialization, and Shutdown. If any functionality of the library is used before initialization is performed, the resulting behavior is undefined.
+All memory allocation in the libjasper library is performed via the functions jas_malloc()
, jas_realloc()
, jas_calloc()
, and jas_free()
. The underlying memory allocator used by these functions can be controlled by the application. By default, an alloator based on malloc()
is used. If one is trying to port the JasPer code to an embedded platform, it might be necessary to use a custom memory allocator instead. More detailed information on memory allocators for JasPer can be found in Memory Allocators and the Allocator Wrapper.
Support for new image formats can be easily added to JasPer. In order to add support for a new image format, one must provide three functions:
+The encoding function emits the coded version of an image (i.e., an jas_image_t
object) to a stream (i.e., a jas_stream_t
object). The decoding function creates an image (i.e., a jas_image_t
object) from the coded data in a stream (i.e., a jas_stream_t
object). The validation function is used to quickly test if a data stream is formatted correctly for the image format in question. (This functionality is necessary for the autodetection of image formats.)
The precise interface provided by each of the encoding, decoding, and validation functions is as follows:
+int (*encode)(jas_image_t *image, jas_stream_t *out, const char *opts);
Encode image data to a stream. The image pointed to by image
is encoded in accordance with the options specified in the null-terminated string pointed to by opts
and written to the stream out
. The options string is a whitespace-delimited sequence of tag-value pairs. If the encoding operation is successful, zero is returned. Otherwise, a nonzero value is returned.
jas_image_t *(*decode)(jas_stream_t *in, const char *opts);
Decode an image from a stream. The image data from the stream in
is decoded in accordance with the options specified in the null-terminated string pointed to by opts
. The options string is a whitespace-delimited sequence of tag-value pairs. If the decoding operation is successful, a pointer to the decoded image is returned. Otherwise, a null pointer is returned.
int (*validate)(jas_stream_t *in);
Determine if stream data is in a particular format. The first few characters of the stream in
are examined in order to determine if the stream is encoded in the format supported by the codec. The characters examined are not removed from the stream. (In other words, the current read/write position in the stream is left unchanged by this function.) If the format is supported by the codec, zero is returned. Otherwise, a nonzero value is returned.
Numerous examples of these types of function can be found by examining the code for the image formats already supported by JasPer (e.g., BMP, JP2, JPC, MIF, PGX, PNM, RAS, and JPEG). Once the above functions have been written, the JasPer library can be made aware of the new image format through a call to jas_image_addfmt()
. This call, of course, must be made after the JasPer library has been initialized.