Crate charls_sys
source ·Re-exports§
pub use self::charls_encoding_options_private_encoding_options as charls_encoding_options;
Structs§
Defines the information that can be stored in a JPEG-LS Frame marker segment that applies to all scans. The JPEG-LS also allow to store sub-sampling information in a JPEG-LS Frame marker segment. CharLS does not support JPEG-LS images that contain sub-sampled scans. Defines the JPEG-LS preset coding parameters as defined in ISO/IEC 14495-1, C.2.4.1.1. JPEG-LS defines a default set of parameters, but custom parameters can be used. When used these parameters are written into the encoded bit stream as they are needed for the decoding process. Defines the information that can be stored in a SPIFF header as defined in ISO/IEC 10918-3, Annex F The type I.8 is an unsigned 8 bit integer, the type I.32 is an 32 bit unsigned integer in the file header itself. The type is indicated by the symbol “F.” are 4-byte parameters in “fixed point” notation. The 16 most significant bits are essentially the same as a parameter of type I.16 and indicate the integer part of this number. The 16 least significant bits are essentially the same as an I.16 parameter and contain an unsigned integer that, when divided by 65536, represents the fractional part of the fixed point number.
Constants§
Ensures that the generated encoded data has an even size by adding an extra 0xFF byte to the End Of Image (EOI) marker. DICOM requires that data is always even. This can be done by adding a zero padding byte after the encoded data or with this option. This option is not default enabled. Writes explicitly the default JPEG-LS preset coding parameters when the bits per sample is larger then 12 bits. The Java Advanced Imaging (JAI) JPEG-LS codec has a defect that causes it to use invalid preset coding parameters for these types of images. Most users of this codec are aware of this problem and have implemented a work-around. This option is default enabled. Will not be default enabled in the next major version upgrade. Add a comment (COM) segment with the content: "charls [version-number]" to the encoded data. Storing the used encoder version can be helpful for long term archival of images. This option is not default enabled. No special encoding option is defined. The interleave mode is by line. A full line of each component is encoded before moving to the next line. The data is encoded and stored as component for component: RRRGGGBBB. The data is encoded and stored by sample. For RGB color images this is the format like RGBRGBRGB. The bit depth for transformation is not supported. This error is returned when a callback function returns a non zero value. The color transform is not supported. The destination buffer is too small to hold all the output. This error is returned when the stream contains duplicate component identifiers in the SOF segment. This error is returned when the stream contains more then one SOF marker. This error is returned when the stream contains more then one SOI marker. This error is returned when an encoded frame is found that is not encoded with the JPEG-LS algorithm. This error is returned when the End of Image (EOI) marker could not be found. This error is returned when one of the arguments is invalid and no specific reason is available. The argument for the bit per sample parameter is outside the range [2, 16]. The argument for the color component is not (None, Hp1, Hp2, Hp3) or invalid in combination with component count. The argument for the component count parameter is outside the range [1, 255]. The encoding options argument has an invalid value. The argument for the height parameter is outside the range [1, 65535]. The argument for the interleave mode is not (None, Sample, Line) or invalid in combination with component count. The argument for the JPEG-LS preset coding parameters is not valid, see ISO/IEC 14495-1, C.2.4.1.1, Table C.1 for the ranges of valid values. The argument for the near lossless parameter is outside the range [0, 255]. The argument for the size parameter is outside the valid range. The stride argument does not match with the frame info and buffer size. The argument for the width parameter is outside the range [1, 65535]. This error is returned when the encoded bit stream contains a general structural problem. This error is returned when the stream contains an invalid type parameter in the JPEG-LS segment. This error is returned when the segment size of a marker segment is invalid. This error is returned when a method call is invalid for the current state. This error is returned when the stream contains a bits per sample (sample precision) parameter outside the range [2,16] This error is returned when the stream contains a component count parameter outside the range [1,255] for SOF or [1,4] for SOS. This error is returned when the stream contains a height parameter defined more then once in an incompatible way. This error is returned when the stream contains an interleave mode (ILV) parameter outside the range [0, 2] This error is returned when the stream contains an invalid JPEG-LS preset parameters segment. This error is returned when the stream contains a near-lossless (NEAR) parameter outside the range [0, min(255, MAXVAL/2)] This error is returned when the stream contains a width parameter defined more then once or in an incompatible way. This error is returned when the SPIFF header is invalid. This error is returned when the algorithm expect a 0xFF code (indicates start of a JPEG marker) but none was found. This error is returned when the stream contains an unsupported type parameter in the JPEG-LS segment. This error is returned when the stream contains a SPIFF header but not an SPIFF end-of-directory entry. This error is returned when the implementation could not allocate memory for its internal buffers. This error is returned when the JPEG stream contains a parameter value that is not supported by this implementation. This error is returned when an expected restart marker is not found. It may indicate data corruption in the JPEG-LS byte stream. The source buffer is too small, more input data was expected. This error is returned when the first JPEG marker is not the SOI marker. The operation completed without errors. Too much compressed data.The decoding process is ready but the input buffer still contains encoded data. This error is returned when the stream contains an unexpected EOI marker. This error is returned when the implementation encountered a failure it did not expect. No guarantees can be given for the state after this error. This error is returned when a JPEG marker is found that is not valid for the current state. This error is returned when a restart marker is found outside the encoded entropy data. This error is returned when an unknown JPEG marker code is found in the encoded bit stream. Bi-level image. Each image sample is one bit: 0 = white and 1 = black. This option is not valid for JPEG-LS encoded images. Bi-level image. Each image sample is one bit: 1 = white and 0 = black. This option is not valid for JPEG-LS encoded images. The CIE 1976 (L* a* b*) color space. The encoded data consists of samples of Cyan, Magenta and Yellow samples. The encoded data consists of samples of Cyan, Magenta, Yellow and Black samples. Grayscale – This is a single component sample with interpretation as grayscale value, 0 is minimum, 2bps -1 is maximum. Color space interpretation of the coded sample is none of the other options. This is the color encoding method used in the Photo CD™ system. The encoded data consists of samples of (uncalibrated) R, G and B. The color space is based on recommendation ITU-R BT.601-1. (RGB). The color space is based on recommendation ITU-R BT.601-1. (video). The color space is based on recommendation ITU-R BT.709. Transformed CMYK type data (same as Adobe PostScript) ISO/IEC 11544, commonly known as JBIG, only allowed for bi-level images. ISO/IEC 10918-1 or ISO/IEC 10918-3, commonly known as JPEG. ISO/IEC 14495-1 or ISO/IEC 14495-2, commonly known as JPEG-LS. (extension defined in ISO/IEC 14495-1). This is the only valid option for JPEG-LS encoded images. Recommendation T.4, the basic algorithm commonly known as MH (Modified Huffman), only allowed for bi-level images. Recommendation T .6, commonly known as MMR (Modified Modified READ), only allowed for bi-level images. Recommendation T.4, commonly known as MR (Modified READ), only allowed for bi-level images. Picture data is stored in component interleaved format, encoded at BPS per sample. Bi-level facsimile profile (MH, MR, MMR, JBIG) Continuous-tone base profile (JPEG) Continuous-tone facsimile profile (JPEG) Continuous-tone progressive profile No profile identified. This is the only valid option for JPEG-LS encoded images. VRES and HRES are to be interpreted as aspect ratio. If vertical or horizontal resolutions are not known, use this option and set VRES and HRES both to 1 to indicate that pixels in the image should be assumed to be square. Units of dots/samples per centimeter. Units of dots/samples per inch
Functions§
Creates a JPEG-LS decoder instance, when finished with the instance destroy it with the function charls_jpegls_decoder_destroy. A reference to a new created decoder instance, or a null pointer when the creation fails. Will decode the JPEG-LS byte stream from the source buffer into the destination buffer. Function should be called after calling the function charls_jpegls_decoder_read_header. Reference to the decoder instance. Byte array that holds the encoded bytes when the function returns. Length of the array in bytes. If the array is too small the function will return an error. Number of bytes to the next line in the buffer, when zero, decoder will compute it.The result of the operation: success or a failure code. Destroys a JPEG-LS decoder instance created with charls_jpegls_decoder_create and releases all internal resources attached to it. Instance to destroy. If a null pointer is passed as argument, no action occurs.Returns the size required for the destination buffer in bytes to hold the decoded pixel data. Function should be called after calling the function charls_jpegls_decoder_read_header. Reference to the decoder instance. Number of bytes to the next line in the buffer, when zero, decoder will compute it. Output argument, will hold the required size when the function returns.The result of the operation: success or a failure code. Returns information about the frame stored in the JPEG-LS byte stream. Function should be called after calling the function charls_jpegls_decoder_read_header. Reference to the decoder instance. Output argument, will hold the frame info when the function returns.The result of the operation: success or a failure code. Reads the JPEG-LS header from the JPEG byte stream. After this function is called frame info can be retrieved. Reference to the decoder instance.The result of the operation: success or a failure code. Tries to read the SPIFF header from the source buffer. If a SPIFF header exists its content will be put into the spiff_header parameter and header_found will be set to 1. Call charls_jpegls_decoder_read_header to read the normal JPEG header afterwards. Reference to the decoder instance. Output argument, will hold the SPIFF header when one could be found. Output argument, will hold 1 if a SPIFF header could be found, otherwise 0.The result of the operation: success or a failure code. Set the reference to a source buffer that contains the encoded JPEG-LS byte stream data. This buffer needs to remain valid until the buffer is fully decoded. Reference to the decoder instance. Reference to the start of the source buffer. Size of the source buffer in bytes.The result of the operation: success or a failure code. Creates a JPEG-LS encoder instance, when finished with the instance destroy it with the function charls_jpegls_encoder_destroy. A reference to a new created encoder instance, or a null pointer when the creation fails. Destroys a JPEG-LS encoder instance created with charls_jpegls_encoder_create and releases all internal resources attached to it. Instance to destroy. If a null pointer is passed as argument, no action occurs.Encodes the passed buffer with the source image data to the destination. Reference to the encoder instance. Byte array that holds the image data that needs to be encoded. Length of the array in bytes. The number of bytes from one row of pixels in memory to the next row of pixels in memory. Stride is sometimes called pitch. If padding bytes are present, the stride is wider than the width of the image.The result of the operation: success or a failure code. Returns the size in bytes, that are written to the destination. Reference to the encoder instance. Reference to the size that will be set when the functions returns.The result of the operation: success or a failure code. Returns the size in bytes, that the encoder expects are needed to hold the encoded image. Size for dynamic extras like SPIFF entries and other tables are not included in this size. Reference to the encoder instance. Reference to the size that will be set when the functions returns.The result of the operation: success or a failure code. Set the reference to the destination buffer that will contain the encoded JPEG-LS byte stream data after encoding. This buffer needs to remain valid during the encoding process. Reference to the encoder instance. Reference to the start of the destination buffer. Size of the destination buffer in bytes.The result of the operation: success or a failure code. Configures the encoding options the encoder should use. Default is charls_encoding_options::include_pc_parameters_jai Reference to the encoder instance. Options to use.The result of the operation: success or a failure code. Configures the frame that needs to be encoded. This information will be written to the Start of Frame segment. Reference to the encoder instance. Information about the frame that needs to be encoded.The result of the operation: success or a failure code. Configures the interleave mode the encoder should use. The default is none. The encoder expects the input buffer in the same format as the interleave mode. Reference to the encoder instance. Value of the interleave mode.The result of the operation: success or a failure code. Configures the NEAR parameter the encoder should use. A value of 0 means lossless, 0 is also the default. Reference to the encoder instance. Value of the NEAR parameter.The result of the operation: success or a failure code. Configures the preset coding parameters the encoder should use. If not set the encoder will use the default preset coding parameters as defined by the JPEG-LS standard. Only when the coding parameters are different than the default parameters or when `include_pc_parameters_jai` is set, they will be written to the JPEG-LS stream during the encode phase. Reference to the encoder instance. Reference to the preset coding parameters.The result of the operation: success or a failure code.
Type Aliases§
Defines options that can be enabled during the encoding process. These options can be combined. Defines the interleave modes for multi-component (color) pixel data. Defines the result values that are returned by the CharLS API functions. Defines the color space options that can be used in a SPIFF header v2, as defined in ISO/IEC 10918-3, F.2.1.1 Defines the compression options that can be used in a SPIFF header v2, as defined in ISO/IEC 10918-3, F.2.1 Defines the Application profile identifier options that can be used in a SPIFF header v2, as defined in ISO/IEC 10918-3, F.1.2 Defines the resolution units for the VRES and HRES parameters, as defined in ISO/IEC 10918-3, F.2.1