JxlDecoderStatus

Enum JxlDecoderStatus 

Source
#[repr(C)]
pub enum JxlDecoderStatus {
Show 16 variants Success = 0, Error = 1, NeedMoreInput = 2, NeedPreviewOutBuffer = 3, NeedImageOutBuffer = 5, JPEGNeedMoreOutput = 6, BoxNeedMoreOutput = 7, BasicInfo = 64, ColorEncoding = 256, PreviewImage = 512, Frame = 1_024, FullImage = 4_096, JPEGReconstruction = 8_192, Box = 16_384, FrameProgression = 32_768, BoxComplete = 65_536,
}
Expand description

Return value for JxlDecoderProcessInput. The values from JxlDecoderStatus::BasicInfo onwards are optional informative events that can be subscribed to, they are never returned if they have not been registered with JxlDecoderSubscribeEvents.

Variants§

§

Success = 0

Function call finished successfully, or decoding is finished and there is nothing more to be done.

Note that JxlDecoderProcessInput will return JxlDecoderStatus::Success if all events that were registered with JxlDecoderSubscribeEvents were processed, even before the end of the JPEG XL codestream.

In this case, the return value JxlDecoderReleaseInput will be the same as it was at the last signaled event. E.g. if JxlDecoderStatus::FullImage was subscribed to, then all bytes from the end of the JPEG XL codestream (including possible boxes needed for jpeg reconstruction) will be returned as unprocessed.

§

Error = 1

An error occurred, for example invalid input file or out of memory. TODO: add function to get error information from decoder.

§

NeedMoreInput = 2

The decoder needs more input bytes to continue. Before the next JxlDecoderProcessInput call, more input data must be set, by calling JxlDecoderReleaseInput (if input was set previously) and then calling JxlDecoderSetInput. JxlDecoderReleaseInput returns how many bytes are not yet processed, before a next call to JxlDecoderProcessInput all unprocessed bytes must be provided again (the address need not match, but the contents must), and more bytes must be concatenated after the unprocessed bytes. In most cases, JxlDecoderReleaseInput will return no unprocessed bytes at this event, the only exceptions are if the previously set input ended within (a) the raw codestream signature, (b) the signature box, (c) a box header, or (d) the first 4 bytes of a brob, ftyp, or jxlp box. In any of these cases the number of unprocessed bytes is less than 20.

§

NeedPreviewOutBuffer = 3

The decoder is able to decode a preview image and requests setting a preview output buffer using JxlDecoderSetPreviewOutBuffer. This occurs if JxlDecoderStatus::PreviewImage is requested and it is possible to decode a preview image from the codestream and the preview out buffer was not yet set. There is maximum one preview image in a codestream. In this case, JxlDecoderReleaseInput will return all bytes from the end of the frame header (including ToC) of the preview frame as unprocessed.

§

NeedImageOutBuffer = 5

The decoder requests an output buffer to store the full resolution image, which can be set with JxlDecoderSetImageOutBuffer or with JxlDecoderSetImageOutCallback. This event re-occurs for new frames if there are multiple animation frames and requires setting an output again. In this case, JxlDecoderReleaseInput will return all bytes from the end of the frame header (including ToC) as unprocessed.

§

JPEGNeedMoreOutput = 6

The JPEG reconstruction buffer is too small for reconstructed JPEG codestream to fit. JxlDecoderSetJPEGBuffer must be called again to make room for remaining bytes. This event may occur multiple times after JxlDecoderStatus::JPEGReconstruction.

§

BoxNeedMoreOutput = 7

The box contents output buffer is too small. JxlDecoderSetBoxBuffer must be called again to make room for remaining bytes. This event may occur multiple times after JxlDecoderStatus::Box.

§

BasicInfo = 64

Informative event by JxlDecoderProcessInput: Basic information such as image dimensions and extra channels. This event occurs max once per image. In this case, JxlDecoderReleaseInput will return all bytes from the end of the basic info as unprocessed (including the last byte of basic info if it did not end on a byte boundary).

§

ColorEncoding = 256

Informative event by JxlDecoderProcessInput: Color encoding or ICC profile from the codestream header. This event occurs max once per image and always later than JxlDecoderStatus::BasicInfo and earlier than any pixel data. In this case, JxlDecoderReleaseInput will return all bytes from the end of the image header (which is the start of the first frame) as unprocessed.

§

PreviewImage = 512

Informative event by JxlDecoderProcessInput: Preview image, a small frame, decoded. This event can only happen if the image has a preview frame encoded. This event occurs max once for the codestream and always later than JxlDecoderStatus::ColorEncoding and before JxlDecoderStatus::Frame. In this case, JxlDecoderReleaseInput will return all bytes from the end of the preview frame as unprocessed.

