Skip to main content

Crate jxl_sys

Crate jxl_sys 

Source

Structs§

JxlAnimationHeader
The codestream animation header, optionally present in the beginning of the codestream, and if it is it applies to all animation frames, unlike @ref JxlFrameHeader which applies to an individual frame.
JxlBasicInfo
Basic image information. This information is available from the file signature and first part of the codestream header.
JxlBitDepth
Data type for describing the interpretation of the input and output buffers in terms of the range of allowed input and output pixel values.
JxlBlendInfo
The information about blending the color channels or a single extra channel. When decoding, if coalescing is enabled (default), this can be ignored and the blend mode is considered to be JXL_BLEND_REPLACE. When encoding, these settings apply to the pixel data given to the encoder.
JxlChunkedFrameInputSource
This struct provides callback functions to pass pixel data in a streaming manner instead of requiring the entire frame data in memory at once.
JxlCmsInterface
Interface for performing colorspace transforms. The @c init function can be called several times to instantiate several transforms, including before other transforms have been destroyed.
JxlColorEncoding
Color encoding of the image as structured information.
JxlColorProfile
Represents an input or output colorspace to a color transform, as a serialized ICC profile.
JxlColorProfile__bindgen_ty_1
The serialized ICC profile. This is guaranteed to be present and valid.
JxlDecoderStruct
JxlEncoderFrameSettingsStruct
JxlEncoderOutputProcessor
The @ref JxlEncoderOutputProcessor structure provides an interface for the encoder’s output processing. Users of the library, who want to do streaming encoding, should implement the required callbacks for buffering, writing, seeking (if supported), and setting a finalized position during the encoding process.
JxlEncoderStatsStruct
JxlEncoderStruct
JxlExtraChannelInfo
Information for a single extra channel.
JxlFrameHeader
The header of one displayed frame or non-coalesced layer.
JxlGainMapBundle
Gain map bundle
JxlHeaderExtensions
Extensions in the codestream header.
JxlLayerInfo
The information about layers. When decoding, if coalescing is enabled (default), this can be ignored. When encoding, these settings apply to the pixel data given to the encoder, the encoder could choose an internal representation that differs.
JxlMemoryManagerStruct
Memory Manager struct. These functions, when provided by the caller, will be used to handle memory allocations.
JxlPixelFormat
Data type for the sample values per channel per pixel for the output buffer for pixels. This is not necessarily the same as the data type encoded in the codestream. The channels are interleaved per pixel. The pixels are organized row by row, left to right, top to bottom. TODO(lode): support different channel orders if needed (RGB, BGR, …)
JxlPreviewHeader
The codestream preview header

Enums§

JxlBitDepthType
Settings for the interpretation of UINT input and output buffers. (buffers using a FLOAT data type are not affected by this)
JxlBlendMode
Frame blend modes. When decoding, if coalescing is enabled (default), this can be ignored.
JxlColorProfileTarget
Defines which color profile to get: the profile from the codestream metadata header, which represents the color profile of the original image, or the color profile from the pixel data produced by the decoder. Both are the same if the JxlBasicInfo has uses_original_profile set.
JxlColorSpace
Color space of the image data.
JxlDataType
Data type for the sample values per channel per pixel.
JxlDecoderStatus
Return value for @ref JxlDecoderProcessInput. The values from ::JXL_DEC_BASIC_INFO onwards are optional informative events that can be subscribed to, they are never returned if they have not been registered with @ref JxlDecoderSubscribeEvents.
JxlEncoderError
Error conditions: API usage errors have the 0x80 bit set to 1 Other errors have the 0x80 bit set to 0
JxlEncoderFrameSettingId
Id of encoder options for a frame. This includes options such as setting encoding effort/speed or overriding the use of certain coding tools, for this frame. This does not include non-frame related encoder options such as for boxes.
JxlEncoderStatsKey
Data type for querying @ref JxlEncoderStats object
JxlEncoderStatus
Return value for multiple encoder functions.
JxlEndianness
Ordering of multi-byte data.
JxlExtraChannelType
Given type of an extra channel.
JxlOrientation
Image orientation metadata. Values 1..8 match the EXIF definitions. The name indicates the operation to perform to transform from the encoded image to the display image.
JxlPrimaries
Built-in primaries for color encoding. When decoding, the primaries can be read from the @ref JxlColorEncoding primaries_red_xy, primaries_green_xy and primaries_blue_xy fields regardless of the enum value. When encoding, the enum values except ::JXL_PRIMARIES_CUSTOM override the numerical fields. Some enum values match a subset of CICP (Rec. ITU-T H.273 | ISO/IEC 23091-2:2019(E)), however the white point and RGB primaries are separate enums here.
JxlProgressiveDetail
Types of progressive detail. Setting a progressive detail with value N implies all progressive details with smaller or equal value. Currently only the following level of progressive detail is implemented:
JxlRenderingIntent
Rendering intent for color encoding, as specified in ISO 15076-1:2010
JxlSignature
The result of @ref JxlSignatureCheck.
JxlTransferFunction
Built-in transfer functions for color encoding. Enum values match a subset of CICP (Rec. ITU-T H.273 | ISO/IEC 23091-2:2019(E)) unless specified otherwise.
JxlWhitePoint
Built-in white points for color encoding. When decoding, the numerical xy white point value can be read from the @ref JxlColorEncoding white_point field regardless of the enum value. When encoding, enum values except ::JXL_WHITE_POINT_CUSTOM override the numerical fields. Some enum values match a subset of CICP (Rec. ITU-T H.273 | ISO/IEC 23091-2:2019(E)), however the white point and RGB primaries are separate enums here.

