C# Class CharLS.JpegLSCodec

Provides methods and for compressing and decompressing arrays using the JPEG-LS algorithm.
This class represents the JPEG-LS algorithm, an industry standard algorithm for lossless and near-lossless image data compression and decompression.
Afficher le fichier Open project: team-charls/charls Class Usage Examples

Private Properties

Свойство Type Description
GetUncompressedSize int
HandleResult void
JpegLsReadHeaderThrowWhenError void

Méthodes publiques

Méthode Description
Compress ( JpegLSMetadataInfo info, byte pixels, bool jfifHeader = false ) : ArraySegment

Compresses the specified image passed in the source pixel buffer.

Compress ( JpegLSMetadataInfo info, byte pixels, int pixelCount, bool jfifHeader ) : ArraySegment

Compresses the specified image passed in the source pixel buffer.

Decompress ( byte source ) : byte[]

Decompresses the JPEG-LS encoded data passed in the source byte array.

Decompress ( byte source, int count ) : byte[]

Decompresses the JPEG-LS encoded data passed in the source byte array.

Decompress ( byte source, int count, byte pixels ) : void

Decompresses the JPEG-LS encoded data passed in the source byte array into the destination array.

GetMetadataInfo ( byte source ) : JpegLSMetadataInfo

Gets the metadata info as stored in a JPEG-LS compressed bit stream.

GetMetadataInfo ( byte source, int count ) : JpegLSMetadataInfo

Gets the metadata info as stored in a JPEG-LS compressed bit stream.

TryCompress ( JpegLSMetadataInfo info, byte pixels, int pixelCount, bool jfifHeader, byte destination, int destinationLength, int &compressedCount ) : bool

Tries the compress the array with pixels into the provided buffer.

Private Methods

Méthode Description
GetUncompressedSize ( JlsParameters &info ) : int
HandleResult ( JpegLSError result, StringBuilder errorMessage ) : void
JpegLsReadHeaderThrowWhenError ( byte source, int length, JlsParameters &info ) : void

Method Details

Compress() public static méthode

Compresses the specified image passed in the source pixel buffer.
info -or- pixels is null. info.Width -or- info.Height contains an invalid value. The compressed output doesn't fit into the maximum defined output buffer.
public static Compress ( JpegLSMetadataInfo info, byte pixels, bool jfifHeader = false ) : ArraySegment
info JpegLSMetadataInfo The meta info that describes the format and type of the pixels.
pixels byte An array of bytes that represents the content of a bitmap image.
jfifHeader bool if set to true a JFIF header will be added to the encoded byte stream.
Résultat ArraySegment

Compress() public static méthode

Compresses the specified image passed in the source pixel buffer.
info -or- pixels is null. info.Width -or- info.Height -or- pixelCount contains an invalid value. The compressed output doesn't fit into the maximum defined output buffer.
public static Compress ( JpegLSMetadataInfo info, byte pixels, int pixelCount, bool jfifHeader ) : ArraySegment
info JpegLSMetadataInfo The meta info that describes the format and type of the pixels.
pixels byte An array of bytes that represents the content of a bitmap image.
pixelCount int The number of pixel in the pixel array.
jfifHeader bool if set to true a JFIF header will be added to the encoded byte stream.
Résultat ArraySegment

Decompress() public static méthode

Decompresses the JPEG-LS encoded data passed in the source byte array.
source is null. Thrown when the source array contains invalid compressed data.
public static Decompress ( byte source ) : byte[]
source byte The byte array that contains the JPEG-LS encoded data to decompress.
Résultat byte[]

Decompress() public static méthode

Decompresses the JPEG-LS encoded data passed in the source byte array.
source is null. count contains an invalid value. Thrown when the source array contains invalid compressed data.
public static Decompress ( byte source, int count ) : byte[]
source byte The byte array that contains the JPEG-LS encoded data to decompress.
count int The number of bytes of the array to decompress.
Résultat byte[]

Decompress() public static méthode

Decompresses the JPEG-LS encoded data passed in the source byte array into the destination array.
source -or- pixels is null. count contains an invalid value. Thrown when the destination array is too small to hold the decompressed pixel data. Thrown when the source array contains an invalid encodeded JPEG-LS bit stream.
public static Decompress ( byte source, int count, byte pixels ) : void
source byte The byte array that contains the JPEG-LS encoded data to decompress.
count int The number of bytes of the array to decompress.
pixels byte The byte array that will hold the pixels when the function returns.
Résultat void

GetMetadataInfo() public static méthode

Gets the metadata info as stored in a JPEG-LS compressed bit stream.
source is null. Thrown when the source array contains invalid compressed data.
public static GetMetadataInfo ( byte source ) : JpegLSMetadataInfo
source byte The JPEG-LS compressed bit stream.
Résultat JpegLSMetadataInfo

GetMetadataInfo() public static méthode

Gets the metadata info as stored in a JPEG-LS compressed bit stream.
source is null. count contains an invalid value. Thrown when the source array contains invalid compressed data.
public static GetMetadataInfo ( byte source, int count ) : JpegLSMetadataInfo
source byte The JPEG-LS compressed bit stream.
count int The count of bytes that are valid in the array.
Résultat JpegLSMetadataInfo

TryCompress() public static méthode

Tries the compress the array with pixels into the provided buffer.
info -or- pixels is null. info.Width -or- info.Height -or- pixelCount -or- destinationLength contains an invalid value.
public static TryCompress ( JpegLSMetadataInfo info, byte pixels, int pixelCount, bool jfifHeader, byte destination, int destinationLength, int &compressedCount ) : bool
info JpegLSMetadataInfo The meta info that describes the format and type of the pixels.
pixels byte An array of bytes that represents the content of a bitmap image.
pixelCount int The number of pixel in the pixel array.
jfifHeader bool if set to true a JFIF header will be added to the encoded byte stream.
destination byte The destination buffer that will hold the JPEG-LS compressed (encoded) bit stream.
destinationLength int Length of the destination buffer that can be used (can be less then the length of the destination array).
compressedCount int The number of bytes that have been compressed (encoded) into the destination array.
Résultat bool