§

Frame = 1_024

Informative event by JxlDecoderProcessInput: Beginning of a frame. JxlDecoderGetFrameHeader can be used at this point.

§Note:

a JPEG XL image can have internal frames that are not intended to be displayed (e.g. used for compositing a final frame), but this only returns displayed frames, unless JxlDecoderSetCoalescing was set to JxlBool::False: in that case, the individual layers are returned, without blending. Note that even when coalescing is disabled, only frames of type kRegularFrame are returned; frames of type kReferenceOnly and kLfFrame are always for internal purposes only and cannot be accessed. A displayed frame either has an animation duration or is the only or last frame in the image. This event occurs max once per displayed frame, always later than JxlDecoderStatus::ColorEncoding, and always earlier than any pixel data. While JPEG XL supports encoding a single frame as the composition of multiple internal sub-frames also called frames, this event is not indicated for the internal frames. In this case, JxlDecoderReleaseInput will return all bytes from the end of the frame header (including ToC) as unprocessed.

§

FullImage = 4_096

Informative event by JxlDecoderProcessInput: full frame (or layer, in case coalescing is disabled) is decoded. JxlDecoderSetImageOutBuffer must be used after getting the basic image information to be able to get the image pixels, if not this return status only indicates we’re past this point in the codestream. This event occurs max once per frame. In this case, JxlDecoderReleaseInput will return all bytes from the end of the frame (or if JxlDecoderStatus::JPEGReconstruction is subscribed to, from the end of the last box that is needed for jpeg reconstruction) as unprocessed.

§

JPEGReconstruction = 8_192

Informative event by JxlDecoderProcessInput: JPEG reconstruction data decoded. JxlDecoderSetJPEGBuffer may be used to set a JPEG reconstruction buffer after getting the JPEG reconstruction data. If a JPEG reconstruction buffer is set a byte stream identical to the JPEG codestream used to encode the image will be written to the JPEG reconstruction buffer instead of pixels to the image out buffer. This event occurs max once per image and always before JxlDecoderStatus::FullImage. In this case, JxlDecoderReleaseInput will return all bytes from the end of the jbrd box as unprocessed.

§

Box = 16_384

Informative event by JxlDecoderProcessInput: The header of a box of the container format (BMFF) is decoded. The following API functions related to boxes can be used after this event:

Boxes can be compressed. This is so when their box type is “brob”. In that case, they have an underlying decompressed box type and decompressed data. JxlDecoderSetDecompressBoxes allows configuring which data to get. Decompressing requires Brotli. JxlDecoderGetBoxType has a flag to get the compressed box type, which can be “brob”, or the decompressed box type. If a box is not compressed (its compressed type is not “brob”), then the output decompressed box type and data is independent of what setting is configured.

The buffer set with JxlDecoderSetBoxBuffer must be set again for each next box to be obtained, or can be left unset to skip outputting this box. The output buffer contains the full box data when the JxlDecoderStatus::BoxComplete (if subscribed to) or subsequent JxlDecoderStatus::Success or subsequent JxlDecoderStatus::Box event occurs. JxlDecoderStatus::Box occurs for all boxes, including non-metadata boxes such as the signature box or codestream boxes. To check whether the box is a metadata type for respectively EXIF, XMP or JUMBF, use JxlDecoderGetBoxType and check for types “Exif”, “xml “ and “jumb” respectively.

In this case, JxlDecoderReleaseInput will return all bytes from the start of the box header as unprocessed.

§

FrameProgression = 32_768

Informative event by JxlDecoderProcessInput: a progressive step in decoding the frame is reached. When calling JxlDecoderFlushImage at this point, the flushed image will correspond exactly to this point in decoding, and not yet contain partial results (such as partially more fine detail) of a next step. By default, this event will trigger maximum once per frame, when a 8x8th resolution (DC) image is ready (the image data is still returned at full resolution, giving upscaled DC). Use JxlDecoderSetProgressiveDetail to configure more fine-grainedness. The event is not guaranteed to trigger, not all images have progressive steps or DC encoded. In this case, JxlDecoderReleaseInput will return all bytes from the end of the section that was needed to produce this progressive event as unprocessed.

§

BoxComplete = 65_536

The box being decoded is now complete. This is only emitted if a buffer was set for the box.

Trait Implementations§

Source§

impl Clone for JxlDecoderStatus

Source§

fn clone(&self) -> JxlDecoderStatus

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for JxlDecoderStatus

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for JxlDecoderStatus

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for JxlDecoderStatus

Source§

fn eq(&self, other: &JxlDecoderStatus) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for JxlDecoderStatus

Source§

impl Eq for JxlDecoderStatus

Source§

impl StructuralPartialEq for JxlDecoderStatus

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.