Run script/sync.sh: 0.4.0-alpha.7+3793.20240811
diff --git a/release/c/wuffs-v0.4.c b/release/c/wuffs-v0.4.c
index 7aba0bc..c922aa2 100644
--- a/release/c/wuffs-v0.4.c
+++ b/release/c/wuffs-v0.4.c
@@ -81,15 +81,15 @@
// each major.minor branch, the commit count should increase monotonically.
//
// WUFFS_VERSION was overridden by "wuffs gen -version" based on revision
-// ffb64df0a0b127e20d5eb0e1aab40c29409c0c3e committed on 2024-08-04.
+// a07eb7704bdb65ea131495c866a4ef3d2c4e7b22 committed on 2024-08-11.
#define WUFFS_VERSION 0x000040000
#define WUFFS_VERSION_MAJOR 0
#define WUFFS_VERSION_MINOR 4
#define WUFFS_VERSION_PATCH 0
-#define WUFFS_VERSION_PRE_RELEASE_LABEL "alpha.6"
-#define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 3789
-#define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 20240804
-#define WUFFS_VERSION_STRING "0.4.0-alpha.6+3789.20240804"
+#define WUFFS_VERSION_PRE_RELEASE_LABEL "alpha.7"
+#define WUFFS_VERSION_BUILD_METADATA_COMMIT_COUNT 3793
+#define WUFFS_VERSION_BUILD_METADATA_COMMIT_DATE 20240811
+#define WUFFS_VERSION_STRING "0.4.0-alpha.7+3793.20240811"
// ---------------- Private Implementation Macros Re-definition Check
@@ -9665,6 +9665,7 @@
extern const char wuffs_jpeg__error__bad_scan_count[];
extern const char wuffs_jpeg__error__missing_huffman_table[];
extern const char wuffs_jpeg__error__missing_quantization_table[];
+extern const char wuffs_jpeg__error__rejected_progressive_jpeg[];
extern const char wuffs_jpeg__error__truncated_input[];
extern const char wuffs_jpeg__error__unsupported_arithmetic_coding[];
extern const char wuffs_jpeg__error__unsupported_color_model[];
@@ -9682,6 +9683,8 @@
#define WUFFS_JPEG__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 51552191232u
+#define WUFFS_JPEG__QUIRK_REJECT_PROGRESSIVE_JPEGS 1220532224u
+
// ---------------- Struct Declarations
typedef struct wuffs_jpeg__decoder__struct wuffs_jpeg__decoder;
@@ -9909,6 +9912,7 @@
bool f_bitstream_is_closed;
bool f_expect_multiple_scans;
bool f_use_lower_quality;
+ bool f_reject_progressive_jpegs;
bool f_swizzle_immediately;
wuffs_base__status f_swizzle_immediately_status;
uint32_t f_swizzle_immediately_b_offsets[10];
@@ -12743,6 +12747,371 @@
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__PNG) || defined(WUFFS_NONMONOLITHIC)
+#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__QOI) || defined(WUFFS_NONMONOLITHIC)
+
+// ---------------- Status Codes
+
+extern const char wuffs_qoi__error__bad_footer[];
+extern const char wuffs_qoi__error__bad_header[];
+extern const char wuffs_qoi__error__truncated_input[];
+
+// ---------------- Public Consts
+
+#define WUFFS_QOI__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0u
+
+// ---------------- Struct Declarations
+
+typedef struct wuffs_qoi__decoder__struct wuffs_qoi__decoder;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// ---------------- Public Initializer Prototypes
+
+// For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
+// etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
+//
+// Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
+// Pass 0 (or some combination of WUFFS_INITIALIZE__XXX) for options.
+
+wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT
+wuffs_qoi__decoder__initialize(
+ wuffs_qoi__decoder* self,
+ size_t sizeof_star_self,
+ uint64_t wuffs_version,
+ uint32_t options);
+
+size_t
+sizeof__wuffs_qoi__decoder(void);
+
+// ---------------- Allocs
+
+// These functions allocate and initialize Wuffs structs. They return NULL if
+// memory allocation fails. If they return non-NULL, there is no need to call
+// wuffs_foo__bar__initialize, but the caller is responsible for eventually
+// calling free on the returned pointer. That pointer is effectively a C++
+// std::unique_ptr<T, wuffs_unique_ptr_deleter>.
+
+wuffs_qoi__decoder*
+wuffs_qoi__decoder__alloc(void);
+
+static inline wuffs_base__image_decoder*
+wuffs_qoi__decoder__alloc_as__wuffs_base__image_decoder(void) {
+ return (wuffs_base__image_decoder*)(wuffs_qoi__decoder__alloc());
+}
+
+// ---------------- Upcasts
+
+static inline wuffs_base__image_decoder*
+wuffs_qoi__decoder__upcast_as__wuffs_base__image_decoder(
+ wuffs_qoi__decoder* p) {
+ return (wuffs_base__image_decoder*)p;
+}
+
+// ---------------- Public Function Prototypes
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC uint64_t
+wuffs_qoi__decoder__get_quirk(
+ const wuffs_qoi__decoder* self,
+ uint32_t a_key);
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__status
+wuffs_qoi__decoder__set_quirk(
+ wuffs_qoi__decoder* self,
+ uint32_t a_key,
+ uint64_t a_value);
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__status
+wuffs_qoi__decoder__decode_image_config(
+ wuffs_qoi__decoder* self,
+ wuffs_base__image_config* a_dst,
+ wuffs_base__io_buffer* a_src);
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__status
+wuffs_qoi__decoder__decode_frame_config(
+ wuffs_qoi__decoder* self,
+ wuffs_base__frame_config* a_dst,
+ wuffs_base__io_buffer* a_src);
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__status
+wuffs_qoi__decoder__decode_frame(
+ wuffs_qoi__decoder* self,
+ wuffs_base__pixel_buffer* a_dst,
+ wuffs_base__io_buffer* a_src,
+ wuffs_base__pixel_blend a_blend,
+ wuffs_base__slice_u8 a_workbuf,
+ wuffs_base__decode_frame_options* a_opts);
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32
+wuffs_qoi__decoder__frame_dirty_rect(
+ const wuffs_qoi__decoder* self);
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC uint32_t
+wuffs_qoi__decoder__num_animation_loops(
+ const wuffs_qoi__decoder* self);
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC uint64_t
+wuffs_qoi__decoder__num_decoded_frame_configs(
+ const wuffs_qoi__decoder* self);
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC uint64_t
+wuffs_qoi__decoder__num_decoded_frames(
+ const wuffs_qoi__decoder* self);
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__status
+wuffs_qoi__decoder__restart_frame(
+ wuffs_qoi__decoder* self,
+ uint64_t a_index,
+ uint64_t a_io_position);
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct
+wuffs_qoi__decoder__set_report_metadata(
+ wuffs_qoi__decoder* self,
+ uint32_t a_fourcc,
+ bool a_report);
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__status
+wuffs_qoi__decoder__tell_me_more(
+ wuffs_qoi__decoder* self,
+ wuffs_base__io_buffer* a_dst,
+ wuffs_base__more_information* a_minfo,
+ wuffs_base__io_buffer* a_src);
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64
+wuffs_qoi__decoder__workbuf_len(
+ const wuffs_qoi__decoder* self);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+// ---------------- Struct Definitions
+
+// These structs' fields, and the sizeof them, are private implementation
+// details that aren't guaranteed to be stable across Wuffs versions.
+//
+// See https://en.wikipedia.org/wiki/Opaque_pointer#C
+
+#if defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
+
+struct wuffs_qoi__decoder__struct {
+ // Do not access the private_impl's or private_data's fields directly. There
+ // is no API/ABI compatibility or safety guarantee if you do so. Instead, use
+ // the wuffs_foo__bar__baz functions.
+ //
+ // It is a struct, not a struct*, so that the outermost wuffs_foo__bar struct
+ // can be stack allocated when WUFFS_IMPLEMENTATION is defined.
+
+ struct {
+ uint32_t magic;
+ uint32_t active_coroutine;
+ wuffs_base__vtable vtable_for__wuffs_base__image_decoder;
+ wuffs_base__vtable null_vtable;
+
+ uint32_t f_pixfmt;
+ uint32_t f_width;
+ uint32_t f_height;
+ uint64_t f_remaining_pixels_times_4;
+ uint8_t f_call_sequence;
+ uint32_t f_buffer_index;
+ uint32_t f_dst_x;
+ uint32_t f_dst_y;
+ wuffs_base__pixel_swizzler f_swizzler;
+
+ uint32_t p_decode_image_config;
+ uint32_t p_do_decode_image_config;
+ uint32_t p_decode_frame_config;
+ uint32_t p_do_decode_frame_config;
+ uint32_t p_decode_frame;
+ uint32_t p_do_decode_frame;
+ uint32_t p_from_src_to_buffer;
+ } private_impl;
+
+ struct {
+ uint8_t f_pixel[4];
+ uint8_t f_cache[256];
+ uint8_t f_buffer[8196];
+
+ struct {
+ uint64_t scratch;
+ } s_do_decode_image_config;
+ struct {
+ uint64_t scratch;
+ } s_do_decode_frame;
+ struct {
+ uint8_t v_dg;
+ uint32_t v_bi;
+ uint32_t v_bk;
+ } s_from_src_to_buffer;
+ } private_data;
+
+#ifdef __cplusplus
+#if defined(WUFFS_BASE__HAVE_UNIQUE_PTR)
+ using unique_ptr = std::unique_ptr<wuffs_qoi__decoder, wuffs_unique_ptr_deleter>;
+
+ // On failure, the alloc_etc functions return nullptr. They don't throw.
+
+ static inline unique_ptr
+ alloc() {
+ return unique_ptr(wuffs_qoi__decoder__alloc());
+ }
+
+ static inline wuffs_base__image_decoder::unique_ptr
+ alloc_as__wuffs_base__image_decoder() {
+ return wuffs_base__image_decoder::unique_ptr(
+ wuffs_qoi__decoder__alloc_as__wuffs_base__image_decoder());
+ }
+#endif // defined(WUFFS_BASE__HAVE_UNIQUE_PTR)
+
+#if defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION)
+ // Disallow constructing or copying an object via standard C++ mechanisms,
+ // e.g. the "new" operator, as this struct is intentionally opaque. Its total
+ // size and field layout is not part of the public, stable, memory-safe API.
+ // Use malloc or memcpy and the sizeof__wuffs_foo__bar function instead, and
+ // call wuffs_foo__bar__baz methods (which all take a "this"-like pointer as
+ // their first argument) rather than tweaking bar.private_impl.qux fields.
+ //
+ // In C, we can just leave wuffs_foo__bar as an incomplete type (unless
+ // WUFFS_IMPLEMENTATION is #define'd). In C++, we define a complete type in
+ // order to provide convenience methods. These forward on "this", so that you
+ // can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)".
+ wuffs_qoi__decoder__struct() = delete;
+ wuffs_qoi__decoder__struct(const wuffs_qoi__decoder__struct&) = delete;
+ wuffs_qoi__decoder__struct& operator=(
+ const wuffs_qoi__decoder__struct&) = delete;
+#endif // defined(WUFFS_BASE__HAVE_EQ_DELETE) && !defined(WUFFS_IMPLEMENTATION)
+
+#if !defined(WUFFS_IMPLEMENTATION)
+ // As above, the size of the struct is not part of the public API, and unless
+ // WUFFS_IMPLEMENTATION is #define'd, this struct type T should be heap
+ // allocated, not stack allocated. Its size is not intended to be known at
+ // compile time, but it is unfortunately divulged as a side effect of
+ // defining C++ convenience methods. Use "sizeof__T()", calling the function,
+ // instead of "sizeof T", invoking the operator. To make the two values
+ // different, so that passing the latter will be rejected by the initialize
+ // function, we add an arbitrary amount of dead weight.
+ uint8_t dead_weight[123000000]; // 123 MB.
+#endif // !defined(WUFFS_IMPLEMENTATION)
+
+ inline wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT
+ initialize(
+ size_t sizeof_star_self,
+ uint64_t wuffs_version,
+ uint32_t options) {
+ return wuffs_qoi__decoder__initialize(
+ this, sizeof_star_self, wuffs_version, options);
+ }
+
+ inline wuffs_base__image_decoder*
+ upcast_as__wuffs_base__image_decoder() {
+ return (wuffs_base__image_decoder*)this;
+ }
+
+ inline uint64_t
+ get_quirk(
+ uint32_t a_key) const {
+ return wuffs_qoi__decoder__get_quirk(this, a_key);
+ }
+
+ inline wuffs_base__status
+ set_quirk(
+ uint32_t a_key,
+ uint64_t a_value) {
+ return wuffs_qoi__decoder__set_quirk(this, a_key, a_value);
+ }
+
+ inline wuffs_base__status
+ decode_image_config(
+ wuffs_base__image_config* a_dst,
+ wuffs_base__io_buffer* a_src) {
+ return wuffs_qoi__decoder__decode_image_config(this, a_dst, a_src);
+ }
+
+ inline wuffs_base__status
+ decode_frame_config(
+ wuffs_base__frame_config* a_dst,
+ wuffs_base__io_buffer* a_src) {
+ return wuffs_qoi__decoder__decode_frame_config(this, a_dst, a_src);
+ }
+
+ inline wuffs_base__status
+ decode_frame(
+ wuffs_base__pixel_buffer* a_dst,
+ wuffs_base__io_buffer* a_src,
+ wuffs_base__pixel_blend a_blend,
+ wuffs_base__slice_u8 a_workbuf,
+ wuffs_base__decode_frame_options* a_opts) {
+ return wuffs_qoi__decoder__decode_frame(this, a_dst, a_src, a_blend, a_workbuf, a_opts);
+ }
+
+ inline wuffs_base__rect_ie_u32
+ frame_dirty_rect() const {
+ return wuffs_qoi__decoder__frame_dirty_rect(this);
+ }
+
+ inline uint32_t
+ num_animation_loops() const {
+ return wuffs_qoi__decoder__num_animation_loops(this);
+ }
+
+ inline uint64_t
+ num_decoded_frame_configs() const {
+ return wuffs_qoi__decoder__num_decoded_frame_configs(this);
+ }
+
+ inline uint64_t
+ num_decoded_frames() const {
+ return wuffs_qoi__decoder__num_decoded_frames(this);
+ }
+
+ inline wuffs_base__status
+ restart_frame(
+ uint64_t a_index,
+ uint64_t a_io_position) {
+ return wuffs_qoi__decoder__restart_frame(this, a_index, a_io_position);
+ }
+
+ inline wuffs_base__empty_struct
+ set_report_metadata(
+ uint32_t a_fourcc,
+ bool a_report) {
+ return wuffs_qoi__decoder__set_report_metadata(this, a_fourcc, a_report);
+ }
+
+ inline wuffs_base__status
+ tell_me_more(
+ wuffs_base__io_buffer* a_dst,
+ wuffs_base__more_information* a_minfo,
+ wuffs_base__io_buffer* a_src) {
+ return wuffs_qoi__decoder__tell_me_more(this, a_dst, a_minfo, a_src);
+ }
+
+ inline wuffs_base__range_ii_u64
+ workbuf_len() const {
+ return wuffs_qoi__decoder__workbuf_len(this);
+ }
+
+#endif // __cplusplus
+}; // struct wuffs_qoi__decoder__struct
+
+#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)
+
+#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__QOI) || defined(WUFFS_NONMONOLITHIC)
+
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__SHA256) || defined(WUFFS_NONMONOLITHIC)
// ---------------- Status Codes
@@ -15363,6 +15732,7 @@
// - WUFFS_BASE__FOURCC__NIE
// - WUFFS_BASE__FOURCC__NPBM
// - WUFFS_BASE__FOURCC__PNG
+ // - WUFFS_BASE__FOURCC__QOI
// - WUFFS_BASE__FOURCC__TGA
// - WUFFS_BASE__FOURCC__WBMP
// - WUFFS_BASE__FOURCC__WEBP
@@ -43935,6 +44305,7 @@
const char wuffs_jpeg__error__bad_scan_count[] = "#jpeg: bad scan count";
const char wuffs_jpeg__error__missing_huffman_table[] = "#jpeg: missing Huffman table";
const char wuffs_jpeg__error__missing_quantization_table[] = "#jpeg: missing Quantization table";
+const char wuffs_jpeg__error__rejected_progressive_jpeg[] = "#jpeg: rejected progressive JPEG";
const char wuffs_jpeg__error__truncated_input[] = "#jpeg: truncated input";
const char wuffs_jpeg__error__unsupported_arithmetic_coding[] = "#jpeg: unsupported arithmetic coding";
const char wuffs_jpeg__error__unsupported_color_model[] = "#jpeg: unsupported color model";
@@ -44173,6 +44544,8 @@
248u, 249u, 250u,
};
+#define WUFFS_JPEG__QUIRKS_BASE 1220532224u
+
// ---------------- Private Initializer Prototypes
// ---------------- Private Function Prototypes
@@ -46090,6 +46463,10 @@
if (self->private_impl.f_use_lower_quality) {
return 18446744073709551615u;
}
+ } else if (a_key == 1220532224u) {
+ if (self->private_impl.f_reject_progressive_jpegs) {
+ return 1u;
+ }
}
return 0u;
}
@@ -46115,6 +46492,9 @@
if (a_key == 2u) {
self->private_impl.f_use_lower_quality = (a_value >= 9223372036854775808u);
return wuffs_base__make_status(NULL);
+ } else if (a_key == 1220532224u) {
+ self->private_impl.f_reject_progressive_jpegs = (a_value != 0u);
+ return wuffs_base__make_status(NULL);
}
return wuffs_base__make_status(wuffs_base__error__unsupported_option);
}
@@ -46324,7 +46704,10 @@
goto exit;
} else if (v_marker < 208u) {
if (v_marker <= 194u) {
- if (self->private_impl.f_sof_marker != 0u) {
+ if ((v_marker == 194u) && self->private_impl.f_reject_progressive_jpegs) {
+ status = wuffs_base__make_status(wuffs_jpeg__error__rejected_progressive_jpeg);
+ goto exit;
+ } else if (self->private_impl.f_sof_marker != 0u) {
status = wuffs_base__make_status(wuffs_jpeg__error__bad_sof_marker);
goto exit;
}
@@ -66799,6 +67182,1282 @@
#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__PNG)
+#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__QOI)
+
+// ---------------- Status Codes Implementations
+
+const char wuffs_qoi__error__bad_footer[] = "#qoi: bad footer";
+const char wuffs_qoi__error__bad_header[] = "#qoi: bad header";
+const char wuffs_qoi__error__truncated_input[] = "#qoi: truncated input";
+
+// ---------------- Private Consts
+
+// ---------------- Private Initializer Prototypes
+
+// ---------------- Private Function Prototypes
+
+WUFFS_BASE__GENERATED_C_CODE
+static wuffs_base__status
+wuffs_qoi__decoder__do_decode_image_config(
+ wuffs_qoi__decoder* self,
+ wuffs_base__image_config* a_dst,
+ wuffs_base__io_buffer* a_src);
+
+WUFFS_BASE__GENERATED_C_CODE
+static wuffs_base__status
+wuffs_qoi__decoder__do_decode_frame_config(
+ wuffs_qoi__decoder* self,
+ wuffs_base__frame_config* a_dst,
+ wuffs_base__io_buffer* a_src);
+
+WUFFS_BASE__GENERATED_C_CODE
+static wuffs_base__status
+wuffs_qoi__decoder__do_decode_frame(
+ wuffs_qoi__decoder* self,
+ wuffs_base__pixel_buffer* a_dst,
+ wuffs_base__io_buffer* a_src,
+ wuffs_base__pixel_blend a_blend,
+ wuffs_base__slice_u8 a_workbuf,
+ wuffs_base__decode_frame_options* a_opts);
+
+WUFFS_BASE__GENERATED_C_CODE
+static wuffs_base__status
+wuffs_qoi__decoder__from_src_to_buffer(
+ wuffs_qoi__decoder* self,
+ wuffs_base__io_buffer* a_src);
+
+WUFFS_BASE__GENERATED_C_CODE
+static wuffs_base__status
+wuffs_qoi__decoder__from_buffer_to_dst(
+ wuffs_qoi__decoder* self,
+ wuffs_base__pixel_buffer* a_dst);
+
+// ---------------- VTables
+
+const wuffs_base__image_decoder__func_ptrs
+wuffs_qoi__decoder__func_ptrs_for__wuffs_base__image_decoder = {
+ (wuffs_base__status(*)(void*,
+ wuffs_base__pixel_buffer*,
+ wuffs_base__io_buffer*,
+ wuffs_base__pixel_blend,
+ wuffs_base__slice_u8,
+ wuffs_base__decode_frame_options*))(&wuffs_qoi__decoder__decode_frame),
+ (wuffs_base__status(*)(void*,
+ wuffs_base__frame_config*,
+ wuffs_base__io_buffer*))(&wuffs_qoi__decoder__decode_frame_config),
+ (wuffs_base__status(*)(void*,
+ wuffs_base__image_config*,
+ wuffs_base__io_buffer*))(&wuffs_qoi__decoder__decode_image_config),
+ (wuffs_base__rect_ie_u32(*)(const void*))(&wuffs_qoi__decoder__frame_dirty_rect),
+ (uint64_t(*)(const void*,
+ uint32_t))(&wuffs_qoi__decoder__get_quirk),
+ (uint32_t(*)(const void*))(&wuffs_qoi__decoder__num_animation_loops),
+ (uint64_t(*)(const void*))(&wuffs_qoi__decoder__num_decoded_frame_configs),
+ (uint64_t(*)(const void*))(&wuffs_qoi__decoder__num_decoded_frames),
+ (wuffs_base__status(*)(void*,
+ uint64_t,
+ uint64_t))(&wuffs_qoi__decoder__restart_frame),
+ (wuffs_base__status(*)(void*,
+ uint32_t,
+ uint64_t))(&wuffs_qoi__decoder__set_quirk),
+ (wuffs_base__empty_struct(*)(void*,
+ uint32_t,
+ bool))(&wuffs_qoi__decoder__set_report_metadata),
+ (wuffs_base__status(*)(void*,
+ wuffs_base__io_buffer*,
+ wuffs_base__more_information*,
+ wuffs_base__io_buffer*))(&wuffs_qoi__decoder__tell_me_more),
+ (wuffs_base__range_ii_u64(*)(const void*))(&wuffs_qoi__decoder__workbuf_len),
+};
+
+// ---------------- Initializer Implementations
+
+wuffs_base__status WUFFS_BASE__WARN_UNUSED_RESULT
+wuffs_qoi__decoder__initialize(
+ wuffs_qoi__decoder* self,
+ size_t sizeof_star_self,
+ uint64_t wuffs_version,
+ uint32_t options){
+ if (!self) {
+ return wuffs_base__make_status(wuffs_base__error__bad_receiver);
+ }
+ if (sizeof(*self) != sizeof_star_self) {
+ return wuffs_base__make_status(wuffs_base__error__bad_sizeof_receiver);
+ }
+ if (((wuffs_version >> 32) != WUFFS_VERSION_MAJOR) ||
+ (((wuffs_version >> 16) & 0xFFFF) > WUFFS_VERSION_MINOR)) {
+ return wuffs_base__make_status(wuffs_base__error__bad_wuffs_version);
+ }
+
+ if ((options & WUFFS_INITIALIZE__ALREADY_ZEROED) != 0) {
+ // The whole point of this if-check is to detect an uninitialized *self.
+ // We disable the warning on GCC. Clang-5.0 does not have this warning.
+#if !defined(__clang__) && defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#endif
+ if (self->private_impl.magic != 0) {
+ return wuffs_base__make_status(wuffs_base__error__initialize_falsely_claimed_already_zeroed);
+ }
+#if !defined(__clang__) && defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
+ } else {
+ if ((options & WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED) == 0) {
+ memset(self, 0, sizeof(*self));
+ options |= WUFFS_INITIALIZE__ALREADY_ZEROED;
+ } else {
+ memset(&(self->private_impl), 0, sizeof(self->private_impl));
+ }
+ }
+
+ self->private_impl.magic = WUFFS_BASE__MAGIC;
+ self->private_impl.vtable_for__wuffs_base__image_decoder.vtable_name =
+ wuffs_base__image_decoder__vtable_name;
+ self->private_impl.vtable_for__wuffs_base__image_decoder.function_pointers =
+ (const void*)(&wuffs_qoi__decoder__func_ptrs_for__wuffs_base__image_decoder);
+ return wuffs_base__make_status(NULL);
+}
+
+wuffs_qoi__decoder*
+wuffs_qoi__decoder__alloc(void) {
+ wuffs_qoi__decoder* x =
+ (wuffs_qoi__decoder*)(calloc(sizeof(wuffs_qoi__decoder), 1));
+ if (!x) {
+ return NULL;
+ }
+ if (wuffs_qoi__decoder__initialize(
+ x, sizeof(wuffs_qoi__decoder), WUFFS_VERSION, WUFFS_INITIALIZE__ALREADY_ZEROED).repr) {
+ free(x);
+ return NULL;
+ }
+ return x;
+}
+
+size_t
+sizeof__wuffs_qoi__decoder(void) {
+ return sizeof(wuffs_qoi__decoder);
+}
+
+// ---------------- Function Implementations
+
+// -------- func qoi.decoder.get_quirk
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC uint64_t
+wuffs_qoi__decoder__get_quirk(
+ const wuffs_qoi__decoder* self,
+ uint32_t a_key) {
+ if (!self) {
+ return 0;
+ }
+ if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
+ (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
+ return 0;
+ }
+
+ return 0u;
+}
+
+// -------- func qoi.decoder.set_quirk
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__status
+wuffs_qoi__decoder__set_quirk(
+ wuffs_qoi__decoder* self,
+ uint32_t a_key,
+ uint64_t a_value) {
+ if (!self) {
+ return wuffs_base__make_status(wuffs_base__error__bad_receiver);
+ }
+ if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
+ return wuffs_base__make_status(
+ (self->private_impl.magic == WUFFS_BASE__DISABLED)
+ ? wuffs_base__error__disabled_by_previous_error
+ : wuffs_base__error__initialize_not_called);
+ }
+
+ return wuffs_base__make_status(wuffs_base__error__unsupported_option);
+}
+
+// -------- func qoi.decoder.decode_image_config
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__status
+wuffs_qoi__decoder__decode_image_config(
+ wuffs_qoi__decoder* self,
+ wuffs_base__image_config* a_dst,
+ wuffs_base__io_buffer* a_src) {
+ if (!self) {
+ return wuffs_base__make_status(wuffs_base__error__bad_receiver);
+ }
+ if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
+ return wuffs_base__make_status(
+ (self->private_impl.magic == WUFFS_BASE__DISABLED)
+ ? wuffs_base__error__disabled_by_previous_error
+ : wuffs_base__error__initialize_not_called);
+ }
+ if (!a_src) {
+ self->private_impl.magic = WUFFS_BASE__DISABLED;
+ return wuffs_base__make_status(wuffs_base__error__bad_argument);
+ }
+ if ((self->private_impl.active_coroutine != 0) &&
+ (self->private_impl.active_coroutine != 1)) {
+ self->private_impl.magic = WUFFS_BASE__DISABLED;
+ return wuffs_base__make_status(wuffs_base__error__interleaved_coroutine_calls);
+ }
+ self->private_impl.active_coroutine = 0;
+ wuffs_base__status status = wuffs_base__make_status(NULL);
+
+ wuffs_base__status v_status = wuffs_base__make_status(NULL);
+
+ uint32_t coro_susp_point = self->private_impl.p_decode_image_config;
+ switch (coro_susp_point) {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
+
+ while (true) {
+ {
+ wuffs_base__status t_0 = wuffs_qoi__decoder__do_decode_image_config(self, a_dst, a_src);
+ v_status = t_0;
+ }
+ if ((v_status.repr == wuffs_base__suspension__short_read) && (a_src && a_src->meta.closed)) {
+ status = wuffs_base__make_status(wuffs_qoi__error__truncated_input);
+ goto exit;
+ }
+ status = v_status;
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(1);
+ }
+
+ ok:
+ self->private_impl.p_decode_image_config = 0;
+ goto exit;
+ }
+
+ goto suspend;
+ suspend:
+ self->private_impl.p_decode_image_config = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
+ self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
+
+ goto exit;
+ exit:
+ if (wuffs_base__status__is_error(&status)) {
+ self->private_impl.magic = WUFFS_BASE__DISABLED;
+ }
+ return status;
+}
+
+// -------- func qoi.decoder.do_decode_image_config
+
+WUFFS_BASE__GENERATED_C_CODE
+static wuffs_base__status
+wuffs_qoi__decoder__do_decode_image_config(
+ wuffs_qoi__decoder* self,
+ wuffs_base__image_config* a_dst,
+ wuffs_base__io_buffer* a_src) {
+ wuffs_base__status status = wuffs_base__make_status(NULL);
+
+ uint32_t v_a = 0;
+
+ const uint8_t* iop_a_src = NULL;
+ const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
+ const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
+ const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
+ if (a_src && a_src->data.ptr) {
+ io0_a_src = a_src->data.ptr;
+ io1_a_src = io0_a_src + a_src->meta.ri;
+ iop_a_src = io1_a_src;
+ io2_a_src = io0_a_src + a_src->meta.wi;
+ }
+
+ uint32_t coro_susp_point = self->private_impl.p_do_decode_image_config;
+ switch (coro_susp_point) {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
+
+ if (self->private_impl.f_call_sequence != 0u) {
+ status = wuffs_base__make_status(wuffs_base__error__bad_call_sequence);
+ goto exit;
+ }
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
+ uint32_t t_0;
+ if (WUFFS_BASE__LIKELY(io2_a_src - iop_a_src >= 4)) {
+ t_0 = wuffs_base__peek_u32le__no_bounds_check(iop_a_src);
+ iop_a_src += 4;
+ } else {
+ self->private_data.s_do_decode_image_config.scratch = 0;
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
+ while (true) {
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint64_t* scratch = &self->private_data.s_do_decode_image_config.scratch;
+ uint32_t num_bits_0 = ((uint32_t)(*scratch >> 56));
+ *scratch <<= 8;
+ *scratch >>= 8;
+ *scratch |= ((uint64_t)(*iop_a_src++)) << num_bits_0;
+ if (num_bits_0 == 24) {
+ t_0 = ((uint32_t)(*scratch));
+ break;
+ }
+ num_bits_0 += 8u;
+ *scratch |= ((uint64_t)(num_bits_0)) << 56;
+ }
+ }
+ v_a = t_0;
+ }
+ if (v_a != 1718185841u) {
+ status = wuffs_base__make_status(wuffs_qoi__error__bad_header);
+ goto exit;
+ }
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
+ uint32_t t_1;
+ if (WUFFS_BASE__LIKELY(io2_a_src - iop_a_src >= 4)) {
+ t_1 = wuffs_base__peek_u32be__no_bounds_check(iop_a_src);
+ iop_a_src += 4;
+ } else {
+ self->private_data.s_do_decode_image_config.scratch = 0;
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
+ while (true) {
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint64_t* scratch = &self->private_data.s_do_decode_image_config.scratch;
+ uint32_t num_bits_1 = ((uint32_t)(*scratch & 0xFFu));
+ *scratch >>= 8;
+ *scratch <<= 8;
+ *scratch |= ((uint64_t)(*iop_a_src++)) << (56 - num_bits_1);
+ if (num_bits_1 == 24) {
+ t_1 = ((uint32_t)(*scratch >> 32));
+ break;
+ }
+ num_bits_1 += 8u;
+ *scratch |= ((uint64_t)(num_bits_1));
+ }
+ }
+ v_a = t_1;
+ }
+ if (v_a > 16777215u) {
+ status = wuffs_base__make_status(wuffs_base__error__unsupported_image_dimension);
+ goto exit;
+ }
+ self->private_impl.f_width = v_a;
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
+ uint32_t t_2;
+ if (WUFFS_BASE__LIKELY(io2_a_src - iop_a_src >= 4)) {
+ t_2 = wuffs_base__peek_u32be__no_bounds_check(iop_a_src);
+ iop_a_src += 4;
+ } else {
+ self->private_data.s_do_decode_image_config.scratch = 0;
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(6);
+ while (true) {
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint64_t* scratch = &self->private_data.s_do_decode_image_config.scratch;
+ uint32_t num_bits_2 = ((uint32_t)(*scratch & 0xFFu));
+ *scratch >>= 8;
+ *scratch <<= 8;
+ *scratch |= ((uint64_t)(*iop_a_src++)) << (56 - num_bits_2);
+ if (num_bits_2 == 24) {
+ t_2 = ((uint32_t)(*scratch >> 32));
+ break;
+ }
+ num_bits_2 += 8u;
+ *scratch |= ((uint64_t)(num_bits_2));
+ }
+ }
+ v_a = t_2;
+ }
+ if (v_a > 16777215u) {
+ status = wuffs_base__make_status(wuffs_base__error__unsupported_image_dimension);
+ goto exit;
+ }
+ self->private_impl.f_height = v_a;
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(7);
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint32_t t_3 = *iop_a_src++;
+ v_a = t_3;
+ }
+ if (v_a == 3u) {
+ self->private_impl.f_pixfmt = 2415954056u;
+ } else if (v_a == 4u) {
+ self->private_impl.f_pixfmt = 2164295816u;
+ } else {
+ status = wuffs_base__make_status(wuffs_qoi__error__bad_header);
+ goto exit;
+ }
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(8);
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ iop_a_src++;
+ if (a_dst != NULL) {
+ wuffs_base__image_config__set(
+ a_dst,
+ self->private_impl.f_pixfmt,
+ 0u,
+ self->private_impl.f_width,
+ self->private_impl.f_height,
+ 14u,
+ (self->private_impl.f_pixfmt == 2415954056u));
+ }
+ self->private_impl.f_call_sequence = 32u;
+
+ goto ok;
+ ok:
+ self->private_impl.p_do_decode_image_config = 0;
+ goto exit;
+ }
+
+ goto suspend;
+ suspend:
+ self->private_impl.p_do_decode_image_config = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
+
+ goto exit;
+ exit:
+ if (a_src && a_src->data.ptr) {
+ a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
+ }
+
+ return status;
+}
+
+// -------- func qoi.decoder.decode_frame_config
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__status
+wuffs_qoi__decoder__decode_frame_config(
+ wuffs_qoi__decoder* self,
+ wuffs_base__frame_config* a_dst,
+ wuffs_base__io_buffer* a_src) {
+ if (!self) {
+ return wuffs_base__make_status(wuffs_base__error__bad_receiver);
+ }
+ if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
+ return wuffs_base__make_status(
+ (self->private_impl.magic == WUFFS_BASE__DISABLED)
+ ? wuffs_base__error__disabled_by_previous_error
+ : wuffs_base__error__initialize_not_called);
+ }
+ if (!a_src) {
+ self->private_impl.magic = WUFFS_BASE__DISABLED;
+ return wuffs_base__make_status(wuffs_base__error__bad_argument);
+ }
+ if ((self->private_impl.active_coroutine != 0) &&
+ (self->private_impl.active_coroutine != 2)) {
+ self->private_impl.magic = WUFFS_BASE__DISABLED;
+ return wuffs_base__make_status(wuffs_base__error__interleaved_coroutine_calls);
+ }
+ self->private_impl.active_coroutine = 0;
+ wuffs_base__status status = wuffs_base__make_status(NULL);
+
+ wuffs_base__status v_status = wuffs_base__make_status(NULL);
+
+ uint32_t coro_susp_point = self->private_impl.p_decode_frame_config;
+ switch (coro_susp_point) {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
+
+ while (true) {
+ {
+ wuffs_base__status t_0 = wuffs_qoi__decoder__do_decode_frame_config(self, a_dst, a_src);
+ v_status = t_0;
+ }
+ if ((v_status.repr == wuffs_base__suspension__short_read) && (a_src && a_src->meta.closed)) {
+ status = wuffs_base__make_status(wuffs_qoi__error__truncated_input);
+ goto exit;
+ }
+ status = v_status;
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(1);
+ }
+
+ ok:
+ self->private_impl.p_decode_frame_config = 0;
+ goto exit;
+ }
+
+ goto suspend;
+ suspend:
+ self->private_impl.p_decode_frame_config = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
+ self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 2 : 0;
+
+ goto exit;
+ exit:
+ if (wuffs_base__status__is_error(&status)) {
+ self->private_impl.magic = WUFFS_BASE__DISABLED;
+ }
+ return status;
+}
+
+// -------- func qoi.decoder.do_decode_frame_config
+
+WUFFS_BASE__GENERATED_C_CODE
+static wuffs_base__status
+wuffs_qoi__decoder__do_decode_frame_config(
+ wuffs_qoi__decoder* self,
+ wuffs_base__frame_config* a_dst,
+ wuffs_base__io_buffer* a_src) {
+ wuffs_base__status status = wuffs_base__make_status(NULL);
+
+ const uint8_t* iop_a_src = NULL;
+ const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
+ const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
+ const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
+ if (a_src && a_src->data.ptr) {
+ io0_a_src = a_src->data.ptr;
+ io1_a_src = io0_a_src + a_src->meta.ri;
+ iop_a_src = io1_a_src;
+ io2_a_src = io0_a_src + a_src->meta.wi;
+ }
+
+ uint32_t coro_susp_point = self->private_impl.p_do_decode_frame_config;
+ switch (coro_susp_point) {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
+
+ if (self->private_impl.f_call_sequence == 32u) {
+ } else if (self->private_impl.f_call_sequence < 32u) {
+ if (a_src) {
+ a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
+ }
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
+ status = wuffs_qoi__decoder__do_decode_image_config(self, NULL, a_src);
+ if (a_src) {
+ iop_a_src = a_src->data.ptr + a_src->meta.ri;
+ }
+ if (status.repr) {
+ goto suspend;
+ }
+ } else if (self->private_impl.f_call_sequence == 40u) {
+ if (16u != wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)))) {
+ status = wuffs_base__make_status(wuffs_base__error__bad_restart);
+ goto exit;
+ }
+ } else if (self->private_impl.f_call_sequence == 64u) {
+ self->private_impl.f_call_sequence = 96u;
+ status = wuffs_base__make_status(wuffs_base__note__end_of_data);
+ goto ok;
+ } else {
+ status = wuffs_base__make_status(wuffs_base__note__end_of_data);
+ goto ok;
+ }
+ if (a_dst != NULL) {
+ wuffs_base__frame_config__set(
+ a_dst,
+ wuffs_base__utility__make_rect_ie_u32(
+ 0u,
+ 0u,
+ self->private_impl.f_width,
+ self->private_impl.f_height),
+ ((wuffs_base__flicks)(0u)),
+ 0u,
+ 14u,
+ 0u,
+ (self->private_impl.f_pixfmt == 2415954056u),
+ false,
+ 0u);
+ }
+ self->private_impl.f_call_sequence = 64u;
+
+ ok:
+ self->private_impl.p_do_decode_frame_config = 0;
+ goto exit;
+ }
+
+ goto suspend;
+ suspend:
+ self->private_impl.p_do_decode_frame_config = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
+
+ goto exit;
+ exit:
+ if (a_src && a_src->data.ptr) {
+ a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
+ }
+
+ return status;
+}
+
+// -------- func qoi.decoder.decode_frame
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__status
+wuffs_qoi__decoder__decode_frame(
+ wuffs_qoi__decoder* self,
+ wuffs_base__pixel_buffer* a_dst,
+ wuffs_base__io_buffer* a_src,
+ wuffs_base__pixel_blend a_blend,
+ wuffs_base__slice_u8 a_workbuf,
+ wuffs_base__decode_frame_options* a_opts) {
+ if (!self) {
+ return wuffs_base__make_status(wuffs_base__error__bad_receiver);
+ }
+ if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
+ return wuffs_base__make_status(
+ (self->private_impl.magic == WUFFS_BASE__DISABLED)
+ ? wuffs_base__error__disabled_by_previous_error
+ : wuffs_base__error__initialize_not_called);
+ }
+ if (!a_dst || !a_src) {
+ self->private_impl.magic = WUFFS_BASE__DISABLED;
+ return wuffs_base__make_status(wuffs_base__error__bad_argument);
+ }
+ if ((self->private_impl.active_coroutine != 0) &&
+ (self->private_impl.active_coroutine != 3)) {
+ self->private_impl.magic = WUFFS_BASE__DISABLED;
+ return wuffs_base__make_status(wuffs_base__error__interleaved_coroutine_calls);
+ }
+ self->private_impl.active_coroutine = 0;
+ wuffs_base__status status = wuffs_base__make_status(NULL);
+
+ wuffs_base__status v_status = wuffs_base__make_status(NULL);
+
+ uint32_t coro_susp_point = self->private_impl.p_decode_frame;
+ switch (coro_susp_point) {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
+
+ while (true) {
+ {
+ wuffs_base__status t_0 = wuffs_qoi__decoder__do_decode_frame(self,
+ a_dst,
+ a_src,
+ a_blend,
+ a_workbuf,
+ a_opts);
+ v_status = t_0;
+ }
+ if ((v_status.repr == wuffs_base__suspension__short_read) && (a_src && a_src->meta.closed)) {
+ status = wuffs_base__make_status(wuffs_qoi__error__truncated_input);
+ goto exit;
+ }
+ status = v_status;
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(1);
+ }
+
+ ok:
+ self->private_impl.p_decode_frame = 0;
+ goto exit;
+ }
+
+ goto suspend;
+ suspend:
+ self->private_impl.p_decode_frame = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
+ self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 3 : 0;
+
+ goto exit;
+ exit:
+ if (wuffs_base__status__is_error(&status)) {
+ self->private_impl.magic = WUFFS_BASE__DISABLED;
+ }
+ return status;
+}
+
+// -------- func qoi.decoder.do_decode_frame
+
+WUFFS_BASE__GENERATED_C_CODE
+static wuffs_base__status
+wuffs_qoi__decoder__do_decode_frame(
+ wuffs_qoi__decoder* self,
+ wuffs_base__pixel_buffer* a_dst,
+ wuffs_base__io_buffer* a_src,
+ wuffs_base__pixel_blend a_blend,
+ wuffs_base__slice_u8 a_workbuf,
+ wuffs_base__decode_frame_options* a_opts) {
+ wuffs_base__status status = wuffs_base__make_status(NULL);
+
+ wuffs_base__status v_status = wuffs_base__make_status(NULL);
+ uint64_t v_c64 = 0;
+
+ const uint8_t* iop_a_src = NULL;
+ const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
+ const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
+ const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
+ if (a_src && a_src->data.ptr) {
+ io0_a_src = a_src->data.ptr;
+ io1_a_src = io0_a_src + a_src->meta.ri;
+ iop_a_src = io1_a_src;
+ io2_a_src = io0_a_src + a_src->meta.wi;
+ }
+
+ uint32_t coro_susp_point = self->private_impl.p_do_decode_frame;
+ switch (coro_susp_point) {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
+
+ if (self->private_impl.f_call_sequence == 64u) {
+ } else if (self->private_impl.f_call_sequence < 64u) {
+ if (a_src) {
+ a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
+ }
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
+ status = wuffs_qoi__decoder__do_decode_frame_config(self, NULL, a_src);
+ if (a_src) {
+ iop_a_src = a_src->data.ptr + a_src->meta.ri;
+ }
+ if (status.repr) {
+ goto suspend;
+ }
+ } else {
+ status = wuffs_base__make_status(wuffs_base__note__end_of_data);
+ goto ok;
+ }
+ v_status = wuffs_base__pixel_swizzler__prepare(&self->private_impl.f_swizzler,
+ wuffs_base__pixel_buffer__pixel_format(a_dst),
+ wuffs_base__pixel_buffer__palette(a_dst),
+ wuffs_base__utility__make_pixel_format(self->private_impl.f_pixfmt),
+ wuffs_base__utility__empty_slice_u8(),
+ a_blend);
+ if ( ! wuffs_base__status__is_ok(&v_status)) {
+ status = v_status;
+ if (wuffs_base__status__is_error(&status)) {
+ goto exit;
+ } else if (wuffs_base__status__is_suspension(&status)) {
+ status = wuffs_base__make_status(wuffs_base__error__cannot_return_a_suspension);
+ goto exit;
+ }
+ goto ok;
+ }
+ self->private_impl.f_dst_x = 0u;
+ self->private_impl.f_dst_y = 0u;
+ self->private_data.f_pixel[0u] = 0u;
+ self->private_data.f_pixel[1u] = 0u;
+ self->private_data.f_pixel[2u] = 0u;
+ self->private_data.f_pixel[3u] = 255u;
+ wuffs_private_impl__bulk_memset(&self->private_data.f_cache[0], 256u, 0u);
+ self->private_impl.f_remaining_pixels_times_4 = (((uint64_t)(self->private_impl.f_width)) * ((uint64_t)(self->private_impl.f_height)) * 4u);
+ while (self->private_impl.f_remaining_pixels_times_4 > 0u) {
+ if (a_src) {
+ a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
+ }
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
+ status = wuffs_qoi__decoder__from_src_to_buffer(self, a_src);
+ if (a_src) {
+ iop_a_src = a_src->data.ptr + a_src->meta.ri;
+ }
+ if (status.repr) {
+ goto suspend;
+ }
+ if (self->private_impl.f_remaining_pixels_times_4 < ((uint64_t)(self->private_impl.f_buffer_index))) {
+ status = wuffs_base__make_status(wuffs_base__error__too_much_data);
+ goto exit;
+ }
+ self->private_impl.f_remaining_pixels_times_4 -= ((uint64_t)(self->private_impl.f_buffer_index));
+ v_status = wuffs_qoi__decoder__from_buffer_to_dst(self, a_dst);
+ if ( ! wuffs_base__status__is_ok(&v_status)) {
+ status = v_status;
+ if (wuffs_base__status__is_error(&status)) {
+ goto exit;
+ } else if (wuffs_base__status__is_suspension(&status)) {
+ status = wuffs_base__make_status(wuffs_base__error__cannot_return_a_suspension);
+ goto exit;
+ }
+ goto ok;
+ }
+ }
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
+ uint64_t t_0;
+ if (WUFFS_BASE__LIKELY(io2_a_src - iop_a_src >= 8)) {
+ t_0 = wuffs_base__peek_u64be__no_bounds_check(iop_a_src);
+ iop_a_src += 8;
+ } else {
+ self->private_data.s_do_decode_frame.scratch = 0;
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
+ while (true) {
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint64_t* scratch = &self->private_data.s_do_decode_frame.scratch;
+ uint32_t num_bits_0 = ((uint32_t)(*scratch & 0xFFu));
+ *scratch >>= 8;
+ *scratch <<= 8;
+ *scratch |= ((uint64_t)(*iop_a_src++)) << (56 - num_bits_0);
+ if (num_bits_0 == 56) {
+ t_0 = ((uint64_t)(*scratch >> 0));
+ break;
+ }
+ num_bits_0 += 8u;
+ *scratch |= ((uint64_t)(num_bits_0));
+ }
+ }
+ v_c64 = t_0;
+ }
+ if (v_c64 != 1u) {
+ status = wuffs_base__make_status(wuffs_qoi__error__bad_footer);
+ goto exit;
+ }
+ self->private_impl.f_call_sequence = 96u;
+
+ ok:
+ self->private_impl.p_do_decode_frame = 0;
+ goto exit;
+ }
+
+ goto suspend;
+ suspend:
+ self->private_impl.p_do_decode_frame = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
+
+ goto exit;
+ exit:
+ if (a_src && a_src->data.ptr) {
+ a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
+ }
+
+ return status;
+}
+
+// -------- func qoi.decoder.from_src_to_buffer
+
+WUFFS_BASE__GENERATED_C_CODE
+static wuffs_base__status
+wuffs_qoi__decoder__from_src_to_buffer(
+ wuffs_qoi__decoder* self,
+ wuffs_base__io_buffer* a_src) {
+ wuffs_base__status status = wuffs_base__make_status(NULL);
+
+ uint8_t v_c8 = 0;
+ uint8_t v_dg = 0;
+ uint32_t v_bi = 0;
+ uint32_t v_bj = 0;
+ uint32_t v_bk = 0;
+ uint32_t v_ci = 0;
+ uint32_t v_hash4 = 0;
+
+ const uint8_t* iop_a_src = NULL;
+ const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
+ const uint8_t* io1_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
+ const uint8_t* io2_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
+ if (a_src && a_src->data.ptr) {
+ io0_a_src = a_src->data.ptr;
+ io1_a_src = io0_a_src + a_src->meta.ri;
+ iop_a_src = io1_a_src;
+ io2_a_src = io0_a_src + a_src->meta.wi;
+ }
+
+ uint32_t coro_susp_point = self->private_impl.p_from_src_to_buffer;
+ if (coro_susp_point) {
+ v_dg = self->private_data.s_from_src_to_buffer.v_dg;
+ v_bi = self->private_data.s_from_src_to_buffer.v_bi;
+ v_bk = self->private_data.s_from_src_to_buffer.v_bk;
+ }
+ switch (coro_susp_point) {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT_0;
+
+ v_bk = 7936u;
+ if (self->private_impl.f_remaining_pixels_times_4 < 7936u) {
+ v_bk = ((uint32_t)(self->private_impl.f_remaining_pixels_times_4));
+ }
+ while (v_bi < v_bk) {
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(1);
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint8_t t_0 = *iop_a_src++;
+ v_c8 = t_0;
+ }
+ if (v_c8 == 254u) {
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(2);
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint8_t t_1 = *iop_a_src++;
+ self->private_data.f_pixel[2u] = t_1;
+ }
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint8_t t_2 = *iop_a_src++;
+ self->private_data.f_pixel[1u] = t_2;
+ }
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint8_t t_3 = *iop_a_src++;
+ self->private_data.f_pixel[0u] = t_3;
+ }
+ } else if (v_c8 == 255u) {
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint8_t t_4 = *iop_a_src++;
+ self->private_data.f_pixel[2u] = t_4;
+ }
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(6);
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint8_t t_5 = *iop_a_src++;
+ self->private_data.f_pixel[1u] = t_5;
+ }
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(7);
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint8_t t_6 = *iop_a_src++;
+ self->private_data.f_pixel[0u] = t_6;
+ }
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(8);
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint8_t t_7 = *iop_a_src++;
+ self->private_data.f_pixel[3u] = t_7;
+ }
+ } else if (((uint8_t)(v_c8 >> 6u)) == 0u) {
+ v_ci = (4u * ((uint32_t)(((uint8_t)(v_c8 & 63u)))));
+ self->private_data.f_pixel[0u] = self->private_data.f_cache[(v_ci + 0u)];
+ self->private_data.f_pixel[1u] = self->private_data.f_cache[(v_ci + 1u)];
+ self->private_data.f_pixel[2u] = self->private_data.f_cache[(v_ci + 2u)];
+ self->private_data.f_pixel[3u] = self->private_data.f_cache[(v_ci + 3u)];
+ self->private_data.f_buffer[(v_bi + 0u)] = self->private_data.f_pixel[0u];
+ self->private_data.f_buffer[(v_bi + 1u)] = self->private_data.f_pixel[1u];
+ self->private_data.f_buffer[(v_bi + 2u)] = self->private_data.f_pixel[2u];
+ self->private_data.f_buffer[(v_bi + 3u)] = self->private_data.f_pixel[3u];
+ v_bi += 4u;
+ continue;
+ } else if (((uint8_t)(v_c8 >> 6u)) == 1u) {
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+ self->private_data.f_pixel[2u] += ((uint8_t)(((uint8_t)(((uint8_t)(v_c8 >> 4u)) & 3u)) + 254u));
+ self->private_data.f_pixel[1u] += ((uint8_t)(((uint8_t)(((uint8_t)(v_c8 >> 2u)) & 3u)) + 254u));
+ self->private_data.f_pixel[0u] += ((uint8_t)(((uint8_t)(((uint8_t)(v_c8 >> 0u)) & 3u)) + 254u));
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
+ } else if (((uint8_t)(v_c8 >> 6u)) == 2u) {
+ v_dg = ((uint8_t)(((uint8_t)(v_c8 & 63u)) + 224u));
+ {
+ WUFFS_BASE__COROUTINE_SUSPENSION_POINT(9);
+ if (WUFFS_BASE__UNLIKELY(iop_a_src == io2_a_src)) {
+ status = wuffs_base__make_status(wuffs_base__suspension__short_read);
+ goto suspend;
+ }
+ uint8_t t_8 = *iop_a_src++;
+ v_c8 = t_8;
+ }
+#if defined(__GNUC__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wconversion"
+#endif
+ self->private_data.f_pixel[2u] += ((uint8_t)(((uint8_t)(v_dg + 248u)) + ((uint8_t)(15u & ((uint8_t)(v_c8 >> 4u))))));
+ self->private_data.f_pixel[1u] += v_dg;
+ self->private_data.f_pixel[0u] += ((uint8_t)(((uint8_t)(v_dg + 248u)) + ((uint8_t)(15u & ((uint8_t)(v_c8 >> 0u))))));
+#if defined(__GNUC__)
+#pragma GCC diagnostic pop
+#endif
+ } else {
+ v_bj = (v_bi + (4u * (63u & (1u + ((uint32_t)(v_c8))))));
+ while (v_bi < v_bj) {
+ self->private_data.f_buffer[(v_bi + 0u)] = self->private_data.f_pixel[0u];
+ self->private_data.f_buffer[(v_bi + 1u)] = self->private_data.f_pixel[1u];
+ self->private_data.f_buffer[(v_bi + 2u)] = self->private_data.f_pixel[2u];
+ self->private_data.f_buffer[(v_bi + 3u)] = self->private_data.f_pixel[3u];
+ v_bi += 4u;
+ }
+ continue;
+ }
+ v_hash4 = (4u * (63u & ((((uint32_t)(self->private_data.f_pixel[2u])) * 3u) +
+ (((uint32_t)(self->private_data.f_pixel[1u])) * 5u) +
+ (((uint32_t)(self->private_data.f_pixel[0u])) * 7u) +
+ (((uint32_t)(self->private_data.f_pixel[3u])) * 11u))));
+ self->private_data.f_cache[(v_hash4 + 0u)] = self->private_data.f_pixel[0u];
+ self->private_data.f_cache[(v_hash4 + 1u)] = self->private_data.f_pixel[1u];
+ self->private_data.f_cache[(v_hash4 + 2u)] = self->private_data.f_pixel[2u];
+ self->private_data.f_cache[(v_hash4 + 3u)] = self->private_data.f_pixel[3u];
+ self->private_data.f_buffer[(v_bi + 0u)] = self->private_data.f_pixel[0u];
+ self->private_data.f_buffer[(v_bi + 1u)] = self->private_data.f_pixel[1u];
+ self->private_data.f_buffer[(v_bi + 2u)] = self->private_data.f_pixel[2u];
+ self->private_data.f_buffer[(v_bi + 3u)] = self->private_data.f_pixel[3u];
+ v_bi += 4u;
+ }
+ self->private_impl.f_buffer_index = v_bi;
+
+ goto ok;
+ ok:
+ self->private_impl.p_from_src_to_buffer = 0;
+ goto exit;
+ }
+
+ goto suspend;
+ suspend:
+ self->private_impl.p_from_src_to_buffer = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
+ self->private_data.s_from_src_to_buffer.v_dg = v_dg;
+ self->private_data.s_from_src_to_buffer.v_bi = v_bi;
+ self->private_data.s_from_src_to_buffer.v_bk = v_bk;
+
+ goto exit;
+ exit:
+ if (a_src && a_src->data.ptr) {
+ a_src->meta.ri = ((size_t)(iop_a_src - a_src->data.ptr));
+ }
+
+ return status;
+}
+
+// -------- func qoi.decoder.from_buffer_to_dst
+
+WUFFS_BASE__GENERATED_C_CODE
+static wuffs_base__status
+wuffs_qoi__decoder__from_buffer_to_dst(
+ wuffs_qoi__decoder* self,
+ wuffs_base__pixel_buffer* a_dst) {
+ wuffs_base__pixel_format v_dst_pixfmt = {0};
+ uint32_t v_dst_bits_per_pixel = 0;
+ uint32_t v_dst_bytes_per_pixel = 0;
+ uint64_t v_dst_bytes_per_row = 0;
+ wuffs_base__table_u8 v_tab = {0};
+ uint32_t v_bi = 0;
+ uint32_t v_rem_x = 0;
+ wuffs_base__slice_u8 v_dst = {0};
+ wuffs_base__slice_u8 v_src = {0};
+ uint32_t v_src_length = 0;
+ uint64_t v_i = 0;
+
+ v_dst_pixfmt = wuffs_base__pixel_buffer__pixel_format(a_dst);
+ v_dst_bits_per_pixel = wuffs_base__pixel_format__bits_per_pixel(&v_dst_pixfmt);
+ if ((v_dst_bits_per_pixel & 7u) != 0u) {
+ return wuffs_base__make_status(wuffs_base__error__unsupported_option);
+ }
+ v_dst_bytes_per_pixel = (v_dst_bits_per_pixel / 8u);
+ v_dst_bytes_per_row = ((uint64_t)((self->private_impl.f_width * v_dst_bytes_per_pixel)));
+ v_tab = wuffs_base__pixel_buffer__plane(a_dst, 0u);
+ while (v_bi < self->private_impl.f_buffer_index) {
+ if (self->private_impl.f_width <= self->private_impl.f_dst_x) {
+ self->private_impl.f_dst_x = 0u;
+ self->private_impl.f_dst_y += 1u;
+ if (self->private_impl.f_dst_y >= self->private_impl.f_height) {
+ break;
+ }
+ v_rem_x = self->private_impl.f_width;
+ } else {
+ v_rem_x = (self->private_impl.f_width - self->private_impl.f_dst_x);
+ }
+ v_src = wuffs_base__make_slice_u8_ij(self->private_data.f_buffer, v_bi, self->private_impl.f_buffer_index);
+ if (((uint64_t)((4u * v_rem_x))) < ((uint64_t)(v_src.len))) {
+ v_src = wuffs_base__slice_u8__subslice_j(v_src, ((uint64_t)((4u * v_rem_x))));
+ }
+ v_src_length = ((uint32_t)(((uint64_t)(v_src.len))));
+ v_bi += v_src_length;
+ v_dst = wuffs_private_impl__table_u8__row_u32(v_tab, self->private_impl.f_dst_y);
+ if (v_dst_bytes_per_row < ((uint64_t)(v_dst.len))) {
+ v_dst = wuffs_base__slice_u8__subslice_j(v_dst, v_dst_bytes_per_row);
+ }
+ v_i = (((uint64_t)(self->private_impl.f_dst_x)) * ((uint64_t)(v_dst_bytes_per_pixel)));
+ self->private_impl.f_dst_x += (v_src_length / 4u);
+ if (v_i < ((uint64_t)(v_dst.len))) {
+ wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, wuffs_base__slice_u8__subslice_i(v_dst, v_i), wuffs_base__pixel_buffer__palette(a_dst), v_src);
+ }
+ }
+ return wuffs_base__make_status(NULL);
+}
+
+// -------- func qoi.decoder.frame_dirty_rect
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__rect_ie_u32
+wuffs_qoi__decoder__frame_dirty_rect(
+ const wuffs_qoi__decoder* self) {
+ if (!self) {
+ return wuffs_base__utility__empty_rect_ie_u32();
+ }
+ if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
+ (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
+ return wuffs_base__utility__empty_rect_ie_u32();
+ }
+
+ return wuffs_base__utility__make_rect_ie_u32(
+ 0u,
+ 0u,
+ self->private_impl.f_width,
+ self->private_impl.f_height);
+}
+
+// -------- func qoi.decoder.num_animation_loops
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC uint32_t
+wuffs_qoi__decoder__num_animation_loops(
+ const wuffs_qoi__decoder* self) {
+ if (!self) {
+ return 0;
+ }
+ if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
+ (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
+ return 0;
+ }
+
+ return 0u;
+}
+
+// -------- func qoi.decoder.num_decoded_frame_configs
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC uint64_t
+wuffs_qoi__decoder__num_decoded_frame_configs(
+ const wuffs_qoi__decoder* self) {
+ if (!self) {
+ return 0;
+ }
+ if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
+ (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
+ return 0;
+ }
+
+ if (self->private_impl.f_call_sequence > 32u) {
+ return 1u;
+ }
+ return 0u;
+}
+
+// -------- func qoi.decoder.num_decoded_frames
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC uint64_t
+wuffs_qoi__decoder__num_decoded_frames(
+ const wuffs_qoi__decoder* self) {
+ if (!self) {
+ return 0;
+ }
+ if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
+ (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
+ return 0;
+ }
+
+ if (self->private_impl.f_call_sequence > 64u) {
+ return 1u;
+ }
+ return 0u;
+}
+
+// -------- func qoi.decoder.restart_frame
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__status
+wuffs_qoi__decoder__restart_frame(
+ wuffs_qoi__decoder* self,
+ uint64_t a_index,
+ uint64_t a_io_position) {
+ if (!self) {
+ return wuffs_base__make_status(wuffs_base__error__bad_receiver);
+ }
+ if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
+ return wuffs_base__make_status(
+ (self->private_impl.magic == WUFFS_BASE__DISABLED)
+ ? wuffs_base__error__disabled_by_previous_error
+ : wuffs_base__error__initialize_not_called);
+ }
+
+ if (self->private_impl.f_call_sequence < 32u) {
+ return wuffs_base__make_status(wuffs_base__error__bad_call_sequence);
+ }
+ if ((a_index != 0u) || (a_io_position != 14u)) {
+ return wuffs_base__make_status(wuffs_base__error__bad_argument);
+ }
+ self->private_impl.f_call_sequence = 40u;
+ return wuffs_base__make_status(NULL);
+}
+
+// -------- func qoi.decoder.set_report_metadata
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__empty_struct
+wuffs_qoi__decoder__set_report_metadata(
+ wuffs_qoi__decoder* self,
+ uint32_t a_fourcc,
+ bool a_report) {
+ return wuffs_base__make_empty_struct();
+}
+
+// -------- func qoi.decoder.tell_me_more
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__status
+wuffs_qoi__decoder__tell_me_more(
+ wuffs_qoi__decoder* self,
+ wuffs_base__io_buffer* a_dst,
+ wuffs_base__more_information* a_minfo,
+ wuffs_base__io_buffer* a_src) {
+ if (!self) {
+ return wuffs_base__make_status(wuffs_base__error__bad_receiver);
+ }
+ if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
+ return wuffs_base__make_status(
+ (self->private_impl.magic == WUFFS_BASE__DISABLED)
+ ? wuffs_base__error__disabled_by_previous_error
+ : wuffs_base__error__initialize_not_called);
+ }
+ if (!a_dst || !a_src) {
+ self->private_impl.magic = WUFFS_BASE__DISABLED;
+ return wuffs_base__make_status(wuffs_base__error__bad_argument);
+ }
+ if ((self->private_impl.active_coroutine != 0) &&
+ (self->private_impl.active_coroutine != 4)) {
+ self->private_impl.magic = WUFFS_BASE__DISABLED;
+ return wuffs_base__make_status(wuffs_base__error__interleaved_coroutine_calls);
+ }
+ self->private_impl.active_coroutine = 0;
+ wuffs_base__status status = wuffs_base__make_status(NULL);
+
+ status = wuffs_base__make_status(wuffs_base__error__no_more_information);
+ goto exit;
+
+ goto ok;
+ ok:
+ goto exit;
+ exit:
+ if (wuffs_base__status__is_error(&status)) {
+ self->private_impl.magic = WUFFS_BASE__DISABLED;
+ }
+ return status;
+}
+
+// -------- func qoi.decoder.workbuf_len
+
+WUFFS_BASE__GENERATED_C_CODE
+WUFFS_BASE__MAYBE_STATIC wuffs_base__range_ii_u64
+wuffs_qoi__decoder__workbuf_len(
+ const wuffs_qoi__decoder* self) {
+ if (!self) {
+ return wuffs_base__utility__empty_range_ii_u64();
+ }
+ if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
+ (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
+ return wuffs_base__utility__empty_range_ii_u64();
+ }
+
+ return wuffs_base__utility__make_range_ii_u64(0u, 0u);
+}
+
+#endif // !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__QOI)
+
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__SHA256)
// ---------------- Status Codes Implementations
@@ -77952,6 +79611,11 @@
}
#endif
+#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__QOI)
+ case WUFFS_BASE__FOURCC__QOI:
+ return wuffs_qoi__decoder::alloc_as__wuffs_base__image_decoder();
+#endif
+
#if !defined(WUFFS_CONFIG__MODULES) || defined(WUFFS_CONFIG__MODULE__TGA)
case WUFFS_BASE__FOURCC__TGA:
return wuffs_tga__decoder::alloc_as__wuffs_base__image_decoder();
diff --git a/sync.txt b/sync.txt
index 96ae672..fb805fd 100644
--- a/sync.txt
+++ b/sync.txt
@@ -1,10 +1,10 @@
-script/sync.sh ran on 2024-08-05
-Sibling directory (../wuffs) git revision is 870cfd18a7fe77a97a2258f564e9806d3474d56b
+script/sync.sh ran on 2024-08-11
+Sibling directory (../wuffs) git revision is c89b3bc6d819bde0b569102905a67f90c3441150
Manifest (sha256sum values, filenames, versions):
994126492f24a3edae9b95efa92820647cedc42ee933ce3ff2a364fa9c62aba3 release/c/README.md
3b6a0c78f663bb495d1972fbb2a87c717d70fbac5ea8cc1a50cb9afaa4b03f92 release/c/wuffs-v0.2.c
#define WUFFS_VERSION_STRING "0.2.0+2078.20191219"
a3db4bd979663423de00309d1ba07d7fa8576845223d3e02764181bd6da23f90 release/c/wuffs-v0.3.c
#define WUFFS_VERSION_STRING "0.3.4+3401.20240419"
-b4803e34c57aa8ab2062c1609a07a01e2777d913af2f898e132bef6da0a25f97 release/c/wuffs-v0.4.c
- #define WUFFS_VERSION_STRING "0.4.0-alpha.6+3789.20240804"
+0f069b7308e7b477a626a192a664525ac479f9657daab85abc3f46e71e91daea release/c/wuffs-v0.4.c
+ #define WUFFS_VERSION_STRING "0.4.0-alpha.7+3793.20240811"