Functions§

JxlColorEncodingSetToLinearSRGB
Sets a color encoding to be linear sRGB.
JxlColorEncodingSetToSRGB
Sets a color encoding to be sRGB.
JxlDecoderCloseInput
Marks the input as finished, indicates that no more @ref JxlDecoderSetInput will be called. This function allows the decoder to determine correctly if it should return success, need more input or error in certain cases. For backwards compatibility with a previous version of the API, using this function is optional when not using the ::JXL_DEC_BOX event (the decoder is able to determine the end of the image frames without marking the end), but using this function is required when using ::JXL_DEC_BOX for getting metadata box contents. This function does not replace @ref JxlDecoderReleaseInput, that function should still be called if its return value is needed.
JxlDecoderCreate
Creates an instance of @ref JxlDecoder and initializes it.
JxlDecoderDestroy
Deinitializes and frees @ref JxlDecoder instance.
JxlDecoderExtraChannelBufferSize
Returns the minimum size in bytes of an extra channel pixel buffer for the given format. This is the buffer for @ref JxlDecoderSetExtraChannelBuffer. Requires the basic image information is available in the decoder.
JxlDecoderFlushImage
Outputs progressive step towards the decoded image so far when only partial input was received. If the flush was successful, the buffer set with @ref JxlDecoderSetImageOutBuffer will contain partial image data.
JxlDecoderGetBasicInfo
Outputs the basic image information, such as image dimensions, bit depth and all other JxlBasicInfo fields, if available.
JxlDecoderGetBoxSizeContents
Returns the size of the contents of a box, after the @ref JXL_DEC_BOX event. This does not include any of the headers of the box. For compressed “brob” boxes, this is the size of the compressed content. Even when @ref JxlDecoderSetDecompressBoxes is enabled, the return value of function does not change, and the decompressed size is not known before it has already been decompressed and output.
JxlDecoderGetBoxSizeRaw
Returns the size of a box as it appears in the container file, after the @ref JXL_DEC_BOX event. This includes all the box headers.
JxlDecoderGetBoxType
Outputs the type of the current box, after a ::JXL_DEC_BOX event occurred, as 4 characters without null termination character. In case of a compressed “brob” box, this will return “brob” if the decompressed argument is JXL_FALSE, or the underlying box type if the decompressed argument is JXL_TRUE.
JxlDecoderGetColorAsEncodedProfile
Outputs the color profile as JPEG XL encoded structured data, if available. This is an alternative to an ICC Profile, which can represent a more limited amount of color spaces, but represents them exactly through enum values.
JxlDecoderGetColorAsICCProfile
Outputs ICC profile if available. The profile is only available if @ref JxlDecoderGetICCProfileSize returns success. The output buffer must have at least as many bytes as given by @ref JxlDecoderGetICCProfileSize.
JxlDecoderGetExtraChannelBlendInfo
Outputs the blend information for the current frame for a specific extra channel. This function can be called once the ::JXL_DEC_FRAME event occurred for the current frame, even if the have_animation field in the @ref JxlBasicInfo is @ref JXL_FALSE. This information is only useful if coalescing is disabled; otherwise the decoder will have performed blending already.
JxlDecoderGetExtraChannelInfo
Outputs information for extra channel at the given index. The index must be smaller than num_extra_channels in the associated @ref JxlBasicInfo.
JxlDecoderGetExtraChannelName
Outputs name for extra channel at the given index in UTF-8. The index must be smaller than num_extra_channels in the associated @ref JxlBasicInfo. The buffer for name must have at least name_length + 1 bytes allocated, gotten from the associated @ref JxlExtraChannelInfo.
JxlDecoderGetFrameHeader
Outputs the information from the frame, such as duration when have_animation. This function can be called when ::JXL_DEC_FRAME occurred for the current frame, even when have_animation in the JxlBasicInfo is JXL_FALSE.
JxlDecoderGetFrameName
Outputs name for the current frame. The buffer for name must have at least name_length + 1 bytes allocated, gotten from the associated JxlFrameHeader.
JxlDecoderGetICCProfileSize
Outputs the size in bytes of the ICC profile returned by @ref JxlDecoderGetColorAsICCProfile, if available, or indicates there is none available. In most cases, the image will have an ICC profile available, but if it does not, @ref JxlDecoderGetColorAsEncodedProfile must be used instead.
JxlDecoderGetIntendedDownsamplingRatio
Returns the intended downsampling ratio for the progressive frame produced by @ref JxlDecoderFlushImage after the latest ::JXL_DEC_FRAME_PROGRESSION event.
JxlDecoderImageOutBufferSize
Returns the minimum size in bytes of the image output pixel buffer for the given format. This is the buffer for @ref JxlDecoderSetImageOutBuffer. Requires that the basic image information is available in the decoder in the case of coalescing enabled (default). In case coalescing is disabled, this can only be called after the ::JXL_DEC_FRAME event occurs. In that case, it will return the size required to store the possibly cropped frame (which can be larger or smaller than the image dimensions).
JxlDecoderPreviewOutBufferSize
Returns the minimum size in bytes of the preview image output pixel buffer for the given format. This is the buffer for @ref JxlDecoderSetPreviewOutBuffer. Requires the preview header information is available in the decoder.
JxlDecoderProcessInput
Decodes JPEG XL file using the available bytes. Requires input has been set with @ref JxlDecoderSetInput. After @ref JxlDecoderProcessInput, input can optionally be released with @ref JxlDecoderReleaseInput and then set again to next bytes in the stream. @ref JxlDecoderReleaseInput returns how many bytes are not yet processed, before a next call to @ref JxlDecoderProcessInput all unprocessed bytes must be provided again (the address need not match, but the contents must), and more bytes may be concatenated after the unprocessed bytes.
JxlDecoderReleaseBoxBuffer
Releases buffer which was provided with @ref JxlDecoderSetBoxBuffer.
JxlDecoderReleaseInput
Releases input which was provided with @ref JxlDecoderSetInput. Between @ref JxlDecoderProcessInput and @ref JxlDecoderReleaseInput, the user may not alter the data in the buffer. Calling @ref JxlDecoderReleaseInput is required whenever any input is already set and new input needs to be added with @ref JxlDecoderSetInput, but is not required before @ref JxlDecoderDestroy or @ref JxlDecoderReset. Calling @ref JxlDecoderReleaseInput when no input is set is not an error and returns 0.
JxlDecoderReleaseJPEGBuffer
Releases buffer which was provided with @ref JxlDecoderSetJPEGBuffer.
JxlDecoderReset
Re-initializes a @ref JxlDecoder instance, so it can be re-used for decoding another image. All state and settings are reset as if the object was newly created with @ref JxlDecoderCreate, but the memory manager is kept.
JxlDecoderRewind
Rewinds decoder to the beginning. The same input must be given again from the beginning of the file and the decoder will emit events from the beginning again. When rewinding (as opposed to @ref JxlDecoderReset), the decoder can keep state about the image, which it can use to skip to a requested frame more efficiently with @ref JxlDecoderSkipFrames. Settings such as parallel runner or subscribed events are kept. After rewind, @ref JxlDecoderSubscribeEvents can be used again, and it is feasible to leave out events that were already handled before, such as ::JXL_DEC_BASIC_INFO and ::JXL_DEC_COLOR_ENCODING, since they will provide the same information as before. The difference to @ref JxlDecoderReset is that some state is kept, namely settings set by a call to
JxlDecoderSetBoxBuffer
Sets output buffer for box output codestream.
JxlDecoderSetCms
Sets the color management system (CMS) that will be used for color conversion (if applicable) during decoding. May only be set before starting decoding and must not be called after @ref JxlDecoderSetOutputColorProfile.
JxlDecoderSetCoalescing
Enables or disables coalescing of zero-duration frames. By default, frames are returned with coalescing enabled, i.e. all frames have the image dimensions, and are blended if needed. When coalescing is disabled, frames can have arbitrary dimensions, a non-zero crop offset, and blending is not performed. For display, coalescing is recommended. For loading a multi-layer still image as separate layers (as opposed to the merged image), coalescing has to be disabled.
JxlDecoderSetDecompressBoxes
Configures whether to get boxes in raw mode or in decompressed mode. In raw mode, boxes are output as their bytes appear in the container file, which may be decompressed, or compressed if their type is “brob”. In decompressed mode, “brob” boxes are decompressed with Brotli before outputting them. The size of the decompressed stream is not known before the decompression has already finished.
JxlDecoderSetDesiredIntensityTarget
Requests that the decoder perform tone mapping to the peak display luminance passed as @c desired_intensity_target, if appropriate. @note This is provided for convenience and the exact tone mapping that is performed is not meant to be considered authoritative in any way. It may change from version to version. @param dec decoder object @param desired_intensity_target the intended target peak luminance @return ::JXL_DEC_SUCCESS if the preference was set successfully, @ref JXL_DEC_ERROR otherwise.
JxlDecoderSetExtraChannelBuffer
Sets the buffer to write an extra channel to. This can be set when the ::JXL_DEC_FRAME or ::JXL_DEC_NEED_IMAGE_OUT_BUFFER event occurs, and applies only for the current frame. The size of the buffer must be at least as large as given by @ref JxlDecoderExtraChannelBufferSize. The buffer follows the format described by @ref JxlPixelFormat, but where num_channels is 1. The buffer is owned by the caller. The amount of extra channels is given by the num_extra_channels field in the associated @ref JxlBasicInfo, and the information of individual extra channels can be queried with @ref JxlDecoderGetExtraChannelInfo. To get multiple extra channels, this function must be called multiple times, once for each wanted index. Not all images have extra channels. The alpha channel is an extra channel and can be gotten as part of the color channels when using an RGBA pixel buffer with @ref JxlDecoderSetImageOutBuffer, but additionally also can be gotten separately as extra channel. The color channels themselves cannot be gotten this way.
JxlDecoderSetImageOutBitDepth
Sets the bit depth of the output buffer or callback.
JxlDecoderSetImageOutBuffer
Sets the buffer to write the full resolution image to. This can be set when the ::JXL_DEC_FRAME event occurs, must be set when the @ref JXL_DEC_NEED_IMAGE_OUT_BUFFER event occurs, and applies only for the current frame. The size of the buffer must be at least as large as given by @ref JxlDecoderImageOutBufferSize. The buffer follows the format described by @ref JxlPixelFormat. The buffer is owned by the caller.
JxlDecoderSetImageOutCallback
Sets pixel output callback. This is an alternative to @ref JxlDecoderSetImageOutBuffer. This can be set when the ::JXL_DEC_FRAME event occurs, must be set when the ::JXL_DEC_NEED_IMAGE_OUT_BUFFER event occurs, and applies only for the current frame. Only one of @ref JxlDecoderSetImageOutBuffer or @ref JxlDecoderSetImageOutCallback may be used for the same frame, not both at the same time.
JxlDecoderSetInput
Sets input data for @ref JxlDecoderProcessInput. The data is owned by the caller and may be used by the decoder until @ref JxlDecoderReleaseInput is called or the decoder is destroyed or reset so must be kept alive until then. Cannot be called if @ref JxlDecoderSetInput was already called and @ref JxlDecoderReleaseInput was not yet called, and cannot be called after @ref JxlDecoderCloseInput indicating the end of input was called.
JxlDecoderSetJPEGBuffer
Sets output buffer for reconstructed JPEG codestream.
JxlDecoderSetKeepOrientation
Enables or disables preserving of as-in-bitstream pixeldata orientation. Some images are encoded with an Orientation tag indicating that the decoder must perform a rotation and/or mirroring to the encoded image data.
JxlDecoderSetMultithreadedImageOutCallback
Similar to @ref JxlDecoderSetImageOutCallback except that the callback is allowed an initialization phase during which it is informed of how many threads will call it concurrently, and those calls are further informed of which thread they are occurring in.
JxlDecoderSetOutputColorProfile
Sets the desired output color profile of the decoded image either from a color encoding or an ICC profile. Valid calls of this function have either @c color_encoding or @c icc_data set to NULL and @c icc_size must be 0 if and only if @c icc_data is NULL.
JxlDecoderSetParallelRunner
Set the parallel runner for multithreading. May only be set before starting decoding.
JxlDecoderSetPreferredColorProfile
Sets the desired output color profile of the decoded image by calling @ref JxlDecoderSetOutputColorProfile, passing on @c color_encoding and setting @c icc_data to NULL. See @ref JxlDecoderSetOutputColorProfile for details.
JxlDecoderSetPreviewOutBuffer
Sets the buffer to write the low-resolution preview image to. The size of the buffer must be at least as large as given by @ref JxlDecoderPreviewOutBufferSize. The buffer follows the format described by @ref JxlPixelFormat. The preview image dimensions are given by the @ref JxlPreviewHeader. The buffer is owned by the caller.
JxlDecoderSetProgressiveDetail
Configures at which progressive steps in frame decoding these @ref JXL_DEC_FRAME_PROGRESSION event occurs. The default value for the level of detail if this function is never called is kDC.
JxlDecoderSetRenderSpotcolors
Enables or disables rendering spot colors. By default, spot colors are rendered, which is OK for viewing the decoded image. If render_spotcolors is ::JXL_FALSE, then spot colors are not rendered, and have to be retrieved separately using @ref JxlDecoderSetExtraChannelBuffer. This is useful for e.g. printing applications.
JxlDecoderSetUnpremultiplyAlpha
Enables or disables preserving of associated alpha channels. If unpremul_alpha is set to ::JXL_FALSE then for associated alpha channel, the pixel data is returned with premultiplied colors. If it is set to @ref JXL_TRUE, The colors will be unpremultiplied based on the alpha channel. This function has no effect if the image does not have an associated alpha channel.
JxlDecoderSizeHintBasicInfo
Returns a hint indicating how many more bytes the decoder is expected to need to make @ref JxlDecoderGetBasicInfo available after the next @ref JxlDecoderProcessInput call. This is a suggested large enough value for the amount of bytes to provide in the next @ref JxlDecoderSetInput call, but it is not guaranteed to be an upper bound nor a lower bound. This number does not include bytes that have already been released from the input. Can be used before the first @ref JxlDecoderProcessInput call, and is correct the first time in most cases. If not, @ref JxlDecoderSizeHintBasicInfo can be called again to get an updated hint.
JxlDecoderSkipCurrentFrame
Skips processing the current frame. Can be called after frame processing already started, signaled by a ::JXL_DEC_NEED_IMAGE_OUT_BUFFER event, but before the corresponding ::JXL_DEC_FULL_IMAGE event. The next signaled event will be another ::JXL_DEC_FRAME, or ::JXL_DEC_SUCCESS if there are no more frames. If pixel data is required from the already processed part of the frame, @ref JxlDecoderFlushImage must be called before this.
JxlDecoderSkipFrames
Makes the decoder skip the next amount frames. It still needs to process the input, but will not output the frame events. It can be more efficient when skipping frames, and even more so when using this after @ref JxlDecoderRewind. If the decoder is already processing a frame (could have emitted ::JXL_DEC_FRAME but not yet ::JXL_DEC_FULL_IMAGE), it starts skipping from the next frame. If the amount is larger than the amount of frames remaining in the image, all remaining frames are skipped. Calling this function multiple times adds the amount to skip to the already existing amount.
JxlDecoderSubscribeEvents
Select for which informative events, i.e. ::JXL_DEC_BASIC_INFO, etc., the decoder should return with a status. It is not required to subscribe to any events, data can still be requested from the decoder as soon as it available. By default, the decoder is subscribed to no events (events_wanted == 0), and the decoder will then only return when it cannot continue because it needs more input data or more output buffer. This function may only be be called before using @ref JxlDecoderProcessInput.
JxlDecoderVersion
Decoder library version.
JxlEncoderAddBox
Adds a metadata box to the file format. @ref JxlEncoderProcessOutput must be used to effectively write the box to the output. @ref JxlEncoderUseBoxes must be enabled before using this function.
JxlEncoderAddChunkedFrame
@brief Adds a frame to the encoder using a chunked input source.
JxlEncoderAddImageFrame
Sets the buffer to read pixels from for the next image to encode. Must call @ref JxlEncoderSetBasicInfo before @ref JxlEncoderAddImageFrame.
JxlEncoderAddJPEGFrame
Sets the buffer to read JPEG encoded bytes from for the next frame to encode.
JxlEncoderAllowExpertOptions
Enables usage of expert options.
JxlEncoderCloseBoxes
Declares that no further boxes will be added with @ref JxlEncoderAddBox. This function must be called after the last box is added so the encoder knows the stream will be finished. It is not necessary to use this function if @ref JxlEncoderUseBoxes is not used. Further frames may still be added.
JxlEncoderCloseFrames
Declares that no frames will be added and @ref JxlEncoderAddImageFrame and @ref JxlEncoderAddJPEGFrame won’t be called anymore. Further metadata boxes may still be added. This function or @ref JxlEncoderCloseInput must be called after adding the last frame and the next call to @ref JxlEncoderProcessOutput, or the frame won’t be properly marked as last.
JxlEncoderCloseInput
Closes any input to the encoder, equivalent to calling @ref JxlEncoderCloseFrames as well as calling @ref JxlEncoderCloseBoxes if needed. No further input of any kind may be given to the encoder, but further @ref JxlEncoderProcessOutput calls should be done to create the final output.
JxlEncoderCollectStats
Sets the given stats object for gathering various statistics during encoding.
JxlEncoderCreate
Creates an instance of @ref JxlEncoder and initializes it.
JxlEncoderDestroy
Deinitializes and frees a @ref JxlEncoder instance.
JxlEncoderDistanceFromQuality
Maps JPEG-style quality factor to distance.
JxlEncoderFlushInput
Flushes any buffered input in the encoder, ensuring that all available input data has been processed and written to the output.
JxlEncoderFrameSettingsCreate
Create a new set of encoder options, with all values initially copied from the @p source options, or set to default if @p source is NULL.
JxlEncoderFrameSettingsSetFloatOption
Sets a frame-specific option of float type to the encoder options. The @ref JxlEncoderFrameSettingId argument determines which option is set.
JxlEncoderFrameSettingsSetOption
Sets a frame-specific option of integer type to the encoder options. The @ref JxlEncoderFrameSettingId argument determines which option is set.
JxlEncoderGetError
Get the (last) error code in case ::JXL_ENC_ERROR was returned.
JxlEncoderGetRequiredCodestreamLevel
Returns the codestream level required to support the currently configured settings and basic info. This function can only be used at the beginning, before encoding starts, but after setting basic info.
JxlEncoderInitBasicInfo
Initializes a @ref JxlBasicInfo struct to default values. For forwards-compatibility, this function has to be called before values are assigned to the struct fields. The default values correspond to an 8-bit RGB image, no alpha or any other extra channels.
JxlEncoderInitBlendInfo
Initializes a @ref JxlBlendInfo struct to default values. For forwards-compatibility, this function has to be called before values are assigned to the struct fields.
JxlEncoderInitExtraChannelInfo
Initializes a @ref JxlExtraChannelInfo struct to default values. For forwards-compatibility, this function has to be called before values are assigned to the struct fields. The default values correspond to an 8-bit channel of the provided type.
JxlEncoderInitFrameHeader
Initializes a @ref JxlFrameHeader struct to default values. For forwards-compatibility, this function has to be called before values are assigned to the struct fields. The default values correspond to a frame with no animation duration and the ‘replace’ blend mode. After using this function, For animation duration must be set, for composite still blend settings must be set.
JxlEncoderProcessOutput
Encodes a JPEG XL file using the available bytes. @p *avail_out indicates how many output bytes are available, and @p *next_out points to the input bytes. *avail_out will be decremented by the amount of bytes that have been processed by the encoder and *next_out will be incremented by the same amount, so *next_out will now point at the amount of *avail_out unprocessed bytes.
JxlEncoderReset
Re-initializes a @ref JxlEncoder instance, so it can be re-used for encoding another image. All state and settings are reset as if the object was newly created with @ref JxlEncoderCreate, but the memory manager is kept.
JxlEncoderSetBasicInfo
Sets the global metadata of the image encoded by this encoder.
JxlEncoderSetCms
Sets the color management system (CMS) that will be used for color conversion (if applicable) during encoding. May only be set before starting encoding. If left unset, the default CMS implementation will be used.
JxlEncoderSetCodestreamLevel
Sets the feature level of the JPEG XL codestream. Valid values are 5 and 10, or -1 (to choose automatically). Using the minimum required level, or level 5 in most cases, is recommended for compatibility with all decoders.
JxlEncoderSetColorEncoding
Sets the original color encoding of the image encoded by this encoder. This is an alternative to @ref JxlEncoderSetICCProfile and only one of these two must be used. This one sets the color encoding as a @ref JxlColorEncoding, while the other sets it as ICC binary data. Must be called after @ref JxlEncoderSetBasicInfo.
JxlEncoderSetDebugImageCallback
Sets the given debug image callback that will be used by the encoder to output various debug images during encoding.
JxlEncoderSetExtraChannelBlendInfo
Sets blend info of an extra channel. The blend info of extra channels is set separately from that of the color channels, the color channels are set with @ref JxlEncoderSetFrameHeader.
JxlEncoderSetExtraChannelBuffer
Sets the buffer to read pixels from for an extra channel at a given index. The index must be smaller than the num_extra_channels in the associated @ref JxlBasicInfo. Must call @ref JxlEncoderSetExtraChannelInfo before @ref JxlEncoderSetExtraChannelBuffer.
JxlEncoderSetExtraChannelDistance
Sets the distance level for lossy compression of extra channels. The distance is as in @ref JxlEncoderSetFrameDistance (lower = higher quality). If not set, or if set to the special value -1, the distance that was set with @ref JxlEncoderSetFrameDistance will be used.
JxlEncoderSetExtraChannelInfo
Sets information for the extra channel at the given index. The index must be smaller than num_extra_channels in the associated @ref JxlBasicInfo.
JxlEncoderSetExtraChannelName
Sets the name for the extra channel at the given index in UTF-8. The index must be smaller than the num_extra_channels in the associated @ref JxlBasicInfo.
JxlEncoderSetFrameBitDepth
Sets the bit depth of the input buffer.
JxlEncoderSetFrameDistance
Sets the distance level for lossy compression: target max butteraugli distance, lower = higher quality. Range: 0 .. 25. 0.0 = mathematically lossless (however, use @ref JxlEncoderSetFrameLossless instead to use true lossless, as setting distance to 0 alone is not the only requirement). 1.0 = visually lossless. Recommended range: 0.5 .. 3.0. Default value: 1.0.
JxlEncoderSetFrameHeader
Sets the frame information for this frame to the encoder. This includes animation information such as frame duration to store in the frame header. The frame header fields represent the frame as passed to the encoder, but not necessarily the exact values as they will be encoded file format: the encoder could change crop and blending options of a frame for more efficient encoding or introduce additional internal frames. Animation duration and time code information is not altered since those are immutable metadata of the frame.
JxlEncoderSetFrameLossless
Enables lossless encoding.
JxlEncoderSetFrameName
Sets the name of the animation frame. This function is optional, frames are not required to have a name. This setting is a part of the frame header, and the same principles as for @ref JxlEncoderSetFrameHeader apply. The name_length field of @ref JxlFrameHeader is ignored by the encoder, this function determines the name length instead as the length in bytes of the C string.
JxlEncoderSetICCProfile
Sets the original color encoding of the image encoded by this encoder as an ICC color profile. This is an alternative to @ref JxlEncoderSetColorEncoding and only one of these two must be used. This one sets the color encoding as ICC binary data, while the other defines it as a @ref JxlColorEncoding. Must be called after @ref JxlEncoderSetBasicInfo.
JxlEncoderSetOutputProcessor
Sets the output processor for the encoder. This processor determines how the encoder will handle buffering, writing, seeking (if supported), and setting a finalized position during the encoding process.
JxlEncoderSetParallelRunner
Set the parallel runner for multithreading. May only be set before starting encoding.
JxlEncoderSetUpsamplingMode
Sets the upsampling method the decoder will use in case there are frames with ::JXL_ENC_FRAME_SETTING_RESAMPLING set. This is useful in combination with the ::JXL_ENC_FRAME_SETTING_ALREADY_DOWNSAMPLED option, to control the type of upsampling that will be used.
JxlEncoderStatsCreate
Creates an instance of JxlEncoderStats and initializes it.
JxlEncoderStatsDestroy
Deinitializes and frees JxlEncoderStats instance.
JxlEncoderStatsGet
Returns the value of the statistics corresponding the given key.
JxlEncoderStatsMerge
Updates the values of the given stats object with that of an other.
JxlEncoderStoreJPEGMetadata
Configure the encoder to store JPEG reconstruction metadata in the JPEG XL container.
JxlEncoderUseBoxes
Indicates the intention to add metadata boxes. This allows @ref JxlEncoderAddBox to be used. When using this function, then it is required to use @ref JxlEncoderCloseBoxes at the end.
JxlEncoderUseContainer
Forces the encoder to use the box-based container format (BMFF) even when not necessary.
JxlEncoderVersion
Encoder library version.
JxlGainMapGetBundleSize
Calculates the total size required to serialize the gain map bundle into a binary buffer. This function accounts for all the necessary space to serialize fields such as gain map metadata, color encoding, compressed ICC profile data, and the gain map itself.
JxlGainMapReadBundle
Deserializes a gain map bundle from a provided buffer and populates a JxlGainMapBundle structure with the data extracted. This function assumes the buffer contains a valid serialized gain map bundle. After successful execution, the JxlGainMapBundle structure will reference three different sections within the buffer:
JxlGainMapWriteBundle
Serializes the gain map bundle into a preallocated buffer. The function ensures that all parts of the bundle such as metadata, color encoding, compressed ICC profile, and the gain map are correctly encoded into the buffer. First call JxlGainMapGetBundleSize to get the size needed for the buffer.
JxlGetDefaultCms
JxlICCProfileDecode
Allocates a buffer using the memory manager, fills it with the decompressed version of the ICC profile in @c compressed_icc, returns the result through @c output_buffer and indicates its size through @c output_size.
JxlICCProfileEncode
Allocates a buffer using the memory manager, fills it with a compressed representation of an ICC profile, returns the result through @c output_buffer and indicates its size through @c output_size.
JxlResizableParallelRunner
Parallel runner internally using std::thread. Use as @ref JxlParallelRunner.
JxlResizableParallelRunnerCreate
Creates the runner for @ref JxlResizableParallelRunner. Use as the opaque runner. The runner will execute tasks on the calling thread until @ref JxlResizableParallelRunnerSetThreads is called.
JxlResizableParallelRunnerDestroy
Destroys the runner created by @ref JxlResizableParallelRunnerCreate.
JxlResizableParallelRunnerSetThreads
Changes the number of threads for @ref JxlResizableParallelRunner.
JxlResizableParallelRunnerSuggestThreads
Suggests a number of threads to use for an image of given size.
JxlSignatureCheck
JPEG XL signature identification.
JxlThreadParallelRunner
Parallel runner internally using std::thread. Use as @ref JxlParallelRunner.
JxlThreadParallelRunnerCreate
Creates the runner for @ref JxlThreadParallelRunner. Use as the opaque runner.
JxlThreadParallelRunnerDefaultNumWorkerThreads
Returns a default num_worker_threads value for @ref JxlThreadParallelRunnerCreate.
JxlThreadParallelRunnerDestroy
Destroys the runner created by @ref JxlThreadParallelRunnerCreate.

Type Aliases§

JxlBoxType
Data type holding the 4-character type name of an ISOBMFF box.
JxlDebugImageCallback
Function type for @ref JxlEncoderSetDebugImageCallback.
JxlDecoder
Opaque structure that holds the JPEG XL decoder.
JxlEncoder
Opaque structure that holds the JPEG XL encoder.
JxlEncoderFrameSettings
Settings and metadata for a single image frame. This includes encoder options for a frame such as compression quality and speed.
JxlEncoderStats
Opaque structure that holds the encoder statistics.
JxlImageOutCallback
Function type for @ref JxlDecoderSetImageOutCallback.
JxlImageOutDestroyCallback
Destruction callback for @ref JxlDecoderSetMultithreadedImageOutCallback, called after all invocations of the @c run callback to perform any appropriate clean-up of the @c run_opaque data returned by @c init.
JxlImageOutInitCallback
Initialization callback for @ref JxlDecoderSetMultithreadedImageOutCallback.
JxlImageOutRunCallback
Worker callback for @ref JxlDecoderSetMultithreadedImageOutCallback.
JxlMemoryManager
Memory Manager struct. These functions, when provided by the caller, will be used to handle memory allocations.
JxlParallelRetCode
Return code used in the JxlParallel* functions as return value. A value of ::JXL_PARALLEL_RET_SUCCESS means success and any other value means error. The special value ::JXL_PARALLEL_RET_RUNNER_ERROR can be used by the runner to indicate any other error.
JxlParallelRunFunction
Parallel run data processing callback. See @ref JxlParallelRunner for details.
JxlParallelRunInit
Parallel run initialization callback. See @ref JxlParallelRunner for details.
JxlParallelRunner
JxlParallelRunner function type. A parallel runner implementation can be provided by a JPEG XL caller to allow running computations in multiple threads. This function must call the initialization function @p init in the same thread that called it and then call the passed @p func once for every number in the range [start_range, end_range) (including start_range but not including end_range) possibly from different multiple threads in parallel.
jpegxl_alloc_func
Allocating function for a memory region of a given size.
jpegxl_cms_destroy_func
Performs the necessary clean-up and frees the memory allocated for user data.
jpegxl_cms_get_buffer_func
Returns a buffer that can be used by callers of the interface to store the input of the conversion or read its result, if they pass it as the input or output of the @c run function. @param user_data the data returned by @c init. @param thread the index of the thread for which to return a buffer. @return A buffer that can be used by the caller for passing to @c run.
jpegxl_cms_init_func
Allocates and returns the data needed for @p num_threads parallel transforms from the @p input colorspace to @p output, with up to @p pixels_per_thread pixels to transform per call to @ref JxlCmsInterface::run. @p init_data comes directly from the @ref JxlCmsInterface instance. Since @c run only receives the data returned by @c init, a reference to @p init_data should be kept there if access to it is desired in @c run. Likewise for @ref JxlCmsInterface::destroy.
jpegxl_cms_run_func
Executes one transform and returns true on success or false on error. It must be possible to call this from different threads with different values for @p thread, all between 0 (inclusive) and the value of @p num_threads passed to @c init (exclusive). It is allowed to implement this by locking such that the transforms are essentially performed sequentially, if such a performance profile is acceptable. @p user_data is the data returned by @c init. The buffers each contain @p num_pixels × @c num_channels interleaved floating point (0..1) samples where @c num_channels is the number of color channels of their respective color profiles. It is guaranteed that the only case in which they might overlap is if the output has fewer channels than the input, in which case the pointers may be identical. For CMYK data, 0 represents the maximum amount of ink while 1 represents no ink. @param user_data the data returned by @c init. @param thread the index of the thread from which the function is being called. @param input_buffer the buffer containing the pixel data to be transformed. @param output_buffer the buffer receiving the transformed pixel data. @param num_pixels the number of pixels to transform from @p input to @p output. @return ::JXL_TRUE on success, ::JXL_FALSE on failure.
jpegxl_cms_set_fields_from_icc_func
Parses an ICC profile and populates @p c and @p cmyk with the data.
jpegxl_free_func
Deallocating function pointer type.