Lines Matching defs:self

350 // WUFFS_INITIALIZE__ALREADY_ZEROED means that the "self" receiver struct value
355 // WUFFS_INITIALIZE__ALREADY_ZEROED, only some of the "self" receiver struct
5823 void* self,
5827 void* self,
5835 wuffs_base__hasher_u32* self,
5841 wuffs_base__hasher_u32* self,
5884 void* self,
5891 void* self,
5895 void* self,
5899 const void* self);
5901 const void* self);
5903 const void* self);
5905 const void* self);
5907 void* self,
5911 void* self,
5915 void* self,
5919 void* self,
5924 const void* self);
5931 wuffs_base__image_decoder* self,
5940 wuffs_base__image_decoder* self,
5946 wuffs_base__image_decoder* self,
5952 const wuffs_base__image_decoder* self);
5956 const wuffs_base__image_decoder* self);
5960 const wuffs_base__image_decoder* self);
5964 const wuffs_base__image_decoder* self);
5968 wuffs_base__image_decoder* self,
5974 wuffs_base__image_decoder* self,
5980 wuffs_base__image_decoder* self,
5986 wuffs_base__image_decoder* self,
5993 const wuffs_base__image_decoder* self);
6105 void* self,
6109 void* self,
6114 const void* self);
6121 wuffs_base__io_transformer* self,
6127 wuffs_base__io_transformer* self,
6134 const wuffs_base__io_transformer* self);
6183 void* self,
6188 void* self,
6192 const void* self);
6199 wuffs_base__token_decoder* self,
6206 wuffs_base__token_decoder* self,
6212 const wuffs_base__token_decoder* self);
6275 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
6276 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
6278 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
6283 wuffs_adler32__hasher* self,
6319 wuffs_adler32__hasher* self,
6325 wuffs_adler32__hasher* self,
6359 wuffs_adler32__hasher* self,
6463 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
6464 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
6466 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
6471 wuffs_bmp__decoder* self,
6507 wuffs_bmp__decoder* self,
6513 wuffs_bmp__decoder* self,
6519 wuffs_bmp__decoder* self,
6525 wuffs_bmp__decoder* self,
6534 const wuffs_bmp__decoder* self);
6538 const wuffs_bmp__decoder* self);
6542 const wuffs_bmp__decoder* self);
6546 const wuffs_bmp__decoder* self);
6550 wuffs_bmp__decoder* self,
6556 wuffs_bmp__decoder* self,
6562 wuffs_bmp__decoder* self,
6569 const wuffs_bmp__decoder* self);
6827 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
6828 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
6830 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
6835 wuffs_cbor__decoder* self,
6871 wuffs_cbor__decoder* self,
6877 const wuffs_cbor__decoder* self);
6881 wuffs_cbor__decoder* self,
7032 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
7033 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
7035 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
7040 wuffs_crc32__ieee_hasher* self,
7076 wuffs_crc32__ieee_hasher* self,
7082 wuffs_crc32__ieee_hasher* self,
7115 wuffs_crc32__ieee_hasher* self,
7229 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
7230 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
7232 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
7237 wuffs_deflate__decoder* self,
7273 wuffs_deflate__decoder* self,
7278 wuffs_deflate__decoder* self,
7284 const wuffs_deflate__decoder* self);
7288 wuffs_deflate__decoder* self,
7332 wuffs_deflate__decoder* self,
7490 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
7491 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
7493 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
7498 wuffs_lzw__decoder* self,
7534 wuffs_lzw__decoder* self,
7540 wuffs_lzw__decoder* self,
7545 const wuffs_lzw__decoder* self);
7549 wuffs_lzw__decoder* self,
7556 wuffs_lzw__decoder* self);
7744 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
7745 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
7747 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
7752 wuffs_gif__decoder* self,
7788 wuffs_gif__decoder* self,
7794 wuffs_gif__decoder* self,
7800 wuffs_gif__decoder* self,
7806 wuffs_gif__decoder* self,
7813 const wuffs_gif__decoder* self);
7817 const wuffs_gif__decoder* self);
7821 const wuffs_gif__decoder* self);
7825 const wuffs_gif__decoder* self);
7829 const wuffs_gif__decoder* self);
7833 wuffs_gif__decoder* self,
7839 wuffs_gif__decoder* self,
7845 wuffs_gif__decoder* self,
8153 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
8154 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
8156 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
8161 wuffs_gzip__decoder* self,
8197 wuffs_gzip__decoder* self,
8203 const wuffs_gzip__decoder* self);
8207 wuffs_gzip__decoder* self,
8415 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
8416 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
8418 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
8423 wuffs_json__decoder* self,
8459 wuffs_json__decoder* self,
8465 const wuffs_json__decoder* self);
8469 wuffs_json__decoder* self,
8634 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
8635 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
8637 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
8642 wuffs_nie__decoder* self,
8678 wuffs_nie__decoder* self,
8684 wuffs_nie__decoder* self,
8690 wuffs_nie__decoder* self,
8696 wuffs_nie__decoder* self,
8705 const wuffs_nie__decoder* self);
8709 const wuffs_nie__decoder* self);
8713 const wuffs_nie__decoder* self);
8717 const wuffs_nie__decoder* self);
8721 wuffs_nie__decoder* self,
8727 wuffs_nie__decoder* self,
8733 wuffs_nie__decoder* self,
8740 const wuffs_nie__decoder* self);
8958 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
8959 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
8961 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
8966 wuffs_zlib__decoder* self,
9002 const wuffs_zlib__decoder* self);
9006 wuffs_zlib__decoder* self,
9011 wuffs_zlib__decoder* self,
9017 const wuffs_zlib__decoder* self);
9021 wuffs_zlib__decoder* self,
9202 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
9203 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
9205 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
9210 wuffs_png__decoder* self,
9246 wuffs_png__decoder* self,
9252 wuffs_png__decoder* self,
9258 wuffs_png__decoder* self,
9264 wuffs_png__decoder* self,
9273 const wuffs_png__decoder* self);
9277 const wuffs_png__decoder* self);
9281 const wuffs_png__decoder* self);
9285 const wuffs_png__decoder* self);
9289 wuffs_png__decoder* self,
9295 wuffs_png__decoder* self,
9301 wuffs_png__decoder* self,
9308 const wuffs_png__decoder* self);
9406 wuffs_png__decoder* self,
9409 wuffs_png__decoder* self,
9413 wuffs_png__decoder* self,
9433 wuffs_png__decoder* self,
9662 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
9663 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
9665 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
9670 wuffs_tga__decoder* self,
9706 wuffs_tga__decoder* self,
9712 wuffs_tga__decoder* self,
9718 wuffs_tga__decoder* self,
9724 wuffs_tga__decoder* self,
9733 const wuffs_tga__decoder* self);
9737 const wuffs_tga__decoder* self);
9741 const wuffs_tga__decoder* self);
9745 const wuffs_tga__decoder* self);
9749 wuffs_tga__decoder* self,
9755 wuffs_tga__decoder* self,
9761 wuffs_tga__decoder* self,
9768 const wuffs_tga__decoder* self);
10005 // For any given "wuffs_foo__bar* self", "wuffs_foo__bar__initialize(self,
10006 // etc)" should be called before any other "wuffs_foo__bar__xxx(self, etc)".
10008 // Pass sizeof(*self) and WUFFS_VERSION for sizeof_star_self and wuffs_version.
10013 wuffs_wbmp__decoder* self,
10049 wuffs_wbmp__decoder* self,
10055 wuffs_wbmp__decoder* self,
10061 wuffs_wbmp__decoder* self,
10067 wuffs_wbmp__decoder* self,
10076 const wuffs_wbmp__decoder* self);
10080 const wuffs_wbmp__decoder* self);
10084 const wuffs_wbmp__decoder* self);
10088 const wuffs_wbmp__decoder* self);
10092 wuffs_wbmp__decoder* self,
10098 wuffs_wbmp__decoder* self,
10104 wuffs_wbmp__decoder* self,
10111 const wuffs_wbmp__decoder* self);
10507 // - It provides the "Bar" name at Foo call sites, which can help self-
10717 // - It provides the "Bar" name at Foo call sites, which can help self-
10935 // - It provides the "Bar" name at Foo call sites, which can help self-
11762 wuffs_base__hasher_u32* self,
11765 if (!self) {
11768 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
11772 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
11778 return (*func_ptrs->set_quirk_enabled)(self, a_quirk, a_enabled);
11790 wuffs_base__hasher_u32* self,
11792 if (!self) {
11795 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
11799 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
11805 return (*func_ptrs->update_u32)(self, a_x);
11819 wuffs_base__image_decoder* self,
11825 if (!self) {
11828 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
11830 (self->private_impl.magic == WUFFS_BASE__DISABLED)
11835 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
11841 return (*func_ptrs->decode_frame)(self, a_dst, a_src, a_blend, a_workbuf, a_opts);
11853 wuffs_base__image_decoder* self,
11856 if (!self) {
11859 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
11861 (self->private_impl.magic == WUFFS_BASE__DISABLED)
11866 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
11872 return (*func_ptrs->decode_frame_config)(self, a_dst, a_src);
11884 wuffs_base__image_decoder* self,
11887 if (!self) {
11890 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
11892 (self->private_impl.magic == WUFFS_BASE__DISABLED)
11897 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
11903 return (*func_ptrs->decode_image_config)(self, a_dst, a_src);
11915 const wuffs_base__image_decoder* self) {
11916 if (!self) {
11919 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
11920 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
11924 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
11930 return (*func_ptrs->frame_dirty_rect)(self);
11942 const wuffs_base__image_decoder* self) {
11943 if (!self) {
11946 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
11947 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
11951 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
11957 return (*func_ptrs->num_animation_loops)(self);
11969 const wuffs_base__image_decoder* self) {
11970 if (!self) {
11973 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
11974 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
11978 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
11984 return (*func_ptrs->num_decoded_frame_configs)(self);
11996 const wuffs_base__image_decoder* self) {
11997 if (!self) {
12000 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
12001 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
12005 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
12011 return (*func_ptrs->num_decoded_frames)(self);
12023 wuffs_base__image_decoder* self,
12026 if (!self) {
12029 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
12031 (self->private_impl.magic == WUFFS_BASE__DISABLED)
12036 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
12042 return (*func_ptrs->restart_frame)(self, a_index, a_io_position);
12054 wuffs_base__image_decoder* self,
12057 if (!self) {
12060 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
12064 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
12070 return (*func_ptrs->set_quirk_enabled)(self, a_quirk, a_enabled);
12082 wuffs_base__image_decoder* self,
12085 if (!self) {
12088 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
12092 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
12098 return (*func_ptrs->set_report_metadata)(self, a_fourcc, a_report);
12110 wuffs_base__image_decoder* self,
12114 if (!self) {
12117 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
12119 (self->private_impl.magic == WUFFS_BASE__DISABLED)
12124 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
12130 return (*func_ptrs->tell_me_more)(self, a_dst, a_minfo, a_src);
12142 const wuffs_base__image_decoder* self) {
12143 if (!self) {
12146 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
12147 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
12151 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
12157 return (*func_ptrs->workbuf_len)(self);
12171 wuffs_base__io_transformer* self,
12174 if (!self) {
12177 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
12181 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
12187 return (*func_ptrs->set_quirk_enabled)(self, a_quirk, a_enabled);
12199 wuffs_base__io_transformer* self,
12203 if (!self) {
12206 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
12208 (self->private_impl.magic == WUFFS_BASE__DISABLED)
12213 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
12219 return (*func_ptrs->transform_io)(self, a_dst, a_src, a_workbuf);
12231 const wuffs_base__io_transformer* self) {
12232 if (!self) {
12235 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
12236 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
12240 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
12246 return (*func_ptrs->workbuf_len)(self);
12260 wuffs_base__token_decoder* self,
12264 if (!self) {
12267 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
12269 (self->private_impl.magic == WUFFS_BASE__DISABLED)
12274 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
12280 return (*func_ptrs->decode_tokens)(self, a_dst, a_src, a_workbuf);
12292 wuffs_base__token_decoder* self,
12295 if (!self) {
12298 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
12302 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
12308 return (*func_ptrs->set_quirk_enabled)(self, a_quirk, a_enabled);
12320 const wuffs_base__token_decoder* self) {
12321 if (!self) {
12324 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
12325 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
12329 const wuffs_base__vtable* v = &self->private_impl.first_vtable;
12335 return (*func_ptrs->workbuf_len)(self);
21704 wuffs_adler32__hasher* self,
21709 wuffs_adler32__hasher* self,
21715 wuffs_adler32__hasher* self,
21722 wuffs_adler32__hasher* self,
21741 wuffs_adler32__hasher* self,
21745 if (!self) {
21748 if (sizeof(*self) != sizeof_star_self) {
21757 // The whole point of this if-check is to detect an uninitialized *self.
21763 if (self->private_impl.magic != 0) {
21771 memset(self, 0, sizeof(*self));
21774 memset(&(self->private_impl), 0, sizeof(self->private_impl));
21778 self->private_impl.choosy_up = &wuffs_adler32__hasher__up__choosy_default;
21780 self->private_impl.magic = WUFFS_BASE__MAGIC;
21781 self->private_impl.vtable_for__wuffs_base__hasher_u32.vtable_name =
21783 self->private_impl.vtable_for__wuffs_base__hasher_u32.function_pointers =
21814 wuffs_adler32__hasher* self,
21824 wuffs_adler32__hasher* self,
21826 if (!self) {
21829 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
21833 if ( ! self->private_impl.f_started) {
21834 self->private_impl.f_started = true;
21835 self->private_impl.f_state = 1;
21836 self->private_impl.choosy_up = (
21843 self->private_impl.choosy_up);
21845 wuffs_adler32__hasher__up(self, a_x);
21846 return self->private_impl.f_state;
21853 wuffs_adler32__hasher* self,
21855 return (*self->private_impl.choosy_up)(self, a_x);
21860 wuffs_adler32__hasher* self,
21867 v_s1 = ((self->private_impl.f_state) & 0xFFFF);
21868 v_s2 = ((self->private_impl.f_state) >> (32 - (16)));
21919 self->private_impl.f_state = (((v_s2 & 65535) << 16) | (v_s1 & 65535));
21929 wuffs_adler32__hasher* self,
21949 v_s1 = ((self->private_impl.f_state) & 0xFFFF);
21950 v_s2 = ((self->private_impl.f_state) >> (32 - (16)));
22033 self->private_impl.f_state = (((v_s2 & 65535) << 16) | (v_s1 & 65535));
22046 wuffs_adler32__hasher* self,
22069 v_s1 = ((self->private_impl.f_state) & 0xFFFF);
22070 v_s2 = ((self->private_impl.f_state) >> (32 - (16)));
22125 self->private_impl.f_state = (((v_s2 & 65535) << 16) | (v_s1 & 65535));
22178 wuffs_bmp__decoder* self,
22184 wuffs_bmp__decoder* self,
22190 wuffs_bmp__decoder* self,
22196 wuffs_bmp__decoder* self,
22202 wuffs_bmp__decoder* self,
22207 wuffs_bmp__decoder* self);
22249 wuffs_bmp__decoder* self,
22253 if (!self) {
22256 if (sizeof(*self) != sizeof_star_self) {
22265 // The whole point of this if-check is to detect an uninitialized *self.
22271 if (self->private_impl.magic != 0) {
22279 memset(self, 0, sizeof(*self));
22282 memset(&(self->private_impl), 0, sizeof(self->private_impl));
22286 self->private_impl.magic = WUFFS_BASE__MAGIC;
22287 self->private_impl.vtable_for__wuffs_base__image_decoder.vtable_name =
22289 self->private_impl.vtable_for__wuffs_base__image_decoder.function_pointers =
22320 wuffs_bmp__decoder* self,
22330 wuffs_bmp__decoder* self,
22333 if (!self) {
22336 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
22338 (self->private_impl.magic == WUFFS_BASE__DISABLED)
22343 self->private_impl.magic = WUFFS_BASE__DISABLED;
22346 if ((self->private_impl.active_coroutine != 0) &&
22347 (self->private_impl.active_coroutine != 1)) {
22348 self->private_impl.magic = WUFFS_BASE__DISABLED;
22351 self->private_impl.active_coroutine = 0;
22372 uint32_t coro_susp_point = self->private_impl.p_decode_image_config[0];
22376 if ((self->private_impl.f_call_sequence != 0) || (self->private_impl.f_io_redirect_fourcc == 1)) {
22379 } else if (self->private_impl.f_io_redirect_fourcc != 0) {
22390 self->private_data.s_decode_image_config[0].scratch = 0;
22397 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22416 self->private_data.s_decode_image_config[0].scratch = 8;
22418 if (self->private_data.s_decode_image_config[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
22419 self->private_data.s_decode_image_config[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
22424 iop_a_src += self->private_data.s_decode_image_config[0].scratch;
22432 self->private_data.s_decode_image_config[0].scratch = 0;
22439 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22452 self->private_impl.f_padding = t_1;
22454 if (self->private_impl.f_padding < 14) {
22458 self->private_impl.f_padding -= 14;
22459 self->private_impl.f_io_redirect_pos = wuffs_base__u64__sat_add(((uint64_t)(self->private_impl.f_padding)), wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src))));
22467 self->private_data.s_decode_image_config[0].scratch = 0;
22474 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22487 self->private_impl.f_bitmap_info_len = t_2;
22489 if (self->private_impl.f_padding < self->private_impl.f_bitmap_info_len) {
22493 self->private_impl.f_padding -= self->private_impl.f_bitmap_info_len;
22494 if (self->private_impl.f_bitmap_info_len == 12) {
22502 self->private_data.s_decode_image_config[0].scratch = 0;
22509 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22522 self->private_impl.f_width = t_3;
22531 self->private_data.s_decode_image_config[0].scratch = 0;
22538 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22551 self->private_impl.f_height = t_4;
22560 self->private_data.s_decode_image_config[0].scratch = 0;
22567 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22593 self->private_data.s_decode_image_config[0].scratch = 0;
22600 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22613 self->private_impl.f_bits_per_pixel = t_6;
22615 } else if (self->private_impl.f_bitmap_info_len == 16) {
22623 self->private_data.s_decode_image_config[0].scratch = 0;
22630 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22649 self->private_impl.f_width = v_width;
22657 self->private_data.s_decode_image_config[0].scratch = 0;
22664 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22683 self->private_impl.f_height = v_height;
22691 self->private_data.s_decode_image_config[0].scratch = 0;
22698 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22724 self->private_data.s_decode_image_config[0].scratch = 0;
22731 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22744 self->private_impl.f_bits_per_pixel = t_10;
22754 self->private_data.s_decode_image_config[0].scratch = 0;
22761 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22780 self->private_impl.f_width = v_width;
22788 self->private_data.s_decode_image_config[0].scratch = 0;
22795 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22814 self->private_impl.f_height = (((uint32_t)(0 - v_height)) & 2147483647);
22815 self->private_impl.f_top_down = true;
22817 self->private_impl.f_height = v_height;
22826 self->private_data.s_decode_image_config[0].scratch = 0;
22833 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22859 self->private_data.s_decode_image_config[0].scratch = 0;
22866 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22879 self->private_impl.f_bits_per_pixel = t_14;
22888 self->private_data.s_decode_image_config[0].scratch = 0;
22895 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22908 self->private_impl.f_compression = t_15;
22910 if (self->private_impl.f_bits_per_pixel == 0) {
22911 if (self->private_impl.f_compression == 4) {
22912 self->private_impl.f_io_redirect_fourcc = 1246774599;
22915 } else if (self->private_impl.f_compression == 5) {
22916 self->private_impl.f_io_redirect_fourcc = 1347307296;
22923 self->private_data.s_decode_image_config[0].scratch = 20;
22925 if (self->private_data.s_decode_image_config[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
22926 self->private_data.s_decode_image_config[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
22931 iop_a_src += self->private_data.s_decode_image_config[0].scratch;
22932 if (self->private_impl.f_bitmap_info_len == 40) {
22933 if (self->private_impl.f_bits_per_pixel >= 16) {
22934 if (self->private_impl.f_padding >= 16) {
22935 self->private_impl.f_bitmap_info_len = 56;
22936 self->private_impl.f_padding -= 16;
22937 } else if (self->private_impl.f_padding >= 12) {
22938 self->private_impl.f_bitmap_info_len = 52;
22939 self->private_impl.f_padding -= 12;
22942 } else if ((self->private_impl.f_bitmap_info_len != 52) &&
22943 (self->private_impl.f_bitmap_info_len != 56) &&
22944 (self->private_impl.f_bitmap_info_len != 64) &&
22945 (self->private_impl.f_bitmap_info_len != 108) &&
22946 (self->private_impl.f_bitmap_info_len != 124)) {
22950 if (self->private_impl.f_compression == 6) {
22951 self->private_impl.f_compression = 3;
22953 if (self->private_impl.f_compression == 3) {
22954 if (self->private_impl.f_bitmap_info_len >= 52) {
22962 self->private_data.s_decode_image_config[0].scratch = 0;
22969 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
22982 self->private_impl.f_channel_masks[2] = t_16;
22991 self->private_data.s_decode_image_config[0].scratch = 0;
22998 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
23011 self->private_impl.f_channel_masks[1] = t_17;
23020 self->private_data.s_decode_image_config[0].scratch = 0;
23027 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
23040 self->private_impl.f_channel_masks[0] = t_18;
23042 if (self->private_impl.f_bitmap_info_len >= 56) {
23050 self->private_data.s_decode_image_config[0].scratch = 0;
23057 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
23070 self->private_impl.f_channel_masks[3] = t_19;
23072 self->private_data.s_decode_image_config[0].scratch = ((uint32_t)(self->private_impl.f_bitmap_info_len - 56));
23074 if (self->private_data.s_decode_image_config[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
23075 self->private_data.s_decode_image_config[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
23080 iop_a_src += self->private_data.s_decode_image_config[0].scratch;
23082 if ((self->private_impl.f_channel_masks[0] == 255) && (self->private_impl.f_channel_masks[1] == 65280) && (self->private_impl.f_channel_masks[2] == 16711680)) {
23083 if (self->private_impl.f_bits_per_pixel == 24) {
23084 self->private_impl.f_compression = 0;
23085 } else if (self->private_impl.f_bits_per_pixel == 32) {
23086 if ((self->private_impl.f_channel_masks[3] == 0) || (self->private_impl.f_channel_masks[3] == 4278190080)) {
23087 self->private_impl.f_compression = 0;
23092 status = wuffs_bmp__decoder__process_masks(self);
23097 } else if (self->private_impl.f_bitmap_info_len >= 40) {
23098 self->private_data.s_decode_image_config[0].scratch = (self->private_impl.f_bitmap_info_len - 40);
23100 if (self->private_data.s_decode_image_config[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
23101 self->private_data.s_decode_image_config[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
23106 iop_a_src += self->private_data.s_decode_image_config[0].scratch;
23112 if (self->private_impl.f_compression != 3) {
23113 if (self->private_impl.f_bits_per_pixel < 16) {
23118 status = wuffs_bmp__decoder__read_palette(self, a_src);
23127 if (self->private_impl.f_compression == 0) {
23128 if ((self->private_impl.f_bits_per_pixel == 1) || (self->private_impl.f_bits_per_pixel == 2) || (self->private_impl.f_bits_per_pixel == 4)) {
23129 self->private_impl.f_src_pixfmt = 2198077448;
23130 self->private_impl.f_compression = 256;
23131 } else if (self->private_impl.f_bits_per_pixel == 8) {
23132 self->private_impl.f_src_pixfmt = 2198077448;
23133 } else if (self->private_impl.f_bits_per_pixel == 16) {
23134 self->private_impl.f_compression = 3;
23135 self->private_impl.f_channel_masks[0] = 31;
23136 self->private_impl.f_channel_masks[1] = 992;
23137 self->private_impl.f_channel_masks[2] = 31744;
23138 self->private_impl.f_channel_masks[3] = 0;
23140 status = wuffs_bmp__decoder__process_masks(self);
23144 self->private_impl.f_src_pixfmt = 2164308923;
23145 } else if (self->private_impl.f_bits_per_pixel == 24) {
23146 self->private_impl.f_src_pixfmt = 2147485832;
23147 } else if (self->private_impl.f_bits_per_pixel == 32) {
23148 if (self->private_impl.f_channel_masks[3] == 0) {
23149 self->private_impl.f_src_pixfmt = 2415954056;
23151 self->private_impl.f_src_pixfmt = 2164295816;
23157 } else if (self->private_impl.f_compression == 1) {
23158 if (self->private_impl.f_bits_per_pixel == 8) {
23159 self->private_impl.f_src_pixfmt = 2198077448;
23164 } else if (self->private_impl.f_compression == 2) {
23165 if (self->private_impl.f_bits_per_pixel == 4) {
23166 self->private_impl.f_src_pixfmt = 2198077448;
23171 } else if (self->private_impl.f_compression == 3) {
23172 if ((self->private_impl.f_bits_per_pixel == 16) || (self->private_impl.f_bits_per_pixel == 32)) {
23173 self->private_impl.f_src_pixfmt = 2164308923;
23182 if (((self->private_impl.f_bitmap_info_len < 40) || (self->private_impl.f_bitmap_info_len == 64)) &&
23183 (self->private_impl.f_bits_per_pixel != 1) &&
23184 (self->private_impl.f_bits_per_pixel != 4) &&
23185 (self->private_impl.f_bits_per_pixel != 8) &&
23186 (self->private_impl.f_bits_per_pixel != 24)) {
23190 if (self->private_impl.f_bits_per_pixel == 1) {
23191 v_byte_width = ((self->private_impl.f_width >> 3) + (((self->private_impl.f_width & 7) + 7) >> 3));
23192 self->private_impl.f_pad_per_row = ((4 - (v_byte_width & 3)) & 3);
23193 } else if (self->private_impl.f_bits_per_pixel == 2) {
23194 v_byte_width = ((self->private_impl.f_width >> 2) + (((self->private_impl.f_width & 3) + 3) >> 2));
23195 self->private_impl.f_pad_per_row = ((4 - (v_byte_width & 3)) & 3);
23196 } else if (self->private_impl.f_bits_per_pixel == 4) {
23197 v_byte_width = ((self->private_impl.f_width >> 1) + (self->private_impl.f_width & 1));
23198 self->private_impl.f_pad_per_row = ((4 - (v_byte_width & 3)) & 3);
23199 } else if (self->private_impl.f_bits_per_pixel == 8) {
23200 self->private_impl.f_pad_per_row = ((4 - (self->private_impl.f_width & 3)) & 3);
23201 } else if (self->private_impl.f_bits_per_pixel == 16) {
23202 self->private_impl.f_pad_per_row = ((self->private_impl.f_width & 1) * 2);
23203 } else if (self->private_impl.f_bits_per_pixel == 24) {
23204 self->private_impl.f_pad_per_row = (self->private_impl.f_width & 3);
23205 } else if (self->private_impl.f_bits_per_pixel == 32) {
23206 self->private_impl.f_pad_per_row = 0;
23208 self->private_impl.f_frame_config_io_position = wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)));
23211 if ((self->private_impl.f_channel_num_bits[0] > 8) ||
23212 (self->private_impl.f_channel_num_bits[1] > 8) ||
23213 (self->private_impl.f_channel_num_bits[2] > 8) ||
23214 (self->private_impl.f_channel_num_bits[3] > 8)) {
23221 self->private_impl.f_width,
23222 self->private_impl.f_height,
23223 self->private_impl.f_frame_config_io_position,
23224 (self->private_impl.f_channel_masks[3] == 0));
23226 self->private_impl.f_call_sequence = 3;
23229 self->private_impl.p_decode_image_config[0] = 0;
23235 self->private_impl.p_decode_image_config[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
23236 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
23245 self->private_impl.magic = WUFFS_BASE__DISABLED;
23254 wuffs_bmp__decoder* self,
23257 if (!self) {
23260 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
23262 (self->private_impl.magic == WUFFS_BASE__DISABLED)
23267 self->private_impl.magic = WUFFS_BASE__DISABLED;
23270 if ((self->private_impl.active_coroutine != 0) &&
23271 (self->private_impl.active_coroutine != 2)) {
23272 self->private_impl.magic = WUFFS_BASE__DISABLED;
23275 self->private_impl.active_coroutine = 0;
23289 uint32_t coro_susp_point = self->private_impl.p_decode_frame_config[0];
23293 if (self->private_impl.f_call_sequence < 3) {
23298 status = wuffs_bmp__decoder__decode_image_config(self, NULL, a_src);
23305 } else if (self->private_impl.f_call_sequence == 3) {
23306 if (self->private_impl.f_frame_config_io_position != wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)))) {
23310 } else if (self->private_impl.f_call_sequence == 4) {
23311 self->private_impl.f_call_sequence = 255;
23324 self->private_impl.f_width,
23325 self->private_impl.f_height),
23328 self->private_impl.f_frame_config_io_position,
23334 self->private_impl.f_call_sequence = 4;
23337 self->private_impl.p_decode_frame_config[0] = 0;
23343 self->private_impl.p_decode_frame_config[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
23344 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 2 : 0;
23353 self->private_impl.magic = WUFFS_BASE__DISABLED;
23362 wuffs_bmp__decoder* self,
23368 if (!self) {
23371 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
23373 (self->private_impl.magic == WUFFS_BASE__DISABLED)
23378 self->private_impl.magic = WUFFS_BASE__DISABLED;
23381 if ((self->private_impl.active_coroutine != 0) &&
23382 (self->private_impl.active_coroutine != 3)) {
23383 self->private_impl.magic = WUFFS_BASE__DISABLED;
23386 self->private_impl.active_coroutine = 0;
23402 uint32_t coro_susp_point = self->private_impl.p_decode_frame[0];
23404 v_status = self->private_data.s_decode_frame[0].v_status;
23409 if (self->private_impl.f_call_sequence < 4) {
23414 status = wuffs_bmp__decoder__decode_frame_config(self, NULL, a_src);
23421 } else if (self->private_impl.f_call_sequence == 4) {
23426 self->private_data.s_decode_frame[0].scratch = self->private_impl.f_padding;
23428 if (self->private_data.s_decode_frame[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
23429 self->private_data.s_decode_frame[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
23434 iop_a_src += self->private_data.s_decode_frame[0].scratch;
23435 if ((self->private_impl.f_width > 0) && (self->private_impl.f_height > 0)) {
23436 self->private_impl.f_dst_x = 0;
23437 if (self->private_impl.f_top_down) {
23438 self->private_impl.f_dst_y = 0;
23439 self->private_impl.f_dst_y_inc = 1;
23441 self->private_impl.f_dst_y = ((uint32_t)(self->private_impl.f_height - 1));
23442 self->private_impl.f_dst_y_inc = 4294967295;
23444 v_status = wuffs_base__pixel_swizzler__prepare(&self->private_impl.f_swizzler,
23446 wuffs_base__pixel_buffer__palette_or_else(a_dst, wuffs_base__make_slice_u8((self->private_data.f_scratch) + 1024, 1024)),
23447 wuffs_base__utility__make_pixel_format(self->private_impl.f_src_pixfmt),
23448 wuffs_base__make_slice_u8(self->private_data.f_src_palette, 1024),
23461 if (self->private_impl.f_compression == 0) {
23465 v_status = wuffs_bmp__decoder__swizzle_none(self, a_dst, a_src);
23469 } else if (self->private_impl.f_compression < 3) {
23473 v_status = wuffs_bmp__decoder__swizzle_rle(self, a_dst, a_src);
23477 } else if (self->private_impl.f_compression == 3) {
23481 v_status = wuffs_bmp__decoder__swizzle_bitfields(self, a_dst, a_src);
23489 v_status = wuffs_bmp__decoder__swizzle_low_bit_depth(self, a_dst, a_src);
23510 self->private_data.s_decode_frame[0].scratch = self->private_impl.f_pending_pad;
23512 if (self->private_data.s_decode_frame[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
23513 self->private_data.s_decode_frame[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
23518 iop_a_src += self->private_data.s_decode_frame[0].scratch;
23519 self->private_impl.f_pending_pad = 0;
23521 self->private_impl.f_call_sequence = 255;
23524 self->private_impl.p_decode_frame[0] = 0;
23530 self->private_impl.p_decode_frame[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
23531 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 3 : 0;
23532 self->private_data.s_decode_frame[0].v_status = v_status;
23541 self->private_impl.magic = WUFFS_BASE__DISABLED;
23550 wuffs_bmp__decoder* self,
23583 v_dst_bytes_per_row = (((uint64_t)(self->private_impl.f_width)) * v_dst_bytes_per_pixel);
23584 v_dst_palette = wuffs_base__pixel_buffer__palette_or_else(a_dst, wuffs_base__make_slice_u8((self->private_data.f_scratch) + 1024, 1024));
23588 while (self->private_impl.f_pending_pad > 0) {
23593 self->private_impl.f_pending_pad -= 1;
23598 if (self->private_impl.f_dst_x == self->private_impl.f_width) {
23599 self->private_impl.f_dst_x = 0;
23600 self->private_impl.f_dst_y += self->private_impl.f_dst_y_inc;
23601 if (self->private_impl.f_dst_y >= self->private_impl.f_height) {
23602 if (self->private_impl.f_height > 0) {
23603 self->private_impl.f_pending_pad = self->private_impl.f_pad_per_row;
23606 } else if (self->private_impl.f_pad_per_row != 0) {
23607 self->private_impl.f_pending_pad = self->private_impl.f_pad_per_row;
23611 v_dst = wuffs_base__table_u8__row_u32(v_tab, self->private_impl.f_dst_y);
23615 v_i = (((uint64_t)(self->private_impl.f_dst_x)) * v_dst_bytes_per_pixel);
23620 &self->private_impl.f_swizzler,
23629 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_x, ((uint32_t)((v_n & 4294967295))));
23650 wuffs_bmp__decoder* self,
23690 v_dst_bytes_per_row = (((uint64_t)(self->private_impl.f_width)) * v_dst_bytes_per_pixel);
23691 v_dst_palette = wuffs_base__pixel_buffer__palette_or_else(a_dst, wuffs_base__make_slice_u8((self->private_data.f_scratch) + 1024, 1024));
23693 v_rle_state = self->private_impl.f_rle_state;
23696 v_row = wuffs_base__table_u8__row_u32(v_tab, self->private_impl.f_dst_y);
23702 v_i = (((uint64_t)(self->private_impl.f_dst_x)) * v_dst_bytes_per_pixel);
23721 self->private_impl.f_rle_length = ((uint32_t)(v_code));
23730 if (self->private_impl.f_bits_per_pixel == 8) {
23732 while (v_p0 < self->private_impl.f_rle_length) {
23733 self->private_data.f_scratch[v_p0] = v_code;
23740 while (v_p0 < self->private_impl.f_rle_length) {
23741 self->private_data.f_scratch[(v_p0 + 0)] = v_indexes[0];
23742 self->private_data.f_scratch[(v_p0 + 1)] = v_indexes[1];
23746 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, v_dst, v_dst_palette, wuffs_base__slice_u8__subslice_j(wuffs_base__make_slice_u8(self->private_data.f_scratch, 2048), self->private_impl.f_rle_length));
23747 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_x, self->private_impl.f_rle_length);
23757 if ((self->private_impl.f_dst_y >= self->private_impl.f_height) && (v_code == 0)) {
23761 wuffs_base__pixel_swizzler__swizzle_interleaved_transparent_black(&self->private_impl.f_swizzler, v_dst, v_dst_palette, 18446744073709551615u);
23762 self->private_impl.f_dst_x = 0;
23763 self->private_impl.f_dst_y += self->private_impl.f_dst_y_inc;
23773 self->private_impl.f_rle_length = ((uint32_t)(v_code));
23774 self->private_impl.f_rle_padded = ((self->private_impl.f_bits_per_pixel == 8) && ((v_code & 1) != 0));
23778 if (self->private_impl.f_bits_per_pixel == 8) {
23780 &self->private_impl.f_swizzler,
23781 self->private_impl.f_rle_length,
23786 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_x, ((uint32_t)((v_n & 4294967295))));
23787 wuffs_base__u32__sat_sub_indirect(&self->private_impl.f_rle_length, ((uint32_t)((v_n & 4294967295))));
23789 v_chunk_count = ((self->private_impl.f_rle_length + 3) / 4);
23794 self->private_data.f_scratch[(v_p0 + 0)] = ((uint8_t)((15 & (v_chunk_bits >> 12))));
23795 self->private_data.f_scratch[(v_p0 + 1)] = ((uint8_t)((15 & (v_chunk_bits >> 8))));
23796 self->private_data.f_scratch[(v_p0 + 2)] = ((uint8_t)((15 & (v_chunk_bits >> 4))));
23797 self->private_data.f_scratch[(v_p0 + 3)] = ((uint8_t)((15 & (v_chunk_bits >> 0))));
23801 v_p0 = wuffs_base__u32__min(v_p0, self->private_impl.f_rle_length);
23802 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, v_dst, v_dst_palette, wuffs_base__slice_u8__subslice_j(wuffs_base__make_slice_u8(self->private_data.f_scratch, 2048), v_p0));
23803 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_x, v_p0);
23804 wuffs_base__u32__sat_sub_indirect(&self->private_impl.f_rle_length, v_p0);
23806 if (self->private_impl.f_rle_length > 0) {
23809 if (self->private_impl.f_rle_padded) {
23814 self->private_impl.f_rle_padded = false;
23822 self->private_impl.f_rle_delta_x = wuffs_base__peek_u8be__no_bounds_check(iop_a_src);
23832 if (self->private_impl.f_rle_delta_x > 0) {
23833 wuffs_base__pixel_swizzler__swizzle_interleaved_transparent_black(&self->private_impl.f_swizzler, v_dst, v_dst_palette, ((uint64_t)(self->private_impl.f_rle_delta_x)));
23834 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_x, ((uint32_t)(self->private_impl.f_rle_delta_x)));
23835 self->private_impl.f_rle_delta_x = 0;
23836 if (self->private_impl.f_dst_x > self->private_impl.f_width) {
23851 self->private_impl.f_dst_y += self->private_impl.f_dst_y_inc;
23852 if (self->private_impl.f_dst_y >= self->private_impl.f_height) {
23856 v_row = wuffs_base__table_u8__row_u32(v_tab, self->private_impl.f_dst_y);
23861 wuffs_base__pixel_swizzler__swizzle_interleaved_transparent_black(&self->private_impl.f_swizzler, v_row, v_dst_palette, ((uint64_t)(self->private_impl.f_dst_x)));
23864 wuffs_base__pixel_swizzler__swizzle_interleaved_transparent_black(&self->private_impl.f_swizzler, v_row, v_dst_palette, 18446744073709551615u);
23881 self->private_impl.f_rle_state = v_rle_state;
23887 while (self->private_impl.f_dst_y < self->private_impl.f_height) {
23888 v_row = wuffs_base__table_u8__row_u32(v_tab, self->private_impl.f_dst_y);
23892 wuffs_base__pixel_swizzler__swizzle_interleaved_transparent_black(&self->private_impl.f_swizzler, v_row, v_dst_palette, 18446744073709551615u);
23893 self->private_impl.f_dst_y += self->private_impl.f_dst_y_inc;
23912 wuffs_bmp__decoder* self,
23952 v_dst_bytes_per_row = (((uint64_t)(self->private_impl.f_width)) * v_dst_bytes_per_pixel);
23953 v_dst_palette = wuffs_base__pixel_buffer__palette_or_else(a_dst, wuffs_base__make_slice_u8((self->private_data.f_scratch) + 1024, 1024));
23957 while (self->private_impl.f_pending_pad > 0) {
23962 self->private_impl.f_pending_pad -= 1;
23967 if (self->private_impl.f_dst_x == self->private_impl.f_width) {
23968 self->private_impl.f_dst_x = 0;
23969 self->private_impl.f_dst_y += self->private_impl.f_dst_y_inc;
23970 if (self->private_impl.f_dst_y >= self->private_impl.f_height) {
23971 if (self->private_impl.f_height > 0) {
23972 self->private_impl.f_pending_pad = self->private_impl.f_pad_per_row;
23975 } else if (self->private_impl.f_pad_per_row != 0) {
23976 self->private_impl.f_pending_pad = self->private_impl.f_pad_per_row;
23980 v_p1_temp = ((uint32_t)(self->private_impl.f_width - self->private_impl.f_dst_x));
23984 if (self->private_impl.f_bits_per_pixel == 16) {
23999 if (self->private_impl.f_channel_num_bits[v_channel] == 0) {
24000 self->private_data.f_scratch[((8 * v_p0) + (2 * v_channel) + 0)] = 255;
24001 self->private_data.f_scratch[((8 * v_p0) + (2 * v_channel) + 1)] = 255;
24003 v_c = ((v_c32 & self->private_impl.f_channel_masks[v_channel]) >> self->private_impl.f_channel_shifts[v_channel]);
24004 v_num_bits = ((uint32_t)(self->private_impl.f_channel_num_bits[v_channel]));
24010 self->private_data.f_scratch[((8 * v_p0) + (2 * v_channel) + 0)] = ((uint8_t)((255 & (v_c >> 0))));
24011 self->private_data.f_scratch[((8 * v_p0) + (2 * v_channel) + 1)] = ((uint8_t)((255 & (v_c >> 8))));
24018 v_dst = wuffs_base__table_u8__row_u32(v_tab, self->private_impl.f_dst_y);
24022 v_i = (((uint64_t)(self->private_impl.f_dst_x)) * v_dst_bytes_per_pixel);
24026 v_n = wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, wuffs_base__slice_u8__subslice_i(v_dst, v_i), v_dst_palette, wuffs_base__slice_u8__subslice_j(wuffs_base__make_slice_u8(self->private_data.f_scratch, 2048), (8 * v_p0)));
24031 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_x, ((uint32_t)((v_n & 4294967295))));
24052 wuffs_bmp__decoder* self,
24088 v_dst_bytes_per_row = (((uint64_t)(self->private_impl.f_width)) * v_dst_bytes_per_pixel);
24089 v_dst_palette = wuffs_base__pixel_buffer__palette_or_else(a_dst, wuffs_base__make_slice_u8((self->private_data.f_scratch) + 1024, 1024));
24093 if (self->private_impl.f_dst_x == self->private_impl.f_width) {
24094 self->private_impl.f_dst_x = 0;
24095 self->private_impl.f_dst_y += self->private_impl.f_dst_y_inc;
24096 if (self->private_impl.f_dst_y >= self->private_impl.f_height) {
24100 v_dst = wuffs_base__table_u8__row_u32(v_tab, self->private_impl.f_dst_y);
24104 v_i = (((uint64_t)(self->private_impl.f_dst_x)) * v_dst_bytes_per_pixel);
24110 if (self->private_impl.f_bits_per_pixel == 1) {
24111 v_chunk_count = ((wuffs_base__u32__sat_sub(self->private_impl.f_width, self->private_impl.f_dst_x) + 31) / 32);
24116 self->private_data.f_scratch[(v_p0 + 0)] = ((uint8_t)((1 & (v_chunk_bits >> 31))));
24117 self->private_data.f_scratch[(v_p0 + 1)] = ((uint8_t)((1 & (v_chunk_bits >> 30))));
24118 self->private_data.f_scratch[(v_p0 + 2)] = ((uint8_t)((1 & (v_chunk_bits >> 29))));
24119 self->private_data.f_scratch[(v_p0 + 3)] = ((uint8_t)((1 & (v_chunk_bits >> 28))));
24120 self->private_data.f_scratch[(v_p0 + 4)] = ((uint8_t)((1 & (v_chunk_bits >> 27))));
24121 self->private_data.f_scratch[(v_p0 + 5)] = ((uint8_t)((1 & (v_chunk_bits >> 26))));
24122 self->private_data.f_scratch[(v_p0 + 6)] = ((uint8_t)((1 & (v_chunk_bits >> 25))));
24123 self->private_data.f_scratch[(v_p0 + 7)] = ((uint8_t)((1 & (v_chunk_bits >> 24))));
24124 self->private_data.f_scratch[(v_p0 + 8)] = ((uint8_t)((1 & (v_chunk_bits >> 23))));
24125 self->private_data.f_scratch[(v_p0 + 9)] = ((uint8_t)((1 & (v_chunk_bits >> 22))));
24126 self->private_data.f_scratch[(v_p0 + 10)] = ((uint8_t)((1 & (v_chunk_bits >> 21))));
24127 self->private_data.f_scratch[(v_p0 + 11)] = ((uint8_t)((1 & (v_chunk_bits >> 20))));
24128 self->private_data.f_scratch[(v_p0 + 12)] = ((uint8_t)((1 & (v_chunk_bits >> 19))));
24129 self->private_data.f_scratch[(v_p0 + 13)] = ((uint8_t)((1 & (v_chunk_bits >> 18))));
24130 self->private_data.f_scratch[(v_p0 + 14)] = ((uint8_t)((1 & (v_chunk_bits >> 17))));
24131 self->private_data.f_scratch[(v_p0 + 15)] = ((uint8_t)((1 & (v_chunk_bits >> 16))));
24132 self->private_data.f_scratch[(v_p0 + 16)] = ((uint8_t)((1 & (v_chunk_bits >> 15))));
24133 self->private_data.f_scratch[(v_p0 + 17)] = ((uint8_t)((1 & (v_chunk_bits >> 14))));
24134 self->private_data.f_scratch[(v_p0 + 18)] = ((uint8_t)((1 & (v_chunk_bits >> 13))));
24135 self->private_data.f_scratch[(v_p0 + 19)] = ((uint8_t)((1 & (v_chunk_bits >> 12))));
24136 self->private_data.f_scratch[(v_p0 + 20)] = ((uint8_t)((1 & (v_chunk_bits >> 11))));
24137 self->private_data.f_scratch[(v_p0 + 21)] = ((uint8_t)((1 & (v_chunk_bits >> 10))));
24138 self->private_data.f_scratch[(v_p0 + 22)] = ((uint8_t)((1 & (v_chunk_bits >> 9))));
24139 self->private_data.f_scratch[(v_p0 + 23)] = ((uint8_t)((1 & (v_chunk_bits >> 8))));
24140 self->private_data.f_scratch[(v_p0 + 24)] = ((uint8_t)((1 & (v_chunk_bits >> 7))));
24141 self->private_data.f_scratch[(v_p0 + 25)] = ((uint8_t)((1 & (v_chunk_bits >> 6))));
24142 self->private_data.f_scratch[(v_p0 + 26)] = ((uint8_t)((1 & (v_chunk_bits >> 5))));
24143 self->private_data.f_scratch[(v_p0 + 27)] = ((uint8_t)((1 & (v_chunk_bits >> 4))));
24144 self->private_data.f_scratch[(v_p0 + 28)] = ((uint8_t)((1 & (v_chunk_bits >> 3))));
24145 self->private_data.f_scratch[(v_p0 + 29)] = ((uint8_t)((1 & (v_chunk_bits >> 2))));
24146 self->private_data.f_scratch[(v_p0 + 30)] = ((uint8_t)((1 & (v_chunk_bits >> 1))));
24147 self->private_data.f_scratch[(v_p0 + 31)] = ((uint8_t)((1 & (v_chunk_bits >> 0))));
24151 } else if (self->private_impl.f_bits_per_pixel == 2) {
24152 v_chunk_count = ((wuffs_base__u32__sat_sub(self->private_impl.f_width, self->private_impl.f_dst_x) + 15) / 16);
24157 self->private_data.f_scratch[(v_p0 + 0)] = ((uint8_t)((3 & (v_chunk_bits >> 30))));
24158 self->private_data.f_scratch[(v_p0 + 1)] = ((uint8_t)((3 & (v_chunk_bits >> 28))));
24159 self->private_data.f_scratch[(v_p0 + 2)] = ((uint8_t)((3 & (v_chunk_bits >> 26))));
24160 self->private_data.f_scratch[(v_p0 + 3)] = ((uint8_t)((3 & (v_chunk_bits >> 24))));
24161 self->private_data.f_scratch[(v_p0 + 4)] = ((uint8_t)((3 & (v_chunk_bits >> 22))));
24162 self->private_data.f_scratch[(v_p0 + 5)] = ((uint8_t)((3 & (v_chunk_bits >> 20))));
24163 self->private_data.f_scratch[(v_p0 + 6)] = ((uint8_t)((3 & (v_chunk_bits >> 18))));
24164 self->private_data.f_scratch[(v_p0 + 7)] = ((uint8_t)((3 & (v_chunk_bits >> 16))));
24165 self->private_data.f_scratch[(v_p0 + 8)] = ((uint8_t)((3 & (v_chunk_bits >> 14))));
24166 self->private_data.f_scratch[(v_p0 + 9)] = ((uint8_t)((3 & (v_chunk_bits >> 12))));
24167 self->private_data.f_scratch[(v_p0 + 10)] = ((uint8_t)((3 & (v_chunk_bits >> 10))));
24168 self->private_data.f_scratch[(v_p0 + 11)] = ((uint8_t)((3 & (v_chunk_bits >> 8))));
24169 self->private_data.f_scratch[(v_p0 + 12)] = ((uint8_t)((3 & (v_chunk_bits >> 6))));
24170 self->private_data.f_scratch[(v_p0 + 13)] = ((uint8_t)((3 & (v_chunk_bits >> 4))));
24171 self->private_data.f_scratch[(v_p0 + 14)] = ((uint8_t)((3 & (v_chunk_bits >> 2))));
24172 self->private_data.f_scratch[(v_p0 + 15)] = ((uint8_t)((3 & (v_chunk_bits >> 0))));
24176 } else if (self->private_impl.f_bits_per_pixel == 4) {
24177 v_chunk_count = ((wuffs_base__u32__sat_sub(self->private_impl.f_width, self->private_impl.f_dst_x) + 7) / 8);
24182 self->private_data.f_scratch[(v_p0 + 0)] = ((uint8_t)((15 & (v_chunk_bits >> 28))));
24183 self->private_data.f_scratch[(v_p0 + 1)] = ((uint8_t)((15 & (v_chunk_bits >> 24))));
24184 self->private_data.f_scratch[(v_p0 + 2)] = ((uint8_t)((15 & (v_chunk_bits >> 20))));
24185 self->private_data.f_scratch[(v_p0 + 3)] = ((uint8_t)((15 & (v_chunk_bits >> 16))));
24186 self->private_data.f_scratch[(v_p0 + 4)] = ((uint8_t)((15 & (v_chunk_bits >> 12))));
24187 self->private_data.f_scratch[(v_p0 + 5)] = ((uint8_t)((15 & (v_chunk_bits >> 8))));
24188 self->private_data.f_scratch[(v_p0 + 6)] = ((uint8_t)((15 & (v_chunk_bits >> 4))));
24189 self->private_data.f_scratch[(v_p0 + 7)] = ((uint8_t)((15 & (v_chunk_bits >> 0))));
24194 v_p0 = wuffs_base__u32__min(v_p0, wuffs_base__u32__sat_sub(self->private_impl.f_width, self->private_impl.f_dst_x));
24195 v_n = wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, v_dst, v_dst_palette, wuffs_base__slice_u8__subslice_j(wuffs_base__make_slice_u8(self->private_data.f_scratch, 2048), v_p0));
24200 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_x, ((uint32_t)((v_n & 4294967295))));
24220 const wuffs_bmp__decoder* self) {
24221 if (!self) {
24224 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
24225 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
24232 self->private_impl.f_width,
24233 self->private_impl.f_height);
24240 const wuffs_bmp__decoder* self) {
24241 if (!self) {
24244 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
24245 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
24256 const wuffs_bmp__decoder* self) {
24257 if (!self) {
24260 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
24261 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
24265 if (self->private_impl.f_call_sequence > 3) {
24275 const wuffs_bmp__decoder* self) {
24276 if (!self) {
24279 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
24280 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
24284 if (self->private_impl.f_call_sequence > 4) {
24294 wuffs_bmp__decoder* self,
24297 if (!self) {
24300 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
24302 (self->private_impl.magic == WUFFS_BASE__DISABLED)
24307 if (self->private_impl.f_call_sequence < 3) {
24313 self->private_impl.f_call_sequence = 3;
24314 self->private_impl.f_frame_config_io_position = a_io_position;
24322 wuffs_bmp__decoder* self,
24332 wuffs_bmp__decoder* self,
24336 if (!self) {
24339 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
24341 (self->private_impl.magic == WUFFS_BASE__DISABLED)
24346 self->private_impl.magic = WUFFS_BASE__DISABLED;
24349 if ((self->private_impl.active_coroutine != 0) &&
24350 (self->private_impl.active_coroutine != 4)) {
24351 self->private_impl.magic = WUFFS_BASE__DISABLED;
24354 self->private_impl.active_coroutine = 0;
24357 if (self->private_impl.f_io_redirect_fourcc <= 1) {
24364 self->private_impl.f_io_redirect_fourcc,
24366 self->private_impl.f_io_redirect_pos,
24369 self->private_impl.f_io_redirect_fourcc = 1;
24376 self->private_impl.magic = WUFFS_BASE__DISABLED;
24385 const wuffs_bmp__decoder* self) {
24386 if (!self) {
24389 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
24390 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
24401 wuffs_bmp__decoder* self,
24419 uint32_t coro_susp_point = self->private_impl.p_read_palette[0];
24421 v_i = self->private_data.s_read_palette[0].v_i;
24426 if (self->private_impl.f_bitmap_info_len == 12) {
24427 while ((v_i < 256) && (self->private_impl.f_padding >= 3)) {
24428 self->private_impl.f_padding -= 3;
24436 self->private_data.s_read_palette[0].scratch = 0;
24443 uint64_t* scratch = &self->private_data.s_read_palette[0].scratch;
24459 self->private_data.f_src_palette[((4 * v_i) + 0)] = ((uint8_t)(((v_argb >> 0) & 255)));
24460 self->private_data.f_src_palette[((4 * v_i) + 1)] = ((uint8_t)(((v_argb >> 8) & 255)));
24461 self->private_data.f_src_palette[((4 * v_i) + 2)] = ((uint8_t)(((v_argb >> 16) & 255)));
24462 self->private_data.f_src_palette[((4 * v_i) + 3)] = ((uint8_t)(((v_argb >> 24) & 255)));
24466 while ((v_i < 256) && (self->private_impl.f_padding >= 4)) {
24467 self->private_impl.f_padding -= 4;
24475 self->private_data.s_read_palette[0].scratch = 0;
24482 uint64_t* scratch = &self->private_data.s_read_palette[0].scratch;
24498 self->private_data.f_src_palette[((4 * v_i) + 0)] = ((uint8_t)(((v_argb >> 0) & 255)));
24499 self->private_data.f_src_palette[((4 * v_i) + 1)] = ((uint8_t)(((v_argb >> 8) & 255)));
24500 self->private_data.f_src_palette[((4 * v_i) + 2)] = ((uint8_t)(((v_argb >> 16) & 255)));
24501 self->private_data.f_src_palette[((4 * v_i) + 3)] = ((uint8_t)(((v_argb >> 24) & 255)));
24506 self->private_data.f_src_palette[((4 * v_i) + 0)] = 0;
24507 self->private_data.f_src_palette[((4 * v_i) + 1)] = 0;
24508 self->private_data.f_src_palette[((4 * v_i) + 2)] = 0;
24509 self->private_data.f_src_palette[((4 * v_i) + 3)] = 255;
24515 self->private_impl.p_read_palette[0] = 0;
24521 self->private_impl.p_read_palette[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
24522 self->private_data.s_read_palette[0].v_i = v_i;
24537 wuffs_bmp__decoder* self) {
24545 v_mask = self->private_impl.f_channel_masks[v_i];
24552 self->private_impl.f_channel_shifts[v_i] = ((uint8_t)((v_n & 31)));
24562 self->private_impl.f_channel_num_bits[v_i] = ((uint8_t)(v_n));
24625 wuffs_cbor__decoder* self,
24629 if (!self) {
24632 if (sizeof(*self) != sizeof_star_self) {
24641 // The whole point of this if-check is to detect an uninitialized *self.
24647 if (self->private_impl.magic != 0) {
24655 memset(self, 0, sizeof(*self));
24658 memset(&(self->private_impl), 0, sizeof(self->private_impl));
24662 self->private_impl.magic = WUFFS_BASE__MAGIC;
24663 self->private_impl.vtable_for__wuffs_base__token_decoder.vtable_name =
24665 self->private_impl.vtable_for__wuffs_base__token_decoder.function_pointers =
24696 wuffs_cbor__decoder* self,
24706 const wuffs_cbor__decoder* self) {
24707 if (!self) {
24710 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
24711 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
24722 wuffs_cbor__decoder* self,
24726 if (!self) {
24729 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
24731 (self->private_impl.magic == WUFFS_BASE__DISABLED)
24736 self->private_impl.magic = WUFFS_BASE__DISABLED;
24739 if ((self->private_impl.active_coroutine != 0) &&
24740 (self->private_impl.active_coroutine != 1)) {
24741 self->private_impl.magic = WUFFS_BASE__DISABLED;
24744 self->private_impl.active_coroutine = 0;
24787 uint32_t coro_susp_point = self->private_impl.p_decode_tokens[0];
24789 v_string_length = self->private_data.s_decode_tokens[0].v_string_length;
24790 v_depth = self->private_data.s_decode_tokens[0].v_depth;
24791 v_token_length = self->private_data.s_decode_tokens[0].v_token_length;
24792 v_tagged = self->private_data.s_decode_tokens[0].v_tagged;
24793 v_indefinite_string_major_type = self->private_data.s_decode_tokens[0].v_indefinite_string_major_type;
24798 if (self->private_impl.f_end_of_data) {
25077 if (0 == (self->private_data.f_stack[v_stack_byte] & (((uint32_t)(1)) << v_stack_bit))) {
25096 self->private_data.f_stack[v_stack_byte] &= (4294967295 ^ (((uint32_t)(3)) << v_stack_bit));
25097 self->private_data.f_container_num_remaining[v_depth] = v_string_length;
25118 if (0 == (self->private_data.f_stack[v_stack_byte] & (((uint32_t)(1)) << v_stack_bit))) {
25137 self->private_data.f_stack[v_stack_byte] |= (((uint32_t)(3)) << v_stack_bit);
25138 self->private_data.f_container_num_remaining[v_depth] = v_string_length;
25199 if (self->private_data.f_container_num_remaining[v_depth] != 0) {
25204 v_stack_val = (3 & (self->private_data.f_stack[v_stack_byte] >> v_stack_bit));
25218 if (0 == (self->private_data.f_stack[v_stack_byte] & (((uint32_t)(1)) << v_stack_bit))) {
25246 self->private_data.f_stack[v_stack_byte] ^= (((uint32_t)(1)) << (v_stack_bit + 1));
25247 if (1 == (3 & (self->private_data.f_stack[v_stack_byte] >> v_stack_bit))) {
25250 if (self->private_data.f_container_num_remaining[(v_depth - 1)] <= 0) {
25253 self->private_data.f_container_num_remaining[(v_depth - 1)] -= 1;
25254 if (self->private_data.f_container_num_remaining[(v_depth - 1)] > 0) {
25266 if (0 == (self->private_data.f_stack[v_stack_byte] & (((uint32_t)(1)) << v_stack_bit))) {
25276 if (0 == (self->private_data.f_stack[v_stack_byte] & (((uint32_t)(1)) << v_stack_bit))) {
25289 self->private_impl.f_end_of_data = true;
25292 self->private_impl.p_decode_tokens[0] = 0;
25298 self->private_impl.p_decode_tokens[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
25299 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
25300 self->private_data.s_decode_tokens[0].v_string_length = v_string_length;
25301 self->private_data.s_decode_tokens[0].v_depth = v_depth;
25302 self->private_data.s_decode_tokens[0].v_token_length = v_token_length;
25303 self->private_data.s_decode_tokens[0].v_tagged = v_tagged;
25304 self->private_data.s_decode_tokens[0].v_indefinite_string_major_type = v_indefinite_string_major_type;
25316 self->private_impl.magic = WUFFS_BASE__DISABLED;
25893 wuffs_crc32__ieee_hasher* self,
25898 wuffs_crc32__ieee_hasher* self,
25904 wuffs_crc32__ieee_hasher* self,
25911 wuffs_crc32__ieee_hasher* self,
25918 wuffs_crc32__ieee_hasher* self,
25937 wuffs_crc32__ieee_hasher* self,
25941 if (!self) {
25944 if (sizeof(*self) != sizeof_star_self) {
25953 // The whole point of this if-check is to detect an uninitialized *self.
25959 if (self->private_impl.magic != 0) {
25967 memset(self, 0, sizeof(*self));
25970 memset(&(self->private_impl), 0, sizeof(self->private_impl));
25974 self->private_impl.choosy_up = &wuffs_crc32__ieee_hasher__up__choosy_default;
25976 self->private_impl.magic = WUFFS_BASE__MAGIC;
25977 self->private_impl.vtable_for__wuffs_base__hasher_u32.vtable_name =
25979 self->private_impl.vtable_for__wuffs_base__hasher_u32.function_pointers =
26010 wuffs_crc32__ieee_hasher* self,
26020 wuffs_crc32__ieee_hasher* self,
26022 if (!self) {
26025 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
26029 if (self->private_impl.f_state == 0) {
26030 self->private_impl.choosy_up = (
26040 self->private_impl.choosy_up);
26042 wuffs_crc32__ieee_hasher__up(self, a_x);
26043 return self->private_impl.f_state;
26050 wuffs_crc32__ieee_hasher* self,
26052 return (*self->private_impl.choosy_up)(self, a_x);
26057 wuffs_crc32__ieee_hasher* self,
26062 v_s = (4294967295 ^ self->private_impl.f_state);
26145 self->private_impl.f_state = (4294967295 ^ v_s);
26155 wuffs_crc32__ieee_hasher* self,
26160 v_s = (4294967295 ^ self->private_impl.f_state);
26218 self->private_impl.f_state = (4294967295 ^ v_s);
26231 wuffs_crc32__ieee_hasher* self,
26246 v_s = (4294967295 ^ self->private_impl.f_state);
26263 self->private_impl.f_state = (4294967295 ^ v_s);
26337 self->private_impl.f_state = (4294967295 ^ v_s);
26350 wuffs_crc32__ieee_hasher* self,
26365 v_s = (4294967295 ^ self->private_impl.f_state);
26382 self->private_impl.f_state = (4294967295 ^ v_s);
26456 self->private_impl.f_state = (4294967295 ^ v_s);
26557 wuffs_deflate__decoder* self,
26563 wuffs_deflate__decoder* self,
26569 wuffs_deflate__decoder* self);
26573 wuffs_deflate__decoder* self,
26578 wuffs_deflate__decoder* self,
26587 wuffs_deflate__decoder* self,
26594 wuffs_deflate__decoder* self,
26600 wuffs_deflate__decoder* self,
26606 wuffs_deflate__decoder* self,
26612 wuffs_deflate__decoder* self,
26634 wuffs_deflate__decoder* self,
26638 if (!self) {
26641 if (sizeof(*self) != sizeof_star_self) {
26650 // The whole point of this if-check is to detect an uninitialized *self.
26656 if (self->private_impl.magic != 0) {
26664 memset(self, 0, sizeof(*self));
26667 memset(&(self->private_impl), 0, sizeof(self->private_impl));
26671 self->private_impl.choosy_decode_huffman_fast64 = &wuffs_deflate__decoder__decode_huffman_fast64__choosy_default;
26673 self->private_impl.magic = WUFFS_BASE__MAGIC;
26674 self->private_impl.vtable_for__wuffs_base__io_transformer.vtable_name =
26676 self->private_impl.vtable_for__wuffs_base__io_transformer.function_pointers =
26707 wuffs_deflate__decoder* self,
26709 if (!self) {
26712 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
26723 wuffs_base__slice_u8__copy_from_slice(wuffs_base__make_slice_u8(self->private_data.f_history, 32768), v_s);
26724 self->private_impl.f_history_index = 32768;
26726 v_n_copied = wuffs_base__slice_u8__copy_from_slice(wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 32768), (self->private_impl.f_history_index & 32767)), v_s);
26729 v_n_copied = wuffs_base__slice_u8__copy_from_slice(wuffs_base__make_slice_u8(self->private_data.f_history, 32768), v_s);
26730 self->private_impl.f_history_index = (((uint32_t)((v_n_copied & 32767))) + 32768);
26733 if (self->private_impl.f_history_index >= 32768) {
26736 self->private_impl.f_history_index = ((self->private_impl.f_history_index & 32767) + ((uint32_t)((v_n_copied & 32767))) + v_already_full);
26739 wuffs_base__slice_u8__copy_from_slice(wuffs_base__make_slice_u8((self->private_data.f_history) + 32768, 257), wuffs_base__make_slice_u8(self->private_data.f_history, 33025));
26747 wuffs_deflate__decoder* self,
26757 const wuffs_deflate__decoder* self) {
26758 if (!self) {
26761 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
26762 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
26773 wuffs_deflate__decoder* self,
26777 if (!self) {
26780 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
26782 (self->private_impl.magic == WUFFS_BASE__DISABLED)
26787 self->private_impl.magic = WUFFS_BASE__DISABLED;
26790 if ((self->private_impl.active_coroutine != 0) &&
26791 (self->private_impl.active_coroutine != 1)) {
26792 self->private_impl.magic = WUFFS_BASE__DISABLED;
26795 self->private_impl.active_coroutine = 0;
26815 uint32_t coro_susp_point = self->private_impl.p_transform_io[0];
26819 self->private_impl.choosy_decode_huffman_fast64 = (
26823 self->private_impl.choosy_decode_huffman_fast64);
26830 wuffs_base__status t_0 = wuffs_deflate__decoder__decode_blocks(self, a_dst, a_src);
26846 wuffs_base__u64__sat_add_indirect(&self->private_impl.f_transformed_history_count, wuffs_base__io__count_since(v_mark, ((uint64_t)(iop_a_dst - io0_a_dst))));
26847 wuffs_deflate__decoder__add_history(self, wuffs_base__io__since(v_mark, ((uint64_t)(iop_a_dst - io0_a_dst)), io0_a_dst));
26853 self->private_impl.p_transform_io[0] = 0;
26859 self->private_impl.p_transform_io[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
26860 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
26869 self->private_impl.magic = WUFFS_BASE__DISABLED;
26878 wuffs_deflate__decoder* self,
26899 uint32_t coro_susp_point = self->private_impl.p_decode_blocks[0];
26901 v_final = self->private_data.s_decode_blocks[0].v_final;
26908 while (self->private_impl.f_n_bits < 3) {
26918 self->private_impl.f_bits |= (v_b0 << (self->private_impl.f_n_bits & 3));
26919 self->private_impl.f_n_bits = ((self->private_impl.f_n_bits & 3) + 8);
26921 v_final = (self->private_impl.f_bits & 1);
26922 v_type = ((self->private_impl.f_bits >> 1) & 3);
26923 self->private_impl.f_bits >>= 3;
26924 self->private_impl.f_n_bits -= 3;
26930 status = wuffs_deflate__decoder__decode_uncompressed(self, a_dst, a_src);
26939 v_status = wuffs_deflate__decoder__init_fixed_huffman(self);
26955 status = wuffs_deflate__decoder__init_dynamic_huffman(self, a_src);
26966 self->private_impl.f_end_of_block = false;
26972 v_status = wuffs_deflate__decoder__decode_huffman_fast32(self, a_dst, a_src);
26980 v_status = wuffs_deflate__decoder__decode_huffman_fast64(self, a_dst, a_src);
26989 if (self->private_impl.f_end_of_block) {
26996 status = wuffs_deflate__decoder__decode_huffman_slow(self, a_dst, a_src);
27003 if (self->private_impl.f_end_of_block) {
27010 self->private_impl.p_decode_blocks[0] = 0;
27016 self->private_impl.p_decode_blocks[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
27017 self->private_data.s_decode_blocks[0].v_final = v_final;
27032 wuffs_deflate__decoder* self,
27064 uint32_t coro_susp_point = self->private_impl.p_decode_uncompressed[0];
27066 v_length = self->private_data.s_decode_uncompressed[0].v_length;
27071 if ((self->private_impl.f_n_bits >= 8) || ((self->private_impl.f_bits >> (self->private_impl.f_n_bits & 7)) != 0)) {
27075 self->private_impl.f_n_bits = 0;
27076 self->private_impl.f_bits = 0;
27084 self->private_data.s_decode_uncompressed[0].scratch = 0;
27091 uint64_t* scratch = &self->private_data.s_decode_uncompressed[0].scratch;
27129 self->private_impl.p_decode_uncompressed[0] = 0;
27135 self->private_impl.p_decode_uncompressed[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
27136 self->private_data.s_decode_uncompressed[0].v_length = v_length;
27154 wuffs_deflate__decoder* self) {
27159 self->private_data.f_code_lengths[v_i] = 8;
27163 self->private_data.f_code_lengths[v_i] = 9;
27167 self->private_data.f_code_lengths[v_i] = 7;
27171 self->private_data.f_code_lengths[v_i] = 8;
27175 self->private_data.f_code_lengths[v_i] = 5;
27178 v_status = wuffs_deflate__decoder__init_huff(self,
27186 v_status = wuffs_deflate__decoder__init_huff(self,
27201 wuffs_deflate__decoder* self,
27234 uint32_t coro_susp_point = self->private_impl.p_init_dynamic_huffman[0];
27236 v_bits = self->private_data.s_init_dynamic_huffman[0].v_bits;
27237 v_n_bits = self->private_data.s_init_dynamic_huffman[0].v_n_bits;
27238 v_n_lit = self->private_data.s_init_dynamic_huffman[0].v_n_lit;
27239 v_n_dist = self->private_data.s_init_dynamic_huffman[0].v_n_dist;
27240 v_n_clen = self->private_data.s_init_dynamic_huffman[0].v_n_clen;
27241 v_i = self->private_data.s_init_dynamic_huffman[0].v_i;
27242 v_mask = self->private_data.s_init_dynamic_huffman[0].v_mask;
27243 v_table_entry = self->private_data.s_init_dynamic_huffman[0].v_table_entry;
27244 v_n_extra_bits = self->private_data.s_init_dynamic_huffman[0].v_n_extra_bits;
27245 v_rep_symbol = self->private_data.s_init_dynamic_huffman[0].v_rep_symbol;
27246 v_rep_count = self->private_data.s_init_dynamic_huffman[0].v_rep_count;
27251 v_bits = self->private_impl.f_bits;
27252 v_n_bits = self->private_impl.f_n_bits;
27296 self->private_data.f_code_lengths[WUFFS_DEFLATE__CODE_ORDER[v_i]] = ((uint8_t)((v_bits & 7)));
27302 self->private_data.f_code_lengths[WUFFS_DEFLATE__CODE_ORDER[v_i]] = 0;
27305 v_status = wuffs_deflate__decoder__init_huff(self,
27314 v_mask = ((((uint32_t)(1)) << self->private_impl.f_n_huffs_bits[0]) - 1);
27319 v_table_entry = self->private_data.f_huffs[0][(v_bits & v_mask)];
27345 self->private_data.f_code_lengths[v_i] = ((uint8_t)(v_table_entry));
27358 v_rep_symbol = (self->private_data.f_code_lengths[(v_i - 1)] & 15);
27393 self->private_data.f_code_lengths[v_i] = v_rep_symbol;
27402 if (self->private_data.f_code_lengths[256] == 0) {
27406 v_status = wuffs_deflate__decoder__init_huff(self,
27415 v_status = wuffs_deflate__decoder__init_huff(self,
27424 self->private_impl.f_bits = v_bits;
27425 self->private_impl.f_n_bits = v_n_bits;
27429 self->private_impl.p_init_dynamic_huffman[0] = 0;
27435 self->private_impl.p_init_dynamic_huffman[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
27436 self->private_data.s_init_dynamic_huffman[0].v_bits = v_bits;
27437 self->private_data.s_init_dynamic_huffman[0].v_n_bits = v_n_bits;
27438 self->private_data.s_init_dynamic_huffman[0].v_n_lit = v_n_lit;
27439 self->private_data.s_init_dynamic_huffman[0].v_n_dist = v_n_dist;
27440 self->private_data.s_init_dynamic_huffman[0].v_n_clen = v_n_clen;
27441 self->private_data.s_init_dynamic_huffman[0].v_i = v_i;
27442 self->private_data.s_init_dynamic_huffman[0].v_mask = v_mask;
27443 self->private_data.s_init_dynamic_huffman[0].v_table_entry = v_table_entry;
27444 self->private_data.s_init_dynamic_huffman[0].v_n_extra_bits = v_n_extra_bits;
27445 self->private_data.s_init_dynamic_huffman[0].v_rep_symbol = v_rep_symbol;
27446 self->private_data.s_init_dynamic_huffman[0].v_rep_count = v_rep_count;
27461 wuffs_deflate__decoder* self,
27493 if (v_counts[(self->private_data.f_code_lengths[v_i] & 15)] >= 320) {
27500 v_counts[(self->private_data.f_code_lengths[v_i] & 15)] += 1;
27526 if (self->private_data.f_code_lengths[(a_n_codes0 + v_i)] == 1) {
27527 self->private_impl.f_n_huffs_bits[1] = 1;
27528 self->private_data.f_huffs[1][0] = (WUFFS_DEFLATE__DCODE_MAGIC_NUMBERS[v_i] | 1);
27529 self->private_data.f_huffs[1][1] = (WUFFS_DEFLATE__DCODE_MAGIC_NUMBERS[31] | 1);
27555 if (self->private_data.f_code_lengths[v_i] != 0) {
27556 if (v_offsets[(self->private_data.f_code_lengths[v_i] & 15)] >= 320) {
27559 v_symbols[v_offsets[(self->private_data.f_code_lengths[v_i] & 15)]] = ((uint16_t)((v_i - a_n_codes0)));
27564 v_offsets[(self->private_data.f_code_lengths[v_i] & 15)] += 1;
27594 self->private_impl.f_n_huffs_bits[a_which] = v_max_cl;
27596 self->private_impl.f_n_huffs_bits[a_which] = 9;
27609 v_prev_cl = ((uint32_t)((self->private_data.f_code_lengths[(a_n_codes0 + ((uint32_t)(v_symbols[0])))] & 15)));
27620 v_cl = ((uint32_t)((self->private_data.f_code_lengths[(a_n_codes0 + ((uint32_t)(v_symbols[v_i])))] & 15)));
27660 self->private_data.f_huffs[a_which][v_redirect_key] = (268435465 | (v_top << 8) | (v_j << 4));
27698 self->private_data.f_huffs[a_which][(v_top + ((v_high_bits | v_reversed_key) & 511))] = v_value;
27720 wuffs_deflate__decoder* self,
27763 if ((self->private_impl.f_n_bits >= 8) || ((self->private_impl.f_bits >> (self->private_impl.f_n_bits & 7)) != 0)) {
27767 v_bits = ((uint64_t)(self->private_impl.f_bits));
27768 v_n_bits = self->private_impl.f_n_bits;
27769 v_lmask = ((((uint64_t)(1)) << self->private_impl.f_n_huffs_bits[0]) - 1);
27770 v_dmask = ((((uint64_t)(1)) << self->private_impl.f_n_huffs_bits[1]) - 1);
27771 if (self->private_impl.f_transformed_history_count < (a_dst ? a_dst->meta.pos : 0)) {
27775 v_hdist_adjustment = ((uint32_t)(((self->private_impl.f_transformed_history_count - (a_dst ? a_dst->meta.pos : 0)) & 4294967295)));
27781 v_table_entry = self->private_data.f_huffs[0][(v_bits & v_lmask)];
27790 self->private_impl.f_end_of_block = true;
27795 v_table_entry = self->private_data.f_huffs[0][((v_redir_top + (((uint32_t)((v_bits & 4294967295))) & v_redir_mask)) & 1023)];
27804 self->private_impl.f_end_of_block = true;
27830 v_table_entry = self->private_data.f_huffs[1][(v_bits & v_dmask)];
27837 v_table_entry = self->private_data.f_huffs[1][((v_redir_top + (((uint32_t)((v_bits & 4294967295))) & v_redir_mask)) & 1023)];
27867 if (self->private_impl.f_history_index < v_hdist) {
27872 &iop_a_dst, io2_a_dst,v_hlen, wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 33025), ((self->private_impl.f_history_index - v_hdist) & 32767)));
27909 self->private_impl.f_bits = ((uint32_t)((v_bits & ((((uint64_t)(1)) << v_n_bits) - 1))));
27910 self->private_impl.f_n_bits = v_n_bits;
27911 if ((self->private_impl.f_n_bits >= 8) || ((self->private_impl.f_bits >> self->private_impl.f_n_bits) != 0)) {
27933 wuffs_deflate__decoder* self,
27976 if ((self->private_impl.f_n_bits >= 8) || ((self->private_impl.f_bits >> (self->private_impl.f_n_bits & 7)) != 0)) {
27980 v_bits = self->private_impl.f_bits;
27981 v_n_bits = self->private_impl.f_n_bits;
27982 v_lmask = ((((uint32_t)(1)) << self->private_impl.f_n_huffs_bits[0]) - 1);
27983 v_dmask = ((((uint32_t)(1)) << self->private_impl.f_n_huffs_bits[1]) - 1);
27984 if (self->private_impl.f_transformed_history_count < (a_dst ? a_dst->meta.pos : 0)) {
27988 v_hdist_adjustment = ((uint32_t)(((self->private_impl.f_transformed_history_count - (a_dst ? a_dst->meta.pos : 0)) & 4294967295)));
28000 v_table_entry = self->private_data.f_huffs[0][(v_bits & v_lmask)];
28009 self->private_impl.f_end_of_block = true;
28023 v_table_entry = self->private_data.f_huffs[0][((v_redir_top + (v_bits & v_redir_mask)) & 1023)];
28032 self->private_impl.f_end_of_block = true;
28077 v_table_entry = self->private_data.f_huffs[1][(v_bits & v_dmask)];
28093 v_table_entry = self->private_data.f_huffs[1][((v_redir_top + (v_bits & v_redir_mask)) & 1023)];
28132 if (self->private_impl.f_history_index < v_hdist) {
28137 &iop_a_dst, io2_a_dst,v_hlen, wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 33025), ((self->private_impl.f_history_index - v_hdist) & 32767)));
28167 self->private_impl.f_bits = (v_bits & ((((uint32_t)(1)) << v_n_bits) - 1));
28168 self->private_impl.f_n_bits = v_n_bits;
28169 if ((self->private_impl.f_n_bits >= 8) || ((self->private_impl.f_bits >> self->private_impl.f_n_bits) != 0)) {
28189 wuffs_deflate__decoder* self,
28192 return (*self->private_impl.choosy_decode_huffman_fast64)(self, a_dst, a_src);
28197 wuffs_deflate__decoder* self,
28240 if ((self->private_impl.f_n_bits >= 8) || ((self->private_impl.f_bits >> (self->private_impl.f_n_bits & 7)) != 0)) {
28244 v_bits = ((uint64_t)(self->private_impl.f_bits));
28245 v_n_bits = self->private_impl.f_n_bits;
28246 v_lmask = ((((uint64_t)(1)) << self->private_impl.f_n_huffs_bits[0]) - 1);
28247 v_dmask = ((((uint64_t)(1)) << self->private_impl.f_n_huffs_bits[1]) - 1);
28248 if (self->private_impl.f_transformed_history_count < (a_dst ? a_dst->meta.pos : 0)) {
28252 v_hdist_adjustment = ((uint32_t)(((self->private_impl.f_transformed_history_count - (a_dst ? a_dst->meta.pos : 0)) & 4294967295)));
28258 v_table_entry = self->private_data.f_huffs[0][(v_bits & v_lmask)];
28267 self->private_impl.f_end_of_block = true;
28272 v_table_entry = self->private_data.f_huffs[0][((v_redir_top + (((uint32_t)((v_bits & 4294967295))) & v_redir_mask)) & 1023)];
28281 self->private_impl.f_end_of_block = true;
28307 v_table_entry = self->private_data.f_huffs[1][(v_bits & v_dmask)];
28314 v_table_entry = self->private_data.f_huffs[1][((v_redir_top + (((uint32_t)((v_bits & 4294967295))) & v_redir_mask)) & 1023)];
28344 if (self->private_impl.f_history_index < v_hdist) {
28349 &iop_a_dst, io2_a_dst,v_hlen, wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 33025), ((self->private_impl.f_history_index - v_hdist) & 32767)));
28386 self->private_impl.f_bits = ((uint32_t)((v_bits & ((((uint64_t)(1)) << v_n_bits) - 1))));
28387 self->private_impl.f_n_bits = v_n_bits;
28388 if ((self->private_impl.f_n_bits >= 8) || ((self->private_impl.f_bits >> self->private_impl.f_n_bits) != 0)) {
28408 wuffs_deflate__decoder* self,
28457 uint32_t coro_susp_point = self->private_impl.p_decode_huffman_slow[0];
28459 v_bits = self->private_data.s_decode_huffman_slow[0].v_bits;
28460 v_n_bits = self->private_data.s_decode_huffman_slow[0].v_n_bits;
28461 v_table_entry = self->private_data.s_decode_huffman_slow[0].v_table_entry;
28462 v_table_entry_n_bits = self->private_data.s_decode_huffman_slow[0].v_table_entry_n_bits;
28463 v_lmask = self->private_data.s_decode_huffman_slow[0].v_lmask;
28464 v_dmask = self->private_data.s_decode_huffman_slow[0].v_dmask;
28465 v_redir_top = self->private_data.s_decode_huffman_slow[0].v_redir_top;
28466 v_redir_mask = self->private_data.s_decode_huffman_slow[0].v_redir_mask;
28467 v_length = self->private_data.s_decode_huffman_slow[0].v_length;
28468 v_dist_minus_1 = self->private_data.s_decode_huffman_slow[0].v_dist_minus_1;
28469 v_hlen = self->private_data.s_decode_huffman_slow[0].v_hlen;
28474 if ((self->private_impl.f_n_bits >= 8) || ((self->private_impl.f_bits >> (self->private_impl.f_n_bits & 7)) != 0)) {
28478 v_bits = self->private_impl.f_bits;
28479 v_n_bits = self->private_impl.f_n_bits;
28480 v_lmask = ((((uint32_t)(1)) << self->private_impl.f_n_huffs_bits[0]) - 1);
28481 v_dmask = ((((uint32_t)(1)) << self->private_impl.f_n_huffs_bits[1]) - 1);
28483 while ( ! (self->private_impl.p_decode_huffman_slow[0] != 0)) {
28485 v_table_entry = self->private_data.f_huffs[0][(v_bits & v_lmask)];
28506 self->private_data.s_decode_huffman_slow[0].scratch = ((uint8_t)(((v_table_entry >> 8) & 255)));
28512 *iop_a_dst++ = ((uint8_t)(self->private_data.s_decode_huffman_slow[0].scratch));
28516 self->private_impl.f_end_of_block = true;
28522 v_table_entry = self->private_data.f_huffs[0][((v_redir_top + (v_bits & v_redir_mask)) & 1023)];
28543 self->private_data.s_decode_huffman_slow[0].scratch = ((uint8_t)(((v_table_entry >> 8) & 255)));
28549 *iop_a_dst++ = ((uint8_t)(self->private_data.s_decode_huffman_slow[0].scratch));
28553 self->private_impl.f_end_of_block = true;
28593 v_table_entry = self->private_data.f_huffs[1][(v_bits & v_dmask)];
28617 v_table_entry = self->private_data.f_huffs[1][((v_redir_top + (v_bits & v_redir_mask)) & 1023)];
28675 v_hdist += ((uint32_t)((((uint64_t)(self->private_impl.f_transformed_history_count - (a_dst ? a_dst->meta.pos : 0))) & 4294967295)));
28676 if (self->private_impl.f_history_index < v_hdist) {
28681 &iop_a_dst, io2_a_dst,v_hlen, wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_history, 33025), ((self->private_impl.f_history_index - v_hdist) & 32767)));
28704 self->private_impl.f_bits = v_bits;
28705 self->private_impl.f_n_bits = v_n_bits;
28706 if ((self->private_impl.f_n_bits >= 8) || ((self->private_impl.f_bits >> (self->private_impl.f_n_bits & 7)) != 0)) {
28712 self->private_impl.p_decode_huffman_slow[0] = 0;
28718 self->private_impl.p_decode_huffman_slow[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
28719 self->private_data.s_decode_huffman_slow[0].v_bits = v_bits;
28720 self->private_data.s_decode_huffman_slow[0].v_n_bits = v_n_bits;
28721 self->private_data.s_decode_huffman_slow[0].v_table_entry = v_table_entry;
28722 self->private_data.s_decode_huffman_slow[0].v_table_entry_n_bits = v_table_entry_n_bits;
28723 self->private_data.s_decode_huffman_slow[0].v_lmask = v_lmask;
28724 self->private_data.s_decode_huffman_slow[0].v_dmask = v_dmask;
28725 self->private_data.s_decode_huffman_slow[0].v_redir_top = v_redir_top;
28726 self->private_data.s_decode_huffman_slow[0].v_redir_mask = v_redir_mask;
28727 self->private_data.s_decode_huffman_slow[0].v_length = v_length;
28728 self->private_data.s_decode_huffman_slow[0].v_dist_minus_1 = v_dist_minus_1;
28729 self->private_data.s_decode_huffman_slow[0].v_hlen = v_hlen;
28760 wuffs_lzw__decoder* self,
28765 wuffs_lzw__decoder* self,
28786 wuffs_lzw__decoder* self,
28790 if (!self) {
28793 if (sizeof(*self) != sizeof_star_self) {
28802 // The whole point of this if-check is to detect an uninitialized *self.
28808 if (self->private_impl.magic != 0) {
28816 memset(self, 0, sizeof(*self));
28819 memset(&(self->private_impl), 0, sizeof(self->private_impl));
28823 self->private_impl.magic = WUFFS_BASE__MAGIC;
28824 self->private_impl.vtable_for__wuffs_base__io_transformer.vtable_name =
28826 self->private_impl.vtable_for__wuffs_base__io_transformer.function_pointers =
28857 wuffs_lzw__decoder* self,
28867 wuffs_lzw__decoder* self,
28869 if (!self) {
28872 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
28876 self->private_impl.magic = WUFFS_BASE__DISABLED;
28880 self->private_impl.f_set_literal_width_arg = (a_lw + 1);
28888 const wuffs_lzw__decoder* self) {
28889 if (!self) {
28892 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
28893 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
28904 wuffs_lzw__decoder* self,
28908 if (!self) {
28911 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
28913 (self->private_impl.magic == WUFFS_BASE__DISABLED)
28918 self->private_impl.magic = WUFFS_BASE__DISABLED;
28921 if ((self->private_impl.active_coroutine != 0) &&
28922 (self->private_impl.active_coroutine != 1)) {
28923 self->private_impl.magic = WUFFS_BASE__DISABLED;
28926 self->private_impl.active_coroutine = 0;
28931 uint32_t coro_susp_point = self->private_impl.p_transform_io[0];
28935 self->private_impl.f_literal_width = 8;
28936 if (self->private_impl.f_set_literal_width_arg > 0) {
28937 self->private_impl.f_literal_width = (self->private_impl.f_set_literal_width_arg - 1);
28939 self->private_impl.f_clear_code = (((uint32_t)(1)) << self->private_impl.f_literal_width);
28940 self->private_impl.f_end_code = (self->private_impl.f_clear_code + 1);
28941 self->private_impl.f_save_code = self->private_impl.f_end_code;
28942 self->private_impl.f_prev_code = self->private_impl.f_end_code;
28943 self->private_impl.f_width = (self->private_impl.f_literal_width + 1);
28944 self->private_impl.f_bits = 0;
28945 self->private_impl.f_n_bits = 0;
28946 self->private_impl.f_output_ri = 0;
28947 self->private_impl.f_output_wi = 0;
28949 while (v_i < self->private_impl.f_clear_code) {
28950 self->private_data.f_lm1s[v_i] = 0;
28951 self->private_data.f_suffixes[v_i][0] = ((uint8_t)(v_i));
28956 wuffs_lzw__decoder__read_from(self, a_src);
28957 if (self->private_impl.f_output_wi > 0) {
28959 status = wuffs_lzw__decoder__write_to(self, a_dst);
28964 if (self->private_impl.f_read_from_return_value == 0) {
28966 } else if (self->private_impl.f_read_from_return_value == 1) {
28968 } else if (self->private_impl.f_read_from_return_value == 2) {
28971 } else if (self->private_impl.f_read_from_return_value == 3) {
28982 self->private_impl.p_transform_io[0] = 0;
28988 self->private_impl.p_transform_io[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
28989 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
28994 self->private_impl.magic = WUFFS_BASE__DISABLED;
29003 wuffs_lzw__decoder* self,
29032 v_clear_code = self->private_impl.f_clear_code;
29033 v_end_code = self->private_impl.f_end_code;
29034 v_save_code = self->private_impl.f_save_code;
29035 v_prev_code = self->private_impl.f_prev_code;
29036 v_width = self->private_impl.f_width;
29037 v_bits = self->private_impl.f_bits;
29038 v_n_bits = self->private_impl.f_n_bits;
29039 v_output_wi = self->private_impl.f_output_wi;
29047 self->private_impl.f_read_from_return_value = 2;
29055 self->private_impl.f_read_from_return_value = 2;
29062 self->private_impl.f_read_from_return_value = 4;
29072 self->private_data.f_output[v_output_wi] = ((uint8_t)(v_code));
29075 v_lm1_a = (((uint16_t)(self->private_data.f_lm1s[v_prev_code] + 1)) & 4095);
29076 self->private_data.f_lm1s[v_save_code] = v_lm1_a;
29078 self->private_impl.f_prefixes[v_save_code] = self->private_impl.f_prefixes[v_prev_code];
29079 memcpy(self->private_data.f_suffixes[v_save_code],self->private_data.f_suffixes[v_prev_code], sizeof(self->private_data.f_suffixes[v_save_code]));
29080 self->private_data.f_suffixes[v_save_code][(v_lm1_a % 8)] = ((uint8_t)(v_code));
29082 self->private_impl.f_prefixes[v_save_code] = ((uint16_t)(v_prev_code));
29083 self->private_data.f_suffixes[v_save_code][0] = ((uint8_t)(v_code));
29093 self->private_impl.f_read_from_return_value = 0;
29098 v_width = (self->private_impl.f_literal_width + 1);
29104 v_o = ((v_output_wi + (((uint32_t)(self->private_data.f_lm1s[v_c])) & 4294967288)) & 8191);
29105 v_output_wi = ((v_output_wi + 1 + ((uint32_t)(self->private_data.f_lm1s[v_c]))) & 8191);
29106 v_steps = (((uint32_t)(self->private_data.f_lm1s[v_c])) >> 3);
29108 memcpy((self->private_data.f_output)+(v_o), (self->private_data.f_suffixes[v_c]), 8);
29114 v_c = ((uint32_t)(self->private_impl.f_prefixes[v_c]));
29117 v_first_byte = self->private_data.f_suffixes[v_c][0];
29119 self->private_data.f_output[v_output_wi] = v_first_byte;
29123 v_lm1_b = (((uint16_t)(self->private_data.f_lm1s[v_prev_code] + 1)) & 4095);
29124 self->private_data.f_lm1s[v_save_code] = v_lm1_b;
29126 self->private_impl.f_prefixes[v_save_code] = self->private_impl.f_prefixes[v_prev_code];
29127 memcpy(self->private_data.f_suffixes[v_save_code],self->private_data.f_suffixes[v_prev_code], sizeof(self->private_data.f_suffixes[v_save_code]));
29128 self->private_data.f_suffixes[v_save_code][(v_lm1_b % 8)] = v_first_byte;
29130 self->private_impl.f_prefixes[v_save_code] = ((uint16_t)(v_prev_code));
29131 self->private_data.f_suffixes[v_save_code][0] = ((uint8_t)(v_first_byte));
29140 self->private_impl.f_read_from_return_value = 3;
29144 self->private_impl.f_read_from_return_value = 1;
29149 if (self->private_impl.f_read_from_return_value != 2) {
29155 self->private_impl.f_read_from_return_value = 4;
29161 self->private_impl.f_save_code = v_save_code;
29162 self->private_impl.f_prev_code = v_prev_code;
29163 self->private_impl.f_width = v_width;
29164 self->private_impl.f_bits = v_bits;
29165 self->private_impl.f_n_bits = v_n_bits;
29166 self->private_impl.f_output_wi = v_output_wi;
29178 wuffs_lzw__decoder* self,
29199 uint32_t coro_susp_point = self->private_impl.p_write_to[0];
29203 while (self->private_impl.f_output_wi > 0) {
29204 if (self->private_impl.f_output_ri > self->private_impl.f_output_wi) {
29208 v_s = wuffs_base__slice_u8__subslice_ij(wuffs_base__make_slice_u8(self->private_data.f_output,
29210 self->private_impl.f_output_ri,
29211 self->private_impl.f_output_wi);
29214 self->private_impl.f_output_ri = 0;
29215 self->private_impl.f_output_wi = 0;
29219 self->private_impl.f_output_ri = (((uint32_t)(self->private_impl.f_output_ri + ((uint32_t)((v_n & 4294967295))))) & 8191);
29225 self->private_impl.p_write_to[0] = 0;
29231 self->private_impl.p_write_to[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
29246 wuffs_lzw__decoder* self) {
29247 if (!self) {
29250 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
29256 if (self->private_impl.f_output_ri <= self->private_impl.f_output_wi) {
29257 v_s = wuffs_base__slice_u8__subslice_ij(wuffs_base__make_slice_u8(self->private_data.f_output,
29259 self->private_impl.f_output_ri,
29260 self->private_impl.f_output_wi);
29262 self->private_impl.f_output_ri = 0;
29263 self->private_impl.f_output_wi = 0;
29332 wuffs_gif__decoder* self,
29337 wuffs_gif__decoder* self);
29341 wuffs_gif__decoder* self,
29346 wuffs_gif__decoder* self,
29351 wuffs_gif__decoder* self,
29356 wuffs_gif__decoder* self,
29361 wuffs_gif__decoder* self,
29366 wuffs_gif__decoder* self,
29371 wuffs_gif__decoder* self,
29376 wuffs_gif__decoder* self,
29381 wuffs_gif__decoder* self,
29388 wuffs_gif__decoder* self,
29395 wuffs_gif__decoder* self,
29439 wuffs_gif__decoder* self,
29443 if (!self) {
29446 if (sizeof(*self) != sizeof_star_self) {
29455 // The whole point of this if-check is to detect an uninitialized *self.
29461 if (self->private_impl.magic != 0) {
29469 memset(self, 0, sizeof(*self));
29472 memset(&(self->private_impl), 0, sizeof(self->private_impl));
29478 &self->private_data.f_lzw, sizeof(self->private_data.f_lzw), WUFFS_VERSION, options);
29483 self->private_impl.magic = WUFFS_BASE__MAGIC;
29484 self->private_impl.vtable_for__wuffs_base__image_decoder.vtable_name =
29486 self->private_impl.vtable_for__wuffs_base__image_decoder.function_pointers =
29517 wuffs_gif__decoder* self,
29520 if (!self) {
29523 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
29527 if ((self->private_impl.f_call_sequence == 0) && (a_quirk >= 1041635328)) {
29530 self->private_impl.f_quirks[a_quirk] = a_enabled;
29540 wuffs_gif__decoder* self,
29543 if (!self) {
29546 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
29548 (self->private_impl.magic == WUFFS_BASE__DISABLED)
29553 self->private_impl.magic = WUFFS_BASE__DISABLED;
29556 if ((self->private_impl.active_coroutine != 0) &&
29557 (self->private_impl.active_coroutine != 1)) {
29558 self->private_impl.magic = WUFFS_BASE__DISABLED;
29561 self->private_impl.active_coroutine = 0;
29566 uint32_t coro_susp_point = self->private_impl.p_decode_image_config[0];
29570 if (self->private_impl.f_call_sequence == 0) {
29572 status = wuffs_gif__decoder__decode_header(self, a_src);
29577 status = wuffs_gif__decoder__decode_lsd(self, a_src);
29581 } else if (self->private_impl.f_call_sequence != 2) {
29586 status = wuffs_gif__decoder__decode_up_to_id_part1(self, a_src);
29590 v_ffio = ! self->private_impl.f_gc_has_transparent_index;
29591 if ( ! self->private_impl.f_quirks[2]) {
29593 (self->private_impl.f_frame_rect_x0 == 0) &&
29594 (self->private_impl.f_frame_rect_y0 == 0) &&
29595 (self->private_impl.f_frame_rect_x1 == self->private_impl.f_width) &&
29596 (self->private_impl.f_frame_rect_y1 == self->private_impl.f_height));
29598 self->private_impl.f_black_color_u32_argb_premul = 4278190080;
29600 if (self->private_impl.f_background_color_u32_argb_premul == 77) {
29601 self->private_impl.f_background_color_u32_argb_premul = self->private_impl.f_black_color_u32_argb_premul;
29608 self->private_impl.f_width,
29609 self->private_impl.f_height,
29610 self->private_impl.f_frame_config_io_position,
29613 self->private_impl.f_call_sequence = 3;
29617 self->private_impl.p_decode_image_config[0] = 0;
29623 self->private_impl.p_decode_image_config[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
29624 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
29629 self->private_impl.magic = WUFFS_BASE__DISABLED;
29638 wuffs_gif__decoder* self,
29641 if (!self) {
29644 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
29649 self->private_impl.f_report_metadata_iccp = a_report;
29651 self->private_impl.f_report_metadata_xmp = a_report;
29660 wuffs_gif__decoder* self,
29664 if (!self) {
29667 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
29669 (self->private_impl.magic == WUFFS_BASE__DISABLED)
29674 self->private_impl.magic = WUFFS_BASE__DISABLED;
29677 if ((self->private_impl.active_coroutine != 0) &&
29678 (self->private_impl.active_coroutine != 2)) {
29679 self->private_impl.magic = WUFFS_BASE__DISABLED;
29682 self->private_impl.active_coroutine = 0;
29698 uint32_t coro_susp_point = self->private_impl.p_tell_me_more[0];
29702 if (self->private_impl.f_call_sequence != 1) {
29706 if (self->private_impl.f_metadata_fourcc == 0) {
29713 if (wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src))) != self->private_impl.f_metadata_io_position) {
29718 self->private_impl.f_metadata_io_position,
29747 if (self->private_impl.f_metadata_fourcc == 1481461792) {
29752 self->private_impl.f_metadata_io_position = wuffs_base__u64__sat_add(wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src))), v_chunk_length);
29756 self->private_impl.f_metadata_fourcc,
29759 self->private_impl.f_metadata_io_position);
29768 self->private_impl.f_metadata_fourcc,
29770 self->private_impl.f_metadata_io_position,
29771 self->private_impl.f_metadata_io_position);
29773 self->private_impl.f_call_sequence = 2;
29774 self->private_impl.f_metadata_fourcc = 0;
29775 self->private_impl.f_metadata_io_position = 0;
29780 self->private_impl.p_tell_me_more[0] = 0;
29786 self->private_impl.p_tell_me_more[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
29787 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 2 : 0;
29796 self->private_impl.magic = WUFFS_BASE__DISABLED;
29805 const wuffs_gif__decoder* self) {
29806 if (!self) {
29809 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
29810 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
29814 if (self->private_impl.f_seen_num_animation_loops_value) {
29815 return self->private_impl.f_num_animation_loops_value;
29817 if (self->private_impl.f_num_decoded_frame_configs_value > 1) {
29827 const wuffs_gif__decoder* self) {
29828 if (!self) {
29831 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
29832 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
29836 return self->private_impl.f_num_decoded_frame_configs_value;
29843 const wuffs_gif__decoder* self) {
29844 if (!self) {
29847 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
29848 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
29852 return self->private_impl.f_num_decoded_frames_value;
29859 const wuffs_gif__decoder* self) {
29860 if (!self) {
29863 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
29864 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
29869 wuffs_base__u32__min(self->private_impl.f_frame_rect_x0, self->private_impl.f_width),
29870 wuffs_base__u32__min(self->private_impl.f_frame_rect_y0, self->private_impl.f_height),
29871 wuffs_base__u32__min(self->private_impl.f_frame_rect_x1, self->private_impl.f_width),
29872 wuffs_base__u32__min(self->private_impl.f_dirty_max_excl_y, self->private_impl.f_height));
29879 const wuffs_gif__decoder* self) {
29880 if (!self) {
29883 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
29884 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
29895 wuffs_gif__decoder* self,
29898 if (!self) {
29901 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
29903 (self->private_impl.magic == WUFFS_BASE__DISABLED)
29908 if (self->private_impl.f_call_sequence < 3) {
29911 self->private_impl.f_delayed_num_decoded_frames = false;
29912 self->private_impl.f_end_of_data = false;
29913 self->private_impl.f_restarted = true;
29914 self->private_impl.f_frame_config_io_position = a_io_position;
29915 self->private_impl.f_num_decoded_frame_configs_value = a_index;
29916 self->private_impl.f_num_decoded_frames_value = a_index;
29917 wuffs_gif__decoder__reset_gc(self);
29925 wuffs_gif__decoder* self,
29928 if (!self) {
29931 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
29933 (self->private_impl.magic == WUFFS_BASE__DISABLED)
29938 self->private_impl.magic = WUFFS_BASE__DISABLED;
29941 if ((self->private_impl.active_coroutine != 0) &&
29942 (self->private_impl.active_coroutine != 3)) {
29943 self->private_impl.magic = WUFFS_BASE__DISABLED;
29946 self->private_impl.active_coroutine = 0;
29963 uint32_t coro_susp_point = self->private_impl.p_decode_frame_config[0];
29965 v_background_color = self->private_data.s_decode_frame_config[0].v_background_color;
29970 self->private_impl.f_ignore_metadata = true;
29971 self->private_impl.f_dirty_max_excl_y = 0;
29972 if ( ! self->private_impl.f_end_of_data) {
29973 if (self->private_impl.f_call_sequence == 0) {
29978 status = wuffs_gif__decoder__decode_image_config(self, NULL, a_src);
29985 } else if (self->private_impl.f_call_sequence != 3) {
29986 if (self->private_impl.f_call_sequence == 4) {
29991 status = wuffs_gif__decoder__skip_frame(self, a_src);
30003 status = wuffs_gif__decoder__decode_up_to_id_part1(self, a_src);
30012 if (self->private_impl.f_end_of_data) {
30016 v_background_color = self->private_impl.f_black_color_u32_argb_premul;
30017 if ( ! self->private_impl.f_gc_has_transparent_index) {
30018 v_background_color = self->private_impl.f_background_color_u32_argb_premul;
30019 if (self->private_impl.f_quirks[1] && (self->private_impl.f_num_decoded_frame_configs_value == 0)) {
30026 v_background_color = self->private_impl.f_black_color_u32_argb_premul;
30034 wuffs_base__u32__min(self->private_impl.f_frame_rect_x0, self->private_impl.f_width),
30035 wuffs_base__u32__min(self->private_impl.f_frame_rect_y0, self->private_impl.f_height),
30036 wuffs_base__u32__min(self->private_impl.f_frame_rect_x1, self->private_impl.f_width),
30037 wuffs_base__u32__min(self->private_impl.f_frame_rect_y1, self->private_impl.f_height)),
30038 ((wuffs_base__flicks)(self->private_impl.f_gc_duration)),
30039 self->private_impl.f_num_decoded_frame_configs_value,
30040 self->private_impl.f_frame_config_io_position,
30041 self->private_impl.f_gc_disposal,
30042 ! self->private_impl.f_gc_has_transparent_index,
30046 wuffs_base__u64__sat_add_indirect(&self->private_impl.f_num_decoded_frame_configs_value, 1);
30047 self->private_impl.f_call_sequence = 4;
30050 self->private_impl.p_decode_frame_config[0] = 0;
30056 self->private_impl.p_decode_frame_config[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
30057 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 3 : 0;
30058 self->private_data.s_decode_frame_config[0].v_background_color = v_background_color;
30067 self->private_impl.magic = WUFFS_BASE__DISABLED;
30076 wuffs_gif__decoder* self,
30094 uint32_t coro_susp_point = self->private_impl.p_skip_frame[0];
30108 self->private_data.s_skip_frame[0].scratch = (((uint32_t)(3)) << (1 + (v_flags & 7)));
30110 if (self->private_data.s_skip_frame[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
30111 self->private_data.s_skip_frame[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
30116 iop_a_src += self->private_data.s_skip_frame[0].scratch;
30135 status = wuffs_gif__decoder__skip_blocks(self, a_src);
30142 if (self->private_impl.f_quirks[0]) {
30143 self->private_impl.f_delayed_num_decoded_frames = true;
30145 wuffs_base__u64__sat_add_indirect(&self->private_impl.f_num_decoded_frames_value, 1);
30147 wuffs_gif__decoder__reset_gc(self);
30151 self->private_impl.p_skip_frame[0] = 0;
30157 self->private_impl.p_skip_frame[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
30172 wuffs_gif__decoder* self,
30178 if (!self) {
30181 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
30183 (self->private_impl.magic == WUFFS_BASE__DISABLED)
30188 self->private_impl.magic = WUFFS_BASE__DISABLED;
30191 if ((self->private_impl.active_coroutine != 0) &&
30192 (self->private_impl.active_coroutine != 4)) {
30193 self->private_impl.magic = WUFFS_BASE__DISABLED;
30196 self->private_impl.active_coroutine = 0;
30199 uint32_t coro_susp_point = self->private_impl.p_decode_frame[0];
30203 self->private_impl.f_ignore_metadata = true;
30204 if (self->private_impl.f_call_sequence != 4) {
30206 status = wuffs_gif__decoder__decode_frame_config(self, NULL, a_src);
30211 if (self->private_impl.f_quirks[5] && ((self->private_impl.f_frame_rect_x0 == self->private_impl.f_frame_rect_x1) || (self->private_impl.f_frame_rect_y0 == self->private_impl.f_frame_rect_y1))) {
30216 status = wuffs_gif__decoder__decode_id_part1(self, a_dst, a_src, a_blend);
30221 status = wuffs_gif__decoder__decode_id_part2(self, a_dst, a_src, a_workbuf);
30225 wuffs_base__u64__sat_add_indirect(&self->private_impl.f_num_decoded_frames_value, 1);
30226 wuffs_gif__decoder__reset_gc(self);
30230 self->private_impl.p_decode_frame[0] = 0;
30236 self->private_impl.p_decode_frame[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
30237 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 4 : 0;
30242 self->private_impl.magic = WUFFS_BASE__DISABLED;
30251 wuffs_gif__decoder* self) {
30252 self->private_impl.f_call_sequence = 5;
30253 self->private_impl.f_gc_has_transparent_index = false;
30254 self->private_impl.f_gc_transparent_index = 0;
30255 self->private_impl.f_gc_disposal = 0;
30256 self->private_impl.f_gc_duration = 0;
30264 wuffs_gif__decoder* self,
30281 uint32_t coro_susp_point = self->private_impl.p_decode_up_to_id_part1[0];
30285 if ( ! self->private_impl.f_restarted) {
30286 if (self->private_impl.f_call_sequence != 2) {
30287 self->private_impl.f_frame_config_io_position = wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)));
30289 } else if (self->private_impl.f_frame_config_io_position != wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)))) {
30293 self->private_impl.f_restarted = false;
30310 status = wuffs_gif__decoder__decode_extension(self, a_src);
30318 if (self->private_impl.f_delayed_num_decoded_frames) {
30319 self->private_impl.f_delayed_num_decoded_frames = false;
30320 wuffs_base__u64__sat_add_indirect(&self->private_impl.f_num_decoded_frames_value, 1);
30326 status = wuffs_gif__decoder__decode_id_part0(self, a_src);
30335 if (self->private_impl.f_delayed_num_decoded_frames) {
30336 self->private_impl.f_delayed_num_decoded_frames = false;
30337 wuffs_base__u64__sat_add_indirect(&self->private_impl.f_num_decoded_frames_value, 1);
30339 self->private_impl.f_end_of_data = true;
30347 self->private_impl.p_decode_up_to_id_part1[0] = 0;
30353 self->private_impl.p_decode_up_to_id_part1[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
30368 wuffs_gif__decoder* self,
30386 uint32_t coro_susp_point = self->private_impl.p_decode_header[0];
30388 memcpy(v_c, self->private_data.s_decode_header[0].v_c, sizeof(v_c));
30389 v_i = self->private_data.s_decode_header[0].v_i;
30418 self->private_impl.p_decode_header[0] = 0;
30424 self->private_impl.p_decode_header[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
30425 memcpy(self->private_data.s_decode_header[0].v_c, v_c, sizeof(v_c));
30426 self->private_data.s_decode_header[0].v_i = v_i;
30441 wuffs_gif__decoder* self,
30463 uint32_t coro_susp_point = self->private_impl.p_decode_lsd[0];
30465 v_flags = self->private_data.s_decode_lsd[0].v_flags;
30466 v_background_color_index = self->private_data.s_decode_lsd[0].v_background_color_index;
30467 v_num_palette_entries = self->private_data.s_decode_lsd[0].v_num_palette_entries;
30468 v_i = self->private_data.s_decode_lsd[0].v_i;
30480 self->private_data.s_decode_lsd[0].scratch = 0;
30487 uint64_t* scratch = &self->private_data.s_decode_lsd[0].scratch;
30500 self->private_impl.f_width = t_0;
30509 self->private_data.s_decode_lsd[0].scratch = 0;
30516 uint64_t* scratch = &self->private_data.s_decode_lsd[0].scratch;
30529 self->private_impl.f_height = t_1;
30556 self->private_impl.f_has_global_palette = ((v_flags & 128) != 0);
30557 if (self->private_impl.f_has_global_palette) {
30567 self->private_data.s_decode_lsd[0].scratch = 0;
30574 uint64_t* scratch = &self->private_data.s_decode_lsd[0].scratch;
30590 self->private_data.f_palettes[0][((4 * v_i) + 0)] = ((uint8_t)(((v_argb >> 0) & 255)));
30591 self->private_data.f_palettes[0][((4 * v_i) + 1)] = ((uint8_t)(((v_argb >> 8) & 255)));
30592 self->private_data.f_palettes[0][((4 * v_i) + 2)] = ((uint8_t)(((v_argb >> 16) & 255)));
30593 self->private_data.f_palettes[0][((4 * v_i) + 3)] = ((uint8_t)(((v_argb >> 24) & 255)));
30596 if (self->private_impl.f_quirks[2]) {
30599 self->private_impl.f_background_color_u32_argb_premul = ((((uint32_t)(self->private_data.f_palettes[0][(v_j + 0)])) << 0) |
30600 (((uint32_t)(self->private_data.f_palettes[0][(v_j + 1)])) << 8) |
30601 (((uint32_t)(self->private_data.f_palettes[0][(v_j + 2)])) << 16) |
30602 (((uint32_t)(self->private_data.f_palettes[0][(v_j + 3)])) << 24));
30604 self->private_impl.f_background_color_u32_argb_premul = 77;
30609 self->private_data.f_palettes[0][((4 * v_i) + 0)] = 0;
30610 self->private_data.f_palettes[0][((4 * v_i) + 1)] = 0;
30611 self->private_data.f_palettes[0][((4 * v_i) + 2)] = 0;
30612 self->private_data.f_palettes[0][((4 * v_i) + 3)] = 255;
30618 self->private_impl.p_decode_lsd[0] = 0;
30624 self->private_impl.p_decode_lsd[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
30625 self->private_data.s_decode_lsd[0].v_flags = v_flags;
30626 self->private_data.s_decode_lsd[0].v_background_color_index = v_background_color_index;
30627 self->private_data.s_decode_lsd[0].v_num_palette_entries = v_num_palette_entries;
30628 self->private_data.s_decode_lsd[0].v_i = v_i;
30643 wuffs_gif__decoder* self,
30660 uint32_t coro_susp_point = self->private_impl.p_decode_extension[0];
30678 status = wuffs_gif__decoder__decode_gc(self, a_src);
30692 status = wuffs_gif__decoder__decode_ae(self, a_src);
30706 status = wuffs_gif__decoder__skip_blocks(self, a_src);
30715 self->private_impl.p_decode_extension[0] = 0;
30721 self->private_impl.p_decode_extension[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
30736 wuffs_gif__decoder* self,
30753 uint32_t coro_susp_point = self->private_impl.p_skip_blocks[0];
30771 self->private_data.s_skip_blocks[0].scratch = ((uint32_t)(v_block_size));
30773 if (self->private_data.s_skip_blocks[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
30774 self->private_data.s_skip_blocks[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
30779 iop_a_src += self->private_data.s_skip_blocks[0].scratch;
30783 self->private_impl.p_skip_blocks[0] = 0;
30789 self->private_impl.p_skip_blocks[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
30804 wuffs_gif__decoder* self,
30826 uint32_t coro_susp_point = self->private_impl.p_decode_ae[0];
30828 v_block_size = self->private_data.s_decode_ae[0].v_block_size;
30829 v_is_animexts = self->private_data.s_decode_ae[0].v_is_animexts;
30830 v_is_netscape = self->private_data.s_decode_ae[0].v_is_netscape;
30831 v_is_iccp = self->private_data.s_decode_ae[0].v_is_iccp;
30832 v_is_xmp = self->private_data.s_decode_ae[0].v_is_xmp;
30838 if (self->private_impl.f_metadata_fourcc != 0) {
30856 self->private_data.s_decode_ae[0].scratch = ((uint32_t)(v_block_size));
30858 if (self->private_data.s_decode_ae[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
30859 self->private_data.s_decode_ae[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
30864 iop_a_src += self->private_data.s_decode_ae[0].scratch;
30906 self->private_data.s_decode_ae[0].scratch = ((uint32_t)(v_block_size));
30908 if (self->private_data.s_decode_ae[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
30909 self->private_data.s_decode_ae[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
30914 iop_a_src += self->private_data.s_decode_ae[0].scratch;
30927 self->private_data.s_decode_ae[0].scratch = 2;
30929 if (self->private_data.s_decode_ae[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
30930 self->private_data.s_decode_ae[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
30935 iop_a_src += self->private_data.s_decode_ae[0].scratch;
30945 self->private_data.s_decode_ae[0].scratch = 0;
30952 uint64_t* scratch = &self->private_data.s_decode_ae[0].scratch;
30965 self->private_impl.f_num_animation_loops_value = t_4;
30967 self->private_impl.f_seen_num_animation_loops_value = true;
30968 if ((0 < self->private_impl.f_num_animation_loops_value) && (self->private_impl.f_num_animation_loops_value <= 65535)) {
30969 self->private_impl.f_num_animation_loops_value += 1;
30971 } else if (self->private_impl.f_ignore_metadata) {
30972 } else if (v_is_iccp && self->private_impl.f_report_metadata_iccp) {
30973 self->private_impl.f_metadata_fourcc = 1229144912;
30974 self->private_impl.f_metadata_io_position = wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)));
30975 self->private_impl.f_call_sequence = 1;
30978 } else if (v_is_xmp && self->private_impl.f_report_metadata_xmp) {
30979 self->private_impl.f_metadata_fourcc = 1481461792;
30980 self->private_impl.f_metadata_io_position = wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)));
30981 self->private_impl.f_call_sequence = 1;
30992 status = wuffs_gif__decoder__skip_blocks(self, a_src);
31001 self->private_impl.p_decode_ae[0] = 0;
31007 self->private_impl.p_decode_ae[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
31008 self->private_data.s_decode_ae[0].v_block_size = v_block_size;
31009 self->private_data.s_decode_ae[0].v_is_animexts = v_is_animexts;
31010 self->private_data.s_decode_ae[0].v_is_netscape = v_is_netscape;
31011 self->private_data.s_decode_ae[0].v_is_iccp = v_is_iccp;
31012 self->private_data.s_decode_ae[0].v_is_xmp = v_is_xmp;
31027 wuffs_gif__decoder* self,
31046 uint32_t coro_susp_point = self->private_impl.p_decode_gc[0];
31072 self->private_impl.f_gc_has_transparent_index = ((v_flags & 1) != 0);
31075 self->private_impl.f_gc_disposal = 1;
31077 self->private_impl.f_gc_disposal = 2;
31079 self->private_impl.f_gc_disposal = 0;
31088 self->private_data.s_decode_gc[0].scratch = 0;
31095 uint64_t* scratch = &self->private_data.s_decode_gc[0].scratch;
31110 self->private_impl.f_gc_duration = (((uint64_t)(v_gc_duration_centiseconds)) * 7056000);
31118 self->private_impl.f_gc_transparent_index = t_3;
31136 self->private_impl.p_decode_gc[0] = 0;
31142 self->private_impl.p_decode_gc[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
31157 wuffs_gif__decoder* self,
31172 uint32_t coro_susp_point = self->private_impl.p_decode_id_part0[0];
31183 self->private_data.s_decode_id_part0[0].scratch = 0;
31190 uint64_t* scratch = &self->private_data.s_decode_id_part0[0].scratch;
31203 self->private_impl.f_frame_rect_x0 = t_0;
31212 self->private_data.s_decode_id_part0[0].scratch = 0;
31219 uint64_t* scratch = &self->private_data.s_decode_id_part0[0].scratch;
31232 self->private_impl.f_frame_rect_y0 = t_1;
31241 self->private_data.s_decode_id_part0[0].scratch = 0;
31248 uint64_t* scratch = &self->private_data.s_decode_id_part0[0].scratch;
31261 self->private_impl.f_frame_rect_x1 = t_2;
31263 self->private_impl.f_frame_rect_x1 += self->private_impl.f_frame_rect_x0;
31271 self->private_data.s_decode_id_part0[0].scratch = 0;
31278 uint64_t* scratch = &self->private_data.s_decode_id_part0[0].scratch;
31291 self->private_impl.f_frame_rect_y1 = t_3;
31293 self->private_impl.f_frame_rect_y1 += self->private_impl.f_frame_rect_y0;
31294 self->private_impl.f_dst_x = self->private_impl.f_frame_rect_x0;
31295 self->private_impl.f_dst_y = self->private_impl.f_frame_rect_y0;
31296 if ((self->private_impl.f_call_sequence == 0) && ! self->private_impl.f_quirks[4]) {
31297 self->private_impl.f_width = wuffs_base__u32__max(self->private_impl.f_width, self->private_impl.f_frame_rect_x1);
31298 self->private_impl.f_height = wuffs_base__u32__max(self->private_impl.f_height, self->private_impl.f_frame_rect_y1);
31303 self->private_impl.p_decode_id_part0[0] = 0;
31309 self->private_impl.p_decode_id_part0[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
31324 wuffs_gif__decoder* self,
31349 uint32_t coro_susp_point = self->private_impl.p_decode_id_part1[0];
31351 v_which_palette = self->private_data.s_decode_id_part1[0].v_which_palette;
31352 v_num_palette_entries = self->private_data.s_decode_id_part1[0].v_num_palette_entries;
31353 v_i = self->private_data.s_decode_id_part1[0].v_i;
31368 self->private_impl.f_interlace = 4;
31370 self->private_impl.f_interlace = 0;
31384 self->private_data.s_decode_id_part1[0].scratch = 0;
31391 uint64_t* scratch = &self->private_data.s_decode_id_part1[0].scratch;
31407 self->private_data.f_palettes[1][((4 * v_i) + 0)] = ((uint8_t)(((v_argb >> 0) & 255)));
31408 self->private_data.f_palettes[1][((4 * v_i) + 1)] = ((uint8_t)(((v_argb >> 8) & 255)));
31409 self->private_data.f_palettes[1][((4 * v_i) + 2)] = ((uint8_t)(((v_argb >> 16) & 255)));
31410 self->private_data.f_palettes[1][((4 * v_i) + 3)] = ((uint8_t)(((v_argb >> 24) & 255)));
31414 self->private_data.f_palettes[1][((4 * v_i) + 0)] = 0;
31415 self->private_data.f_palettes[1][((4 * v_i) + 1)] = 0;
31416 self->private_data.f_palettes[1][((4 * v_i) + 2)] = 0;
31417 self->private_data.f_palettes[1][((4 * v_i) + 3)] = 255;
31420 } else if (self->private_impl.f_quirks[6] && ! self->private_impl.f_has_global_palette) {
31423 } else if (self->private_impl.f_gc_has_transparent_index) {
31424 wuffs_base__slice_u8__copy_from_slice(wuffs_base__make_slice_u8(self->private_data.f_palettes[1], 1024), wuffs_base__make_slice_u8(self->private_data.f_palettes[0], 1024));
31428 if (self->private_impl.f_gc_has_transparent_index) {
31429 self->private_data.f_palettes[1][((4 * ((uint32_t)(self->private_impl.f_gc_transparent_index))) + 0)] = 0;
31430 self->private_data.f_palettes[1][((4 * ((uint32_t)(self->private_impl.f_gc_transparent_index))) + 1)] = 0;
31431 self->private_data.f_palettes[1][((4 * ((uint32_t)(self->private_impl.f_gc_transparent_index))) + 2)] = 0;
31432 self->private_data.f_palettes[1][((4 * ((uint32_t)(self->private_impl.f_gc_transparent_index))) + 3)] = 0;
31434 v_status = wuffs_base__pixel_swizzler__prepare(&self->private_impl.f_swizzler,
31436 wuffs_base__pixel_buffer__palette_or_else(a_dst, wuffs_base__make_slice_u8(self->private_data.f_dst_palette, 1024)),
31438 wuffs_base__make_slice_u8(self->private_data.f_palettes[v_which_palette], 1024),
31450 if (self->private_impl.f_previous_lzw_decode_ended_abruptly) {
31451 wuffs_base__ignore_status(wuffs_lzw__decoder__initialize(&self->private_data.f_lzw,
31467 wuffs_lzw__decoder__set_literal_width(&self->private_data.f_lzw, ((uint32_t)(v_lw)));
31468 self->private_impl.f_previous_lzw_decode_ended_abruptly = true;
31471 self->private_impl.p_decode_id_part1[0] = 0;
31477 self->private_impl.p_decode_id_part1[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
31478 self->private_data.s_decode_id_part1[0].v_which_palette = v_which_palette;
31479 self->private_data.s_decode_id_part1[0].v_num_palette_entries = v_num_palette_entries;
31480 self->private_data.s_decode_id_part1[0].v_i = v_i;
31495 wuffs_gif__decoder* self,
31529 uint32_t coro_susp_point = self->private_impl.p_decode_id_part2[0];
31531 v_block_size = self->private_data.s_decode_id_part2[0].v_block_size;
31532 v_need_block_size = self->private_data.s_decode_id_part2[0].v_need_block_size;
31533 v_lzw_status = self->private_data.s_decode_id_part2[0].v_lzw_status;
31560 if (self->private_impl.f_compressed_ri == self->private_impl.f_compressed_wi) {
31561 self->private_impl.f_compressed_ri = 0;
31562 self->private_impl.f_compressed_wi = 0;
31564 while (self->private_impl.f_compressed_wi <= 3841) {
31570 &iop_a_src, io2_a_src,((uint32_t)((v_n_compressed & 4294967295))), wuffs_base__slice_u8__subslice_i(wuffs_base__make_slice_u8(self->private_data.f_compressed, 4096), self->private_impl.f_compressed_wi));
31571 wuffs_base__u64__sat_add_indirect(&self->private_impl.f_compressed_wi, ((uint64_t)(v_n_copied)));
31586 if ((self->private_impl.f_compressed_ri > self->private_impl.f_compressed_wi) || (self->private_impl.f_compressed_wi > 4096)) {
31602 wuffs_base__slice_u8__subslice_ij(wuffs_base__make_slice_u8(self->private_data.f_compressed,
31604 self->private_impl.f_compressed_ri,
31605 self->private_impl.f_compressed_wi),
31610 wuffs_base__status t_1 = wuffs_lzw__decoder__transform_io(&self->private_data.f_lzw, &empty_io_buffer, v_r, wuffs_base__utility__empty_slice_u8());
31614 wuffs_base__u64__sat_add_indirect(&self->private_impl.f_compressed_ri, wuffs_base__io__count_since(v_mark, ((uint64_t)(iop_v_r - io0_v_r))));
31621 v_uncompressed = wuffs_lzw__decoder__flush(&self->private_data.f_lzw);
31623 v_copy_status = wuffs_gif__decoder__copy_to_image_buffer(self, a_dst, v_uncompressed);
31630 self->private_impl.f_previous_lzw_decode_ended_abruptly = false;
31632 self->private_data.s_decode_id_part2[0].scratch = ((uint32_t)(v_block_size));
31634 if (self->private_data.s_decode_id_part2[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
31635 self->private_data.s_decode_id_part2[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
31640 iop_a_src += self->private_data.s_decode_id_part2[0].scratch;
31645 status = wuffs_gif__decoder__skip_blocks(self, a_src);
31658 } else if (self->private_impl.f_quirks[3] && (self->private_impl.f_dst_y >= self->private_impl.f_frame_rect_y1) && (self->private_impl.f_interlace == 0)) {
31660 self->private_data.s_decode_id_part2[0].scratch = ((uint32_t)(v_block_size));
31662 if (self->private_data.s_decode_id_part2[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
31663 self->private_data.s_decode_id_part2[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
31668 iop_a_src += self->private_data.s_decode_id_part2[0].scratch;
31673 status = wuffs_gif__decoder__skip_blocks(self, a_src);
31694 self->private_impl.f_compressed_ri = 0;
31695 self->private_impl.f_compressed_wi = 0;
31696 if ((self->private_impl.f_dst_y < self->private_impl.f_frame_rect_y1) && (self->private_impl.f_frame_rect_x0 != self->private_impl.f_frame_rect_x1) && (self->private_impl.f_frame_rect_y0 != self->private_impl.f_frame_rect_y1)) {
31702 self->private_impl.p_decode_id_part2[0] = 0;
31708 self->private_impl.p_decode_id_part2[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
31709 self->private_data.s_decode_id_part2[0].v_block_size = v_block_size;
31710 self->private_data.s_decode_id_part2[0].v_need_block_size = v_need_block_size;
31711 self->private_data.s_decode_id_part2[0].v_lzw_status = v_lzw_status;
31726 wuffs_gif__decoder* self,
31751 v_width_in_bytes = (((uint64_t)(self->private_impl.f_width)) * ((uint64_t)(v_bytes_per_pixel)));
31756 if (self->private_impl.f_dst_y >= self->private_impl.f_frame_rect_y1) {
31757 if (self->private_impl.f_quirks[3]) {
31762 v_dst = wuffs_base__table_u8__row_u32(v_tab, self->private_impl.f_dst_y);
31763 if (self->private_impl.f_dst_y >= self->private_impl.f_height) {
31768 v_i = (((uint64_t)(self->private_impl.f_dst_x)) * ((uint64_t)(v_bytes_per_pixel)));
31770 v_j = (((uint64_t)(self->private_impl.f_frame_rect_x1)) * ((uint64_t)(v_bytes_per_pixel)));
31776 v_n = wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, v_dst, wuffs_base__make_slice_u8(self->private_data.f_dst_palette, 1024), v_src);
31778 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_x, ((uint32_t)((v_n & 4294967295))));
31779 self->private_impl.f_dirty_max_excl_y = wuffs_base__u32__max(self->private_impl.f_dirty_max_excl_y, wuffs_base__u32__sat_add(self->private_impl.f_dst_y, 1));
31781 if (self->private_impl.f_frame_rect_x1 <= self->private_impl.f_dst_x) {
31782 self->private_impl.f_dst_x = self->private_impl.f_frame_rect_x0;
31783 if (self->private_impl.f_interlace == 0) {
31784 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_y, 1);
31787 if ((self->private_impl.f_num_decoded_frames_value == 0) && ! self->private_impl.f_gc_has_transparent_index && (self->private_impl.f_interlace > 1)) {
31788 v_replicate_src = wuffs_base__table_u8__row_u32(v_tab, self->private_impl.f_dst_y);
31789 v_replicate_y0 = wuffs_base__u32__sat_add(self->private_impl.f_dst_y, 1);
31790 v_replicate_y1 = wuffs_base__u32__sat_add(self->private_impl.f_dst_y, ((uint32_t)(WUFFS_GIF__INTERLACE_COUNT[self->private_impl.f_interlace])));
31791 v_replicate_y1 = wuffs_base__u32__min(v_replicate_y1, self->private_impl.f_frame_rect_y1);
31797 self->private_impl.f_dirty_max_excl_y = wuffs_base__u32__max(self->private_impl.f_dirty_max_excl_y, v_replicate_y1);
31799 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_y, ((uint32_t)(WUFFS_GIF__INTERLACE_DELTA[self->private_impl.f_interlace])));
31800 while ((self->private_impl.f_interlace > 0) && (self->private_impl.f_dst_y >= self->private_impl.f_frame_rect_y1)) {
31805 self->private_impl.f_interlace -= 1;
31809 self->private_impl.f_dst_y = wuffs_base__u32__sat_add(self->private_impl.f_frame_rect_y0, WUFFS_GIF__INTERLACE_START[self->private_impl.f_interlace]);
31818 v_n = ((uint64_t)((self->private_impl.f_frame_rect_x1 - self->private_impl.f_dst_x)));
31821 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_x, ((uint32_t)((v_n & 4294967295))));
31822 if (self->private_impl.f_frame_rect_x1 <= self->private_impl.f_dst_x) {
31823 self->private_impl.f_dst_x = self->private_impl.f_frame_rect_x0;
31824 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_y, ((uint32_t)(WUFFS_GIF__INTERLACE_DELTA[self->private_impl.f_interlace])));
31825 while ((self->private_impl.f_interlace > 0) && (self->private_impl.f_dst_y >= self->private_impl.f_frame_rect_y1)) {
31830 self->private_impl.f_interlace -= 1;
31834 self->private_impl.f_dst_y = wuffs_base__u32__sat_add(self->private_impl.f_frame_rect_y0, WUFFS_GIF__INTERLACE_START[self->private_impl.f_interlace]);
31882 wuffs_gzip__decoder* self,
31886 if (!self) {
31889 if (sizeof(*self) != sizeof_star_self) {
31898 // The whole point of this if-check is to detect an uninitialized *self.
31904 if (self->private_impl.magic != 0) {
31912 memset(self, 0, sizeof(*self));
31915 memset(&(self->private_impl), 0, sizeof(self->private_impl));
31921 &self->private_data.f_checksum, sizeof(self->private_data.f_checksum), WUFFS_VERSION, options);
31928 &self->private_data.f_flate, sizeof(self->private_data.f_flate), WUFFS_VERSION, options);
31933 self->private_impl.magic = WUFFS_BASE__MAGIC;
31934 self->private_impl.vtable_for__wuffs_base__io_transformer.vtable_name =
31936 self->private_impl.vtable_for__wuffs_base__io_transformer.function_pointers =
31967 wuffs_gzip__decoder* self,
31970 if (!self) {
31973 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
31978 self->private_impl.f_ignore_checksum = a_enabled;
31987 const wuffs_gzip__decoder* self) {
31988 if (!self) {
31991 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
31992 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
32003 wuffs_gzip__decoder* self,
32007 if (!self) {
32010 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
32012 (self->private_impl.magic == WUFFS_BASE__DISABLED)
32017 self->private_impl.magic = WUFFS_BASE__DISABLED;
32020 if ((self->private_impl.active_coroutine != 0) &&
32021 (self->private_impl.active_coroutine != 1)) {
32022 self->private_impl.magic = WUFFS_BASE__DISABLED;
32025 self->private_impl.active_coroutine = 0;
32062 uint32_t coro_susp_point = self->private_impl.p_transform_io[0];
32064 v_flags = self->private_data.s_transform_io[0].v_flags;
32065 v_checksum_got = self->private_data.s_transform_io[0].v_checksum_got;
32066 v_decoded_length_got = self->private_data.s_transform_io[0].v_decoded_length_got;
32067 v_checksum_want = self->private_data.s_transform_io[0].v_checksum_want;
32120 self->private_data.s_transform_io[0].scratch = 6;
32122 if (self->private_data.s_transform_io[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
32123 self->private_data.s_transform_io[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
32128 iop_a_src += self->private_data.s_transform_io[0].scratch;
32137 self->private_data.s_transform_io[0].scratch = 0;
32144 uint64_t* scratch = &self->private_data.s_transform_io[0].scratch;
32159 self->private_data.s_transform_io[0].scratch = ((uint32_t)(v_xlen));
32161 if (self->private_data.s_transform_io[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
32162 self->private_data.s_transform_io[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
32167 iop_a_src += self->private_data.s_transform_io[0].scratch;
32204 self->private_data.s_transform_io[0].scratch = 2;
32206 if (self->private_data.s_transform_io[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
32207 self->private_data.s_transform_io[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
32212 iop_a_src += self->private_data.s_transform_io[0].scratch;
32227 wuffs_base__status t_7 = wuffs_deflate__decoder__transform_io(&self->private_data.f_flate, a_dst, a_src, a_workbuf);
32236 if ( ! self->private_impl.f_ignore_checksum) {
32237 v_checksum_got = wuffs_crc32__ieee_hasher__update_u32(&self->private_data.f_checksum, wuffs_base__io__since(v_mark, ((uint64_t)(iop_a_dst - io0_a_dst)), io0_a_dst));
32254 self->private_data.s_transform_io[0].scratch = 0;
32261 uint64_t* scratch = &self->private_data.s_transform_io[0].scratch;
32283 self->private_data.s_transform_io[0].scratch = 0;
32290 uint64_t* scratch = &self->private_data.s_transform_io[0].scratch;
32305 if ( ! self->private_impl.f_ignore_checksum && ((v_checksum_got != v_checksum_want) || (v_decoded_length_got != v_decoded_length_want))) {
32311 self->private_impl.p_transform_io[0] = 0;
32317 self->private_impl.p_transform_io[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
32318 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
32319 self->private_data.s_transform_io[0].v_flags = v_flags;
32320 self->private_data.s_transform_io[0].v_checksum_got = v_checksum_got;
32321 self->private_data.s_transform_io[0].v_decoded_length_got = v_decoded_length_got;
32322 self->private_data.s_transform_io[0].v_checksum_want = v_checksum_want;
32334 self->private_impl.magic = WUFFS_BASE__DISABLED;
32601 wuffs_json__decoder* self,
32606 wuffs_json__decoder* self,
32612 wuffs_json__decoder* self,
32618 wuffs_json__decoder* self,
32624 wuffs_json__decoder* self,
32630 wuffs_json__decoder* self,
32652 wuffs_json__decoder* self,
32656 if (!self) {
32659 if (sizeof(*self) != sizeof_star_self) {
32668 // The whole point of this if-check is to detect an uninitialized *self.
32674 if (self->private_impl.magic != 0) {
32682 memset(self, 0, sizeof(*self));
32685 memset(&(self->private_impl), 0, sizeof(self->private_impl));
32689 self->private_impl.magic = WUFFS_BASE__MAGIC;
32690 self->private_impl.vtable_for__wuffs_base__token_decoder.vtable_name =
32692 self->private_impl.vtable_for__wuffs_base__token_decoder.function_pointers =
32723 wuffs_json__decoder* self,
32726 if (!self) {
32729 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
32736 self->private_impl.f_quirks[a_quirk] = a_enabled;
32746 const wuffs_json__decoder* self) {
32747 if (!self) {
32750 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
32751 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
32762 wuffs_json__decoder* self,
32766 if (!self) {
32769 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
32771 (self->private_impl.magic == WUFFS_BASE__DISABLED)
32776 self->private_impl.magic = WUFFS_BASE__DISABLED;
32779 if ((self->private_impl.active_coroutine != 0) &&
32780 (self->private_impl.active_coroutine != 1)) {
32781 self->private_impl.magic = WUFFS_BASE__DISABLED;
32784 self->private_impl.active_coroutine = 0;
32839 uint32_t coro_susp_point = self->private_impl.p_decode_tokens[0];
32841 v_depth = self->private_data.s_decode_tokens[0].v_depth;
32842 v_expect = self->private_data.s_decode_tokens[0].v_expect;
32843 v_expect_after_value = self->private_data.s_decode_tokens[0].v_expect_after_value;
32848 if (self->private_impl.f_end_of_data) {
32852 if (self->private_impl.f_quirks[18]) {
32853 if (self->private_impl.f_quirks[11] || self->private_impl.f_quirks[12] || self->private_impl.f_quirks[17]) {
32858 if (self->private_impl.f_quirks[15] || self->private_impl.f_quirks[16]) {
32866 status = wuffs_json__decoder__decode_leading(self, a_dst, a_src);
33043 if (self->private_impl.f_quirks[WUFFS_JSON__LUT_QUIRKY_BACKSLASHES_QUIRKS[(v_backslash & 7)]]) {
33090 if (self->private_impl.f_quirks[20]) {
33141 if (self->private_impl.f_quirks[20]) {
33153 } else if ((v_c == 85) && self->private_impl.f_quirks[2]) {
33200 } else if (self->private_impl.f_quirks[20]) {
33208 } else if ((v_c == 120) && self->private_impl.f_quirks[9]) {
33254 if (self->private_impl.f_quirks[20]) {
33299 if (self->private_impl.f_quirks[20]) {
33346 if (self->private_impl.f_quirks[20]) {
33395 if (self->private_impl.f_quirks[0]) {
33410 if (self->private_impl.f_quirks[20]) {
33457 if (self->private_impl.f_quirks[13]) {
33463 if (self->private_impl.f_quirks[13]) {
33482 v_number_length = wuffs_json__decoder__decode_number(self, a_src);
33508 if (self->private_impl.f_quirks[14]) {
33516 status = wuffs_json__decoder__decode_inf_nan(self, a_dst, a_src);
33558 self->private_data.f_stack[v_stack_byte] |= (((uint32_t)(1)) << v_stack_bit);
33578 if (0 == (self->private_data.f_stack[v_stack_byte] & (((uint32_t)(1)) << v_stack_bit))) {
33606 self->private_data.f_stack[v_stack_byte] &= (4294967295 ^ (((uint32_t)(1)) << v_stack_bit));
33626 if (0 == (self->private_data.f_stack[v_stack_byte] & (((uint32_t)(1)) << v_stack_bit))) {
33691 if (self->private_impl.f_quirks[14]) {
33699 status = wuffs_json__decoder__decode_inf_nan(self, a_dst, a_src);
33712 if (self->private_impl.f_quirks[11] || self->private_impl.f_quirks[12]) {
33720 status = wuffs_json__decoder__decode_comment(self, a_dst, a_src);
33730 if (self->private_impl.f_comment_type > 0) {
33745 if (self->private_impl.f_quirks[17] || self->private_impl.f_quirks[18]) {
33753 status = wuffs_json__decoder__decode_trailer(self, a_dst, a_src);
33764 self->private_impl.f_end_of_data = true;
33767 self->private_impl.p_decode_tokens[0] = 0;
33773 self->private_impl.p_decode_tokens[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
33774 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
33775 self->private_data.s_decode_tokens[0].v_depth = v_depth;
33776 self->private_data.s_decode_tokens[0].v_expect = v_expect;
33777 self->private_data.s_decode_tokens[0].v_expect_after_value = v_expect_after_value;
33789 self->private_impl.magic = WUFFS_BASE__DISABLED;
33798 wuffs_json__decoder* self,
33844 v_n = wuffs_json__decoder__decode_digits(self, a_src, v_n);
33871 v_n = wuffs_json__decoder__decode_digits(self, a_src, v_n);
33916 v_n = wuffs_json__decoder__decode_digits(self, a_src, v_n);
33933 wuffs_json__decoder* self,
33983 wuffs_json__decoder* self,
34015 uint32_t coro_susp_point = self->private_impl.p_decode_leading[0];
34019 self->private_impl.f_allow_leading_ars = self->private_impl.f_quirks[15];
34020 self->private_impl.f_allow_leading_ubom = self->private_impl.f_quirks[16];
34022 while (self->private_impl.f_allow_leading_ars || self->private_impl.f_allow_leading_ubom) {
34037 if ((v_c == 30) && self->private_impl.f_allow_leading_ars) {
34038 self->private_impl.f_allow_leading_ars = false;
34044 } else if ((v_c == 239) && self->private_impl.f_allow_leading_ubom) {
34055 self->private_impl.f_allow_leading_ubom = false;
34068 self->private_impl.p_decode_leading[0] = 0;
34074 self->private_impl.p_decode_leading[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
34092 wuffs_json__decoder* self,
34125 uint32_t coro_susp_point = self->private_impl.p_decode_comment[0];
34129 self->private_impl.f_comment_type = 0;
34145 if ((v_c2 == 10799) && self->private_impl.f_quirks[11]) {
34179 self->private_impl.f_comment_type = 1;
34195 } else if ((v_c2 == 12079) && self->private_impl.f_quirks[12]) {
34212 self->private_impl.f_comment_type = 2;
34231 self->private_impl.f_comment_type = 2;
34250 self->private_impl.p_decode_comment[0] = 0;
34256 self->private_impl.p_decode_comment[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
34274 wuffs_json__decoder* self,
34306 uint32_t coro_susp_point = self->private_impl.p_decode_inf_nan[0];
34308 v_neg = self->private_data.s_decode_inf_nan[0].v_neg;
34410 self->private_impl.p_decode_inf_nan[0] = 0;
34416 self->private_impl.p_decode_inf_nan[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
34417 self->private_data.s_decode_inf_nan[0].v_neg = v_neg;
34435 wuffs_json__decoder* self,
34467 uint32_t coro_susp_point = self->private_impl.p_decode_trailer[0];
34471 if (self->private_impl.f_quirks[18]) {
34472 self->private_impl.f_trailer_stop = 10;
34474 self->private_impl.f_trailer_stop = 0;
34508 if (self->private_impl.f_trailer_stop > 0) {
34519 status = wuffs_json__decoder__decode_comment(self, a_dst, a_src);
34531 if (self->private_impl.f_comment_type > 0) {
34538 if ((v_whitespace_length >= 65534) || (v_c == self->private_impl.f_trailer_stop)) {
34543 if (v_c == self->private_impl.f_trailer_stop) {
34555 self->private_impl.p_decode_trailer[0] = 0;
34561 self->private_impl.p_decode_trailer[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
34593 wuffs_nie__decoder* self,
34637 wuffs_nie__decoder* self,
34641 if (!self) {
34644 if (sizeof(*self) != sizeof_star_self) {
34653 // The whole point of this if-check is to detect an uninitialized *self.
34659 if (self->private_impl.magic != 0) {
34667 memset(self, 0, sizeof(*self));
34670 memset(&(self->private_impl), 0, sizeof(self->private_impl));
34674 self->private_impl.magic = WUFFS_BASE__MAGIC;
34675 self->private_impl.vtable_for__wuffs_base__image_decoder.vtable_name =
34677 self->private_impl.vtable_for__wuffs_base__image_decoder.function_pointers =
34708 wuffs_nie__decoder* self,
34718 wuffs_nie__decoder* self,
34721 if (!self) {
34724 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
34726 (self->private_impl.magic == WUFFS_BASE__DISABLED)
34731 self->private_impl.magic = WUFFS_BASE__DISABLED;
34734 if ((self->private_impl.active_coroutine != 0) &&
34735 (self->private_impl.active_coroutine != 1)) {
34736 self->private_impl.magic = WUFFS_BASE__DISABLED;
34739 self->private_impl.active_coroutine = 0;
34755 uint32_t coro_susp_point = self->private_impl.p_decode_image_config[0];
34759 if (self->private_impl.f_call_sequence != 0) {
34770 self->private_data.s_decode_image_config[0].scratch = 0;
34777 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
34803 self->private_data.s_decode_image_config[0].scratch = 0;
34810 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
34826 self->private_impl.f_pixfmt = 2164295816;
34828 self->private_impl.f_pixfmt = 2164308923;
34846 self->private_data.s_decode_image_config[0].scratch = 0;
34853 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
34872 self->private_impl.f_width = v_a;
34880 self->private_data.s_decode_image_config[0].scratch = 0;
34887 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
34906 self->private_impl.f_height = v_a;
34910 self->private_impl.f_pixfmt,
34912 self->private_impl.f_width,
34913 self->private_impl.f_height,
34917 self->private_impl.f_call_sequence = 3;
34921 self->private_impl.p_decode_image_config[0] = 0;
34927 self->private_impl.p_decode_image_config[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
34928 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
34937 self->private_impl.magic = WUFFS_BASE__DISABLED;
34946 wuffs_nie__decoder* self,
34949 if (!self) {
34952 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
34954 (self->private_impl.magic == WUFFS_BASE__DISABLED)
34959 self->private_impl.magic = WUFFS_BASE__DISABLED;
34962 if ((self->private_impl.active_coroutine != 0) &&
34963 (self->private_impl.active_coroutine != 2)) {
34964 self->private_impl.magic = WUFFS_BASE__DISABLED;
34967 self->private_impl.active_coroutine = 0;
34981 uint32_t coro_susp_point = self->private_impl.p_decode_frame_config[0];
34985 if (self->private_impl.f_call_sequence < 3) {
34990 status = wuffs_nie__decoder__decode_image_config(self, NULL, a_src);
34997 } else if (self->private_impl.f_call_sequence == 3) {
35002 } else if (self->private_impl.f_call_sequence == 4) {
35003 self->private_impl.f_call_sequence = 255;
35016 self->private_impl.f_width,
35017 self->private_impl.f_height),
35026 self->private_impl.f_call_sequence = 4;
35029 self->private_impl.p_decode_frame_config[0] = 0;
35035 self->private_impl.p_decode_frame_config[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
35036 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 2 : 0;
35045 self->private_impl.magic = WUFFS_BASE__DISABLED;
35054 wuffs_nie__decoder* self,
35060 if (!self) {
35063 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
35065 (self->private_impl.magic == WUFFS_BASE__DISABLED)
35070 self->private_impl.magic = WUFFS_BASE__DISABLED;
35073 if ((self->private_impl.active_coroutine != 0) &&
35074 (self->private_impl.active_coroutine != 3)) {
35075 self->private_impl.magic = WUFFS_BASE__DISABLED;
35078 self->private_impl.active_coroutine = 0;
35083 uint32_t coro_susp_point = self->private_impl.p_decode_frame[0];
35087 if (self->private_impl.f_call_sequence < 4) {
35089 status = wuffs_nie__decoder__decode_frame_config(self, NULL, a_src);
35093 } else if (self->private_impl.f_call_sequence == 4) {
35098 self->private_impl.f_dst_x = 0;
35099 self->private_impl.f_dst_y = 0;
35100 v_status = wuffs_base__pixel_swizzler__prepare(&self->private_impl.f_swizzler,
35103 wuffs_base__utility__make_pixel_format(self->private_impl.f_pixfmt),
35117 v_status = wuffs_nie__decoder__swizzle(self, a_dst, a_src);
35134 self->private_impl.f_call_sequence = 255;
35137 self->private_impl.p_decode_frame[0] = 0;
35143 self->private_impl.p_decode_frame[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
35144 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 3 : 0;
35149 self->private_impl.magic = WUFFS_BASE__DISABLED;
35158 wuffs_nie__decoder* self,
35190 v_dst_bytes_per_row = (((uint64_t)(self->private_impl.f_width)) * v_dst_bytes_per_pixel);
35194 if (self->private_impl.f_dst_x == self->private_impl.f_width) {
35195 self->private_impl.f_dst_x = 0;
35196 self->private_impl.f_dst_y += 1;
35197 if (self->private_impl.f_dst_y >= self->private_impl.f_height) {
35201 v_dst = wuffs_base__table_u8__row_u32(v_tab, self->private_impl.f_dst_y);
35205 v_i = (((uint64_t)(self->private_impl.f_dst_x)) * v_dst_bytes_per_pixel);
35210 &self->private_impl.f_swizzler,
35219 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_dst_x, ((uint32_t)((v_n & 4294967295))));
35239 const wuffs_nie__decoder* self) {
35240 if (!self) {
35243 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
35244 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
35251 self->private_impl.f_width,
35252 self->private_impl.f_height);
35259 const wuffs_nie__decoder* self) {
35260 if (!self) {
35263 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
35264 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
35275 const wuffs_nie__decoder* self) {
35276 if (!self) {
35279 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
35280 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
35284 if (self->private_impl.f_call_sequence > 3) {
35294 const wuffs_nie__decoder* self) {
35295 if (!self) {
35298 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
35299 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
35303 if (self->private_impl.f_call_sequence > 4) {
35313 wuffs_nie__decoder* self,
35316 if (!self) {
35319 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
35321 (self->private_impl.magic == WUFFS_BASE__DISABLED)
35326 if (self->private_impl.f_call_sequence < 3) {
35332 self->private_impl.f_call_sequence = 3;
35340 wuffs_nie__decoder* self,
35350 wuffs_nie__decoder* self,
35354 if (!self) {
35357 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
35359 (self->private_impl.magic == WUFFS_BASE__DISABLED)
35364 self->private_impl.magic = WUFFS_BASE__DISABLED;
35367 if ((self->private_impl.active_coroutine != 0) &&
35368 (self->private_impl.active_coroutine != 4)) {
35369 self->private_impl.magic = WUFFS_BASE__DISABLED;
35372 self->private_impl.active_coroutine = 0;
35383 self->private_impl.magic = WUFFS_BASE__DISABLED;
35392 const wuffs_nie__decoder* self) {
35393 if (!self) {
35396 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
35397 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
35445 wuffs_zlib__decoder* self,
35449 if (!self) {
35452 if (sizeof(*self) != sizeof_star_self) {
35461 // The whole point of this if-check is to detect an uninitialized *self.
35467 if (self->private_impl.magic != 0) {
35475 memset(self, 0, sizeof(*self));
35478 memset(&(self->private_impl), 0, sizeof(self->private_impl));
35484 &self->private_data.f_checksum, sizeof(self->private_data.f_checksum), WUFFS_VERSION, options);
35491 &self->private_data.f_dict_id_hasher, sizeof(self->private_data.f_dict_id_hasher), WUFFS_VERSION, options);
35498 &self->private_data.f_flate, sizeof(self->private_data.f_flate), WUFFS_VERSION, options);
35503 self->private_impl.magic = WUFFS_BASE__MAGIC;
35504 self->private_impl.vtable_for__wuffs_base__io_transformer.vtable_name =
35506 self->private_impl.vtable_for__wuffs_base__io_transformer.function_pointers =
35537 const wuffs_zlib__decoder* self) {
35538 if (!self) {
35541 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
35542 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
35546 return self->private_impl.f_dict_id_want;
35553 wuffs_zlib__decoder* self,
35555 if (!self) {
35558 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
35562 if (self->private_impl.f_header_complete) {
35563 self->private_impl.f_bad_call_sequence = true;
35565 self->private_impl.f_dict_id_got = wuffs_adler32__hasher__update_u32(&self->private_data.f_dict_id_hasher, a_dict);
35566 wuffs_deflate__decoder__add_history(&self->private_data.f_flate, a_dict);
35568 self->private_impl.f_got_dictionary = true;
35576 wuffs_zlib__decoder* self,
35579 if (!self) {
35582 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
35586 if (self->private_impl.f_header_complete) {
35587 self->private_impl.f_bad_call_sequence = true;
35589 self->private_impl.f_ignore_checksum = a_enabled;
35593 self->private_impl.f_quirks[a_quirk] = a_enabled;
35603 const wuffs_zlib__decoder* self) {
35604 if (!self) {
35607 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
35608 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
35619 wuffs_zlib__decoder* self,
35623 if (!self) {
35626 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
35628 (self->private_impl.magic == WUFFS_BASE__DISABLED)
35633 self->private_impl.magic = WUFFS_BASE__DISABLED;
35636 if ((self->private_impl.active_coroutine != 0) &&
35637 (self->private_impl.active_coroutine != 1)) {
35638 self->private_impl.magic = WUFFS_BASE__DISABLED;
35641 self->private_impl.active_coroutine = 0;
35674 uint32_t coro_susp_point = self->private_impl.p_transform_io[0];
35676 v_checksum_got = self->private_data.s_transform_io[0].v_checksum_got;
35681 if (self->private_impl.f_bad_call_sequence) {
35684 } else if (self->private_impl.f_quirks[0]) {
35685 } else if ( ! self->private_impl.f_want_dictionary) {
35693 self->private_data.s_transform_io[0].scratch = 0;
35700 uint64_t* scratch = &self->private_data.s_transform_io[0].scratch;
35727 self->private_impl.f_want_dictionary = ((v_x & 32) != 0);
35728 if (self->private_impl.f_want_dictionary) {
35729 self->private_impl.f_dict_id_got = 1;
35737 self->private_data.s_transform_io[0].scratch = 0;
35744 uint64_t* scratch = &self->private_data.s_transform_io[0].scratch;
35757 self->private_impl.f_dict_id_want = t_1;
35761 } else if (self->private_impl.f_got_dictionary) {
35765 } else if (self->private_impl.f_dict_id_got != self->private_impl.f_dict_id_want) {
35766 if (self->private_impl.f_got_dictionary) {
35773 self->private_impl.f_header_complete = true;
35783 wuffs_base__status t_2 = wuffs_deflate__decoder__transform_io(&self->private_data.f_flate, a_dst, a_src, a_workbuf);
35792 if ( ! self->private_impl.f_ignore_checksum && ! self->private_impl.f_quirks[0]) {
35793 v_checksum_got = wuffs_adler32__hasher__update_u32(&self->private_data.f_checksum, wuffs_base__io__since(v_mark, ((uint64_t)(iop_a_dst - io0_a_dst)), io0_a_dst));
35802 if ( ! self->private_impl.f_quirks[0]) {
35810 self->private_data.s_transform_io[0].scratch = 0;
35817 uint64_t* scratch = &self->private_data.s_transform_io[0].scratch;
35832 if ( ! self->private_impl.f_ignore_checksum && (v_checksum_got != v_checksum_want)) {
35839 self->private_impl.p_transform_io[0] = 0;
35845 self->private_impl.p_transform_io[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
35846 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
35847 self->private_data.s_transform_io[0].v_checksum_got = v_checksum_got;
35859 self->private_impl.magic = WUFFS_BASE__DISABLED;
35968 wuffs_png__decoder* self,
35975 wuffs_png__decoder* self,
35983 wuffs_png__decoder* self,
35991 wuffs_png__decoder* self,
35998 wuffs_png__decoder* self,
36003 wuffs_png__decoder* self,
36008 wuffs_png__decoder* self,
36013 wuffs_png__decoder* self,
36018 wuffs_png__decoder* self,
36024 wuffs_png__decoder* self,
36030 wuffs_png__decoder* self,
36036 wuffs_png__decoder* self,
36042 wuffs_png__decoder* self,
36048 wuffs_png__decoder* self,
36054 wuffs_png__decoder* self,
36060 wuffs_png__decoder* self,
36066 wuffs_png__decoder* self,
36073 wuffs_png__decoder* self,
36080 wuffs_png__decoder* self,
36088 wuffs_png__decoder* self,
36096 wuffs_png__decoder* self,
36103 wuffs_png__decoder* self,
36108 wuffs_png__decoder* self);
36112 const wuffs_png__decoder* self,
36117 wuffs_png__decoder* self);
36121 wuffs_png__decoder* self,
36126 wuffs_png__decoder* self,
36131 wuffs_png__decoder* self,
36136 wuffs_png__decoder* self,
36141 wuffs_png__decoder* self,
36146 wuffs_png__decoder* self,
36151 wuffs_png__decoder* self,
36156 wuffs_png__decoder* self,
36161 wuffs_png__decoder* self,
36166 wuffs_png__decoder* self,
36171 wuffs_png__decoder* self,
36176 wuffs_png__decoder* self,
36182 wuffs_png__decoder* self,
36188 wuffs_png__decoder* self,
36194 wuffs_png__decoder* self,
36238 wuffs_png__decoder* self,
36242 if (!self) {
36245 if (sizeof(*self) != sizeof_star_self) {
36254 // The whole point of this if-check is to detect an uninitialized *self.
36260 if (self->private_impl.magic != 0) {
36268 memset(self, 0, sizeof(*self));
36271 memset(&(self->private_impl), 0, sizeof(self->private_impl));
36275 self->private_impl.choosy_filter_1 = &wuffs_png__decoder__filter_1__choosy_default;
36276 self->private_impl.choosy_filter_3 = &wuffs_png__decoder__filter_3__choosy_default;
36277 self->private_impl.choosy_filter_4 = &wuffs_png__decoder__filter_4__choosy_default;
36278 self->private_impl.choosy_filter_and_swizzle = &wuffs_png__decoder__filter_and_swizzle__choosy_default;
36282 &self->private_data.f_crc32, sizeof(self->private_data.f_crc32), WUFFS_VERSION, options);
36289 &self->private_data.f_zlib, sizeof(self->private_data.f_zlib), WUFFS_VERSION, options);
36294 self->private_impl.magic = WUFFS_BASE__MAGIC;
36295 self->private_impl.vtable_for__wuffs_base__image_decoder.vtable_name =
36297 self->private_impl.vtable_for__wuffs_base__image_decoder.function_pointers =
36330 wuffs_png__decoder* self,
36375 wuffs_png__decoder* self,
36466 wuffs_png__decoder* self,
36586 wuffs_png__decoder* self,
36684 wuffs_png__decoder* self,
36686 return (*self->private_impl.choosy_filter_1)(self, a_curr);
36691 wuffs_png__decoder* self,
36698 v_filter_distance = ((uint64_t)(self->private_impl.f_filter_distance));
36717 wuffs_png__decoder* self,
36765 wuffs_png__decoder* self,
36798 wuffs_png__decoder* self,
36817 wuffs_png__decoder* self,
36820 return (*self->private_impl.choosy_filter_3)(self, a_curr, a_prev);
36825 wuffs_png__decoder* self,
36832 v_filter_distance = ((uint64_t)(self->private_impl.f_filter_distance));
36859 wuffs_png__decoder* self,
36955 wuffs_png__decoder* self,
37017 wuffs_png__decoder* self,
37020 return (*self->private_impl.choosy_filter_4)(self, a_curr, a_prev);
37025 wuffs_png__decoder* self,
37039 v_filter_distance = ((uint64_t)(self->private_impl.f_filter_distance));
37080 wuffs_png__decoder* self,
37199 wuffs_png__decoder* self,
37351 wuffs_png__decoder* self,
37397 wuffs_png__decoder* self,
37502 wuffs_png__decoder* self,
37628 wuffs_png__decoder* self,
37729 wuffs_png__decoder* self,
37732 if (!self) {
37735 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
37740 self->private_impl.f_ignore_checksum = a_enabled;
37741 wuffs_zlib__decoder__set_quirk_enabled(&self->private_data.f_zlib, a_quirk, a_enabled);
37750 wuffs_png__decoder* self,
37753 if (!self) {
37756 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
37758 (self->private_impl.magic == WUFFS_BASE__DISABLED)
37763 self->private_impl.magic = WUFFS_BASE__DISABLED;
37766 if ((self->private_impl.active_coroutine != 0) &&
37767 (self->private_impl.active_coroutine != 1)) {
37768 self->private_impl.magic = WUFFS_BASE__DISABLED;
37771 self->private_impl.active_coroutine = 0;
37791 uint32_t coro_susp_point = self->private_impl.p_decode_image_config[0];
37793 v_checksum_have = self->private_data.s_decode_image_config[0].v_checksum_have;
37798 if (self->private_impl.f_call_sequence == 2) {
37799 if (self->private_impl.f_metadata_fourcc != 0) {
37800 self->private_impl.f_call_sequence = 1;
37804 } else if (self->private_impl.f_call_sequence != 0) {
37815 self->private_data.s_decode_image_config[0].scratch = 0;
37822 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
37848 self->private_data.s_decode_image_config[0].scratch = 0;
37855 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
37874 self->private_impl.f_chunk_type_array[0] = 73;
37875 self->private_impl.f_chunk_type_array[1] = 72;
37876 self->private_impl.f_chunk_type_array[2] = 68;
37877 self->private_impl.f_chunk_type_array[3] = 82;
37878 wuffs_base__ignore_status(wuffs_crc32__ieee_hasher__initialize(&self->private_data.f_crc32,
37880 wuffs_crc32__ieee_hasher__update_u32(&self->private_data.f_crc32, wuffs_base__make_slice_u8(self->private_impl.f_chunk_type_array, 4));
37887 wuffs_base__status t_2 = wuffs_png__decoder__decode_ihdr(self, a_src);
37893 if ( ! self->private_impl.f_ignore_checksum) {
37894 v_checksum_have = wuffs_crc32__ieee_hasher__update_u32(&self->private_data.f_crc32, wuffs_base__io__since(v_mark, ((uint64_t)(iop_a_src - io0_a_src)), io0_a_src));
37910 self->private_data.s_decode_image_config[0].scratch = 0;
37917 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
37932 if ( ! self->private_impl.f_ignore_checksum && (v_checksum_have != v_checksum_want)) {
37946 self->private_impl.f_chunk_length = wuffs_base__peek_u32be__no_bounds_check(iop_a_src);
37947 self->private_impl.f_chunk_type = ((uint32_t)((wuffs_base__peek_u64le__no_bounds_check(iop_a_src) >> 32)));
37948 if (self->private_impl.f_chunk_type == 1413563465) {
37949 if ( ! self->private_impl.f_seen_actl || self->private_impl.f_seen_fctl) {
37952 self->private_impl.f_seen_idat = true;
37953 } else if (self->private_impl.f_chunk_type == 1413571686) {
37954 if (self->private_impl.f_seen_idat && self->private_impl.f_seen_fctl) {
37961 if ( ! self->private_impl.f_ignore_checksum && ((self->private_impl.f_chunk_type & 32) == 0)) {
37962 self->private_impl.f_chunk_type_array[0] = ((uint8_t)(((self->private_impl.f_chunk_type >> 0) & 255)));
37963 self->private_impl.f_chunk_type_array[1] = ((uint8_t)(((self->private_impl.f_chunk_type >> 8) & 255)));
37964 self->private_impl.f_chunk_type_array[2] = ((uint8_t)(((self->private_impl.f_chunk_type >> 16) & 255)));
37965 self->private_impl.f_chunk_type_array[3] = ((uint8_t)(((self->private_impl.f_chunk_type >> 24) & 255)));
37966 wuffs_base__ignore_status(wuffs_crc32__ieee_hasher__initialize(&self->private_data.f_crc32,
37968 wuffs_crc32__ieee_hasher__update_u32(&self->private_data.f_crc32, wuffs_base__make_slice_u8(self->private_impl.f_chunk_type_array, 4));
37976 wuffs_base__status t_4 = wuffs_png__decoder__decode_other_chunk(self, a_src);
37982 if ( ! self->private_impl.f_ignore_checksum && ((self->private_impl.f_chunk_type & 32) == 0)) {
37983 v_checksum_have = wuffs_crc32__ieee_hasher__update_u32(&self->private_data.f_crc32, wuffs_base__io__since(v_mark, ((uint64_t)(iop_a_src - io0_a_src)), io0_a_src));
37992 if (self->private_impl.f_metadata_fourcc != 0) {
37993 self->private_impl.f_call_sequence = 1;
38004 self->private_data.s_decode_image_config[0].scratch = 0;
38011 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
38026 if ( ! self->private_impl.f_ignore_checksum && ((self->private_impl.f_chunk_type & 32) == 0) && (v_checksum_have != v_checksum_want)) {
38032 if ((self->private_impl.f_color_type == 3) && ! self->private_impl.f_seen_plte) {
38036 self->private_impl.f_frame_config_io_position = wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)));
38037 self->private_impl.f_first_config_io_position = self->private_impl.f_frame_config_io_position;
38041 self->private_impl.f_dst_pixfmt,
38043 self->private_impl.f_width,
38044 self->private_impl.f_height,
38045 self->private_impl.f_first_config_io_position,
38046 ((self->private_impl.f_color_type <= 3) && ! self->private_impl.f_seen_trns));
38048 if ( ! self->private_impl.f_seen_actl) {
38049 self->private_impl.f_num_animation_frames_value = 1;
38050 self->private_impl.f_first_rect_x0 = 0;
38051 self->private_impl.f_first_rect_y0 = 0;
38052 self->private_impl.f_first_rect_x1 = self->private_impl.f_width;
38053 self->private_impl.f_first_rect_y1 = self->private_impl.f_height;
38054 self->private_impl.f_first_duration = 0;
38055 self->private_impl.f_first_disposal = 0;
38056 self->private_impl.f_first_overwrite_instead_of_blend = false;
38058 self->private_impl.f_call_sequence = 3;
38061 self->private_impl.p_decode_image_config[0] = 0;
38067 self->private_impl.p_decode_image_config[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
38068 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
38069 self->private_data.s_decode_image_config[0].v_checksum_have = v_checksum_have;
38078 self->private_impl.magic = WUFFS_BASE__DISABLED;
38087 wuffs_png__decoder* self,
38105 uint32_t coro_susp_point = self->private_impl.p_decode_ihdr[0];
38116 self->private_data.s_decode_ihdr[0].scratch = 0;
38123 uint64_t* scratch = &self->private_data.s_decode_ihdr[0].scratch;
38145 self->private_impl.f_width = v_a32;
38153 self->private_data.s_decode_ihdr[0].scratch = 0;
38160 uint64_t* scratch = &self->private_data.s_decode_ihdr[0].scratch;
38182 self->private_impl.f_height = v_a32;
38196 self->private_impl.f_depth = v_a8;
38210 self->private_impl.f_color_type = v_a8;
38247 self->private_impl.f_interlace_pass = 0;
38249 self->private_impl.f_interlace_pass = 1;
38250 self->private_impl.choosy_filter_and_swizzle = (
38256 self->private_impl.f_filter_distance = 0;
38257 wuffs_png__decoder__assign_filter_distance(self);
38258 if (self->private_impl.f_filter_distance == 0) {
38262 self->private_impl.f_overall_workbuf_length = (((uint64_t)(self->private_impl.f_height)) * (1 + wuffs_png__decoder__calculate_bytes_per_row(self, self->private_impl.f_width)));
38263 wuffs_png__decoder__choose_filter_implementations(self);
38267 self->private_impl.p_decode_ihdr[0] = 0;
38273 self->private_impl.p_decode_ihdr[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
38288 wuffs_png__decoder* self) {
38289 if (self->private_impl.f_depth < 8) {
38290 if ((self->private_impl.f_depth != 1) && (self->private_impl.f_depth != 2) && (self->private_impl.f_depth != 4)) {
38292 } else if (self->private_impl.f_color_type == 0) {
38293 self->private_impl.f_dst_pixfmt = 536870920;
38294 self->private_impl.f_src_pixfmt = 536870920;
38295 } else if (self->private_impl.f_color_type == 3) {
38296 self->private_impl.f_dst_pixfmt = 2198077448;
38297 self->private_impl.f_src_pixfmt = 2198077448;
38301 self->private_impl.f_filter_distance = 1;
38302 self->private_impl.choosy_filter_and_swizzle = (
38304 } else if (self->private_impl.f_color_type == 0) {
38305 if (self->private_impl.f_depth == 8) {
38306 self->private_impl.f_dst_pixfmt = 536870920;
38307 self->private_impl.f_src_pixfmt = 536870920;
38308 self->private_impl.f_filter_distance = 1;
38309 } else if (self->private_impl.f_depth == 16) {
38310 if (self->private_impl.f_interlace_pass == 0) {
38311 self->private_impl.f_dst_pixfmt = 536870923;
38312 self->private_impl.f_src_pixfmt = 537919499;
38314 self->private_impl.f_dst_pixfmt = 2164308923;
38315 self->private_impl.f_src_pixfmt = 2164308923;
38317 self->private_impl.f_filter_distance = 2;
38319 } else if (self->private_impl.f_color_type == 2) {
38320 if (self->private_impl.f_depth == 8) {
38321 self->private_impl.f_dst_pixfmt = 2147485832;
38322 self->private_impl.f_src_pixfmt = 2684356744;
38323 self->private_impl.f_filter_distance = 3;
38324 } else if (self->private_impl.f_depth == 16) {
38325 self->private_impl.f_dst_pixfmt = 2164308923;
38326 self->private_impl.f_src_pixfmt = 2164308923;
38327 self->private_impl.f_filter_distance = 6;
38328 self->private_impl.choosy_filter_and_swizzle = (
38331 } else if (self->private_impl.f_color_type == 3) {
38332 if (self->private_impl.f_depth == 8) {
38333 self->private_impl.f_dst_pixfmt = 2198077448;
38334 self->private_impl.f_src_pixfmt = 2198077448;
38335 self->private_impl.f_filter_distance = 1;
38337 } else if (self->private_impl.f_color_type == 4) {
38338 if (self->private_impl.f_depth == 8) {
38339 self->private_impl.f_dst_pixfmt = 2164295816;
38340 self->private_impl.f_src_pixfmt = 2164295816;
38341 self->private_impl.f_filter_distance = 2;
38342 self->private_impl.choosy_filter_and_swizzle = (
38344 } else if (self->private_impl.f_depth == 16) {
38345 self->private_impl.f_dst_pixfmt = 2164308923;
38346 self->private_impl.f_src_pixfmt = 2164308923;
38347 self->private_impl.f_filter_distance = 4;
38348 self->private_impl.choosy_filter_and_swizzle = (
38351 } else if (self->private_impl.f_color_type == 6) {
38352 if (self->private_impl.f_depth == 8) {
38353 self->private_impl.f_dst_pixfmt = 2164295816;
38354 self->private_impl.f_src_pixfmt = 2701166728;
38355 self->private_impl.f_filter_distance = 4;
38356 } else if (self->private_impl.f_depth == 16) {
38357 self->private_impl.f_dst_pixfmt = 2164308923;
38358 self->private_impl.f_src_pixfmt = 2164308923;
38359 self->private_impl.f_filter_distance = 8;
38360 self->private_impl.choosy_filter_and_swizzle = (
38371 const wuffs_png__decoder* self,
38375 if (self->private_impl.f_depth == 1) {
38377 } else if (self->private_impl.f_depth == 2) {
38379 } else if (self->private_impl.f_depth == 4) {
38382 v_bytes_per_channel = ((uint64_t)((self->private_impl.f_depth >> 3)));
38383 return (((uint64_t)(a_width)) * v_bytes_per_channel * ((uint64_t)(WUFFS_PNG__NUM_CHANNELS[self->private_impl.f_color_type])));
38390 wuffs_png__decoder* self) {
38391 if (self->private_impl.f_filter_distance == 3) {
38392 self->private_impl.choosy_filter_1 = (
38394 self->private_impl.choosy_filter_3 = (
38396 self->private_impl.choosy_filter_4 = (
38404 } else if (self->private_impl.f_filter_distance == 4) {
38405 self->private_impl.choosy_filter_1 = (
38413 self->private_impl.choosy_filter_3 = (
38421 self->private_impl.choosy_filter_4 = (
38437 wuffs_png__decoder* self,
38452 uint32_t coro_susp_point = self->private_impl.p_decode_other_chunk[0];
38456 if (self->private_impl.f_chunk_type == 1163152464) {
38457 if (self->private_impl.f_seen_plte) {
38460 } else if (self->private_impl.f_color_type == 3) {
38465 status = wuffs_png__decoder__decode_plte(self, a_src);
38472 } else if ((self->private_impl.f_color_type == 2) || (self->private_impl.f_color_type == 6)) {
38477 self->private_impl.f_seen_plte = true;
38478 } else if ((self->private_impl.f_chunk_type & 32) == 0) {
38479 if (self->private_impl.f_chunk_type != 1413563465) {
38483 } else if (self->private_impl.f_chunk_type == 1280598881) {
38484 if (self->private_impl.f_seen_actl) {
38492 status = wuffs_png__decoder__decode_actl(self, a_src);
38499 self->private_impl.f_seen_actl = true;
38500 } else if (self->private_impl.f_chunk_type == 1297238115) {
38501 if (self->private_impl.f_report_metadata_chrm) {
38502 if (self->private_impl.f_seen_chrm) {
38510 status = wuffs_png__decoder__decode_chrm(self, a_src);
38517 self->private_impl.f_seen_chrm = true;
38519 } else if (self->private_impl.f_chunk_type == 1716082789) {
38520 if (self->private_impl.f_report_metadata_exif) {
38521 if (self->private_impl.f_seen_exif) {
38529 status = wuffs_png__decoder__decode_exif(self, a_src);
38536 self->private_impl.f_seen_exif = true;
38538 } else if (self->private_impl.f_chunk_type == 1280598886) {
38539 if (self->private_impl.f_seen_fctl) {
38547 status = wuffs_png__decoder__decode_fctl(self, a_src);
38554 self->private_impl.f_seen_fctl = true;
38555 } else if (self->private_impl.f_chunk_type == 1095582055) {
38556 if (self->private_impl.f_report_metadata_gama) {
38557 if (self->private_impl.f_seen_gama) {
38565 status = wuffs_png__decoder__decode_gama(self, a_src);
38572 self->private_impl.f_seen_gama = true;
38574 } else if (self->private_impl.f_chunk_type == 1346585449) {
38575 if (self->private_impl.f_report_metadata_iccp) {
38576 if (self->private_impl.f_seen_iccp) {
38584 status = wuffs_png__decoder__decode_iccp(self, a_src);
38591 self->private_impl.f_seen_iccp = true;
38593 } else if (self->private_impl.f_chunk_type == 1111970419) {
38594 if (self->private_impl.f_report_metadata_srgb) {
38595 if (self->private_impl.f_seen_srgb) {
38603 status = wuffs_png__decoder__decode_srgb(self, a_src);
38610 self->private_impl.f_seen_srgb = true;
38612 } else if (self->private_impl.f_chunk_type == 1397641844) {
38613 if (self->private_impl.f_seen_trns || (self->private_impl.f_color_type > 3) || ((self->private_impl.f_color_type == 3) && ! self->private_impl.f_seen_plte)) {
38621 status = wuffs_png__decoder__decode_trns(self, a_src);
38628 self->private_impl.f_seen_trns = true;
38629 } else if ((self->private_impl.f_chunk_type == 1951945833) || (self->private_impl.f_chunk_type == 1951942004) || (self->private_impl.f_chunk_type == 1951945850)) {
38630 if (self->private_impl.f_report_metadata_kvp) {
38631 self->private_impl.f_metadata_flavor = 4;
38632 self->private_impl.f_metadata_fourcc = 1263947851;
38633 self->private_impl.f_metadata_x = 0;
38634 self->private_impl.f_metadata_y = 0;
38635 self->private_impl.f_metadata_z = 0;
38638 if (self->private_impl.f_metadata_fourcc == 0) {
38639 self->private_data.s_decode_other_chunk[0].scratch = self->private_impl.f_chunk_length;
38641 if (self->private_data.s_decode_other_chunk[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
38642 self->private_data.s_decode_other_chunk[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
38647 iop_a_src += self->private_data.s_decode_other_chunk[0].scratch;
38652 self->private_impl.p_decode_other_chunk[0] = 0;
38658 self->private_impl.p_decode_other_chunk[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
38673 wuffs_png__decoder* self,
38688 uint32_t coro_susp_point = self->private_impl.p_decode_actl[0];
38692 if (self->private_impl.f_chunk_length != 8) {
38695 } else if (self->private_impl.f_interlace_pass > 0) {
38699 self->private_impl.f_chunk_length = 0;
38707 self->private_data.s_decode_actl[0].scratch = 0;
38714 uint64_t* scratch = &self->private_data.s_decode_actl[0].scratch;
38727 self->private_impl.f_num_animation_frames_value = t_0;
38729 if (self->private_impl.f_num_animation_frames_value == 0) {
38740 self->private_data.s_decode_actl[0].scratch = 0;
38747 uint64_t* scratch = &self->private_data.s_decode_actl[0].scratch;
38760 self->private_impl.f_num_animation_loops_value = t_1;
38765 self->private_impl.p_decode_actl[0] = 0;
38771 self->private_impl.p_decode_actl[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
38786 wuffs_png__decoder* self,
38803 uint32_t coro_susp_point = self->private_impl.p_decode_chrm[0];
38807 if (self->private_impl.f_chunk_length != 32) {
38811 self->private_impl.f_chunk_length = 0;
38812 self->private_impl.f_metadata_flavor = 5;
38813 self->private_impl.f_metadata_fourcc = 1128813133;
38814 self->private_impl.f_metadata_x = 0;
38815 self->private_impl.f_metadata_y = 0;
38816 self->private_impl.f_metadata_z = 0;
38824 self->private_data.s_decode_chrm[0].scratch = 0;
38831 uint64_t* scratch = &self->private_data.s_decode_chrm[0].scratch;
38846 self->private_impl.f_metadata_x |= ((16777215 & v_u) << 0);
38854 self->private_data.s_decode_chrm[0].scratch = 0;
38861 uint64_t* scratch = &self->private_data.s_decode_chrm[0].scratch;
38876 self->private_impl.f_metadata_x |= ((16777215 & v_u) << 24);
38884 self->private_data.s_decode_chrm[0].scratch = 0;
38891 uint64_t* scratch = &self->private_data.s_decode_chrm[0].scratch;
38906 self->private_impl.f_metadata_x |= ((uint64_t)((16777215 & v_u) << 48));
38907 self->private_impl.f_metadata_y |= ((16777215 & v_u) >> 16);
38915 self->private_data.s_decode_chrm[0].scratch = 0;
38922 uint64_t* scratch = &self->private_data.s_decode_chrm[0].scratch;
38937 self->private_impl.f_metadata_y |= ((16777215 & v_u) << 8);
38945 self->private_data.s_decode_chrm[0].scratch = 0;
38952 uint64_t* scratch = &self->private_data.s_decode_chrm[0].scratch;
38967 self->private_impl.f_metadata_y |= ((16777215 & v_u) << 32);
38975 self->private_data.s_decode_chrm[0].scratch = 0;
38982 uint64_t* scratch = &self->private_data.s_decode_chrm[0].scratch;
38997 self->private_impl.f_metadata_y |= ((uint64_t)((16777215 & v_u) << 56));
38998 self->private_impl.f_metadata_z |= ((16777215 & v_u) >> 8);
39006 self->private_data.s_decode_chrm[0].scratch = 0;
39013 uint64_t* scratch = &self->private_data.s_decode_chrm[0].scratch;
39028 self->private_impl.f_metadata_z |= ((16777215 & v_u) << 16);
39036 self->private_data.s_decode_chrm[0].scratch = 0;
39043 uint64_t* scratch = &self->private_data.s_decode_chrm[0].scratch;
39058 self->private_impl.f_metadata_z |= ((16777215 & v_u) << 40);
39062 self->private_impl.p_decode_chrm[0] = 0;
39068 self->private_impl.p_decode_chrm[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
39083 wuffs_png__decoder* self,
39098 if (self->private_impl.f_chunk_length < 4) {
39102 self->private_impl.f_metadata_flavor = 3;
39103 self->private_impl.f_metadata_fourcc = 1163413830;
39104 self->private_impl.f_metadata_x = 0;
39105 self->private_impl.f_metadata_y = wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)));
39106 self->private_impl.f_metadata_z = wuffs_base__u64__sat_add(self->private_impl.f_metadata_y, ((uint64_t)(self->private_impl.f_chunk_length)));
39107 self->private_impl.f_chunk_length = 0;
39124 wuffs_png__decoder* self,
39144 uint32_t coro_susp_point = self->private_impl.p_decode_fctl[0];
39146 v_x0 = self->private_data.s_decode_fctl[0].v_x0;
39147 v_x1 = self->private_data.s_decode_fctl[0].v_x1;
39148 v_y1 = self->private_data.s_decode_fctl[0].v_y1;
39153 if (self->private_impl.f_chunk_length != 26) {
39157 self->private_impl.f_chunk_length = 0;
39165 self->private_data.s_decode_fctl[0].scratch = 0;
39172 uint64_t* scratch = &self->private_data.s_decode_fctl[0].scratch;
39187 if (v_x0 != self->private_impl.f_next_animation_seq_num) {
39190 } else if (self->private_impl.f_next_animation_seq_num >= 4294967295) {
39194 self->private_impl.f_next_animation_seq_num += 1;
39202 self->private_data.s_decode_fctl[0].scratch = 0;
39209 uint64_t* scratch = &self->private_data.s_decode_fctl[0].scratch;
39231 self->private_data.s_decode_fctl[0].scratch = 0;
39238 uint64_t* scratch = &self->private_data.s_decode_fctl[0].scratch;
39260 self->private_data.s_decode_fctl[0].scratch = 0;
39267 uint64_t* scratch = &self->private_data.s_decode_fctl[0].scratch;
39289 self->private_data.s_decode_fctl[0].scratch = 0;
39296 uint64_t* scratch = &self->private_data.s_decode_fctl[0].scratch;
39314 (v_x0 > self->private_impl.f_width) ||
39315 (v_x1 > self->private_impl.f_width) ||
39317 (v_y0 > self->private_impl.f_height) ||
39318 (v_y1 > self->private_impl.f_height)) {
39322 self->private_impl.f_frame_rect_x0 = v_x0;
39323 self->private_impl.f_frame_rect_y0 = v_y0;
39324 self->private_impl.f_frame_rect_x1 = v_x1;
39325 self->private_impl.f_frame_rect_y1 = v_y1;
39333 self->private_data.s_decode_fctl[0].scratch = 0;
39340 uint64_t* scratch = &self->private_data.s_decode_fctl[0].scratch;
39362 self->private_data.s_decode_fctl[0].scratch = 0;
39369 uint64_t* scratch = &self->private_data.s_decode_fctl[0].scratch;
39385 self->private_impl.f_frame_duration = (((uint64_t)(v_x0)) * 7056000);
39387 self->private_impl.f_frame_duration = ((((uint64_t)(v_x0)) * 705600000) / ((uint64_t)(v_x1)));
39399 self->private_impl.f_frame_disposal = 0;
39401 self->private_impl.f_frame_disposal = 1;
39403 self->private_impl.f_frame_disposal = 2;
39418 self->private_impl.f_frame_overwrite_instead_of_blend = true;
39420 self->private_impl.f_frame_overwrite_instead_of_blend = false;
39425 if (self->private_impl.f_num_decoded_frame_configs_value == 0) {
39426 self->private_impl.f_first_rect_x0 = self->private_impl.f_frame_rect_x0;
39427 self->private_impl.f_first_rect_y0 = self->private_impl.f_frame_rect_y0;
39428 self->private_impl.f_first_rect_x1 = self->private_impl.f_frame_rect_x1;
39429 self->private_impl.f_first_rect_y1 = self->private_impl.f_frame_rect_y1;
39430 self->private_impl.f_first_duration = self->private_impl.f_frame_duration;
39431 self->private_impl.f_first_disposal = self->private_impl.f_frame_disposal;
39432 self->private_impl.f_first_overwrite_instead_of_blend = self->private_impl.f_frame_overwrite_instead_of_blend;
39437 self->private_impl.p_decode_fctl[0] = 0;
39443 self->private_impl.p_decode_fctl[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
39444 self->private_data.s_decode_fctl[0].v_x0 = v_x0;
39445 self->private_data.s_decode_fctl[0].v_x1 = v_x1;
39446 self->private_data.s_decode_fctl[0].v_y1 = v_y1;
39461 wuffs_png__decoder* self,
39476 uint32_t coro_susp_point = self->private_impl.p_decode_gama[0];
39480 if (self->private_impl.f_chunk_length != 4) {
39484 self->private_impl.f_chunk_length = 0;
39485 self->private_impl.f_metadata_flavor = 5;
39486 self->private_impl.f_metadata_fourcc = 1195461953;
39494 self->private_data.s_decode_gama[0].scratch = 0;
39501 uint64_t* scratch = &self->private_data.s_decode_gama[0].scratch;
39514 self->private_impl.f_metadata_x = t_0;
39516 self->private_impl.f_metadata_y = 0;
39517 self->private_impl.f_metadata_z = 0;
39521 self->private_impl.p_decode_gama[0] = 0;
39527 self->private_impl.p_decode_gama[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
39542 wuffs_png__decoder* self,
39559 uint32_t coro_susp_point = self->private_impl.p_decode_iccp[0];
39564 if (self->private_impl.f_chunk_length <= 0) {
39568 self->private_impl.f_chunk_length -= 1;
39583 if (self->private_impl.f_chunk_length <= 0) {
39587 self->private_impl.f_chunk_length -= 1;
39601 self->private_impl.f_metadata_is_zlib_compressed = true;
39602 self->private_impl.f_metadata_flavor = 4;
39603 self->private_impl.f_metadata_fourcc = 1229144912;
39604 self->private_impl.f_metadata_x = 0;
39605 self->private_impl.f_metadata_y = 0;
39606 self->private_impl.f_metadata_z = 0;
39610 self->private_impl.p_decode_iccp[0] = 0;
39616 self->private_impl.p_decode_iccp[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
39631 wuffs_png__decoder* self,
39650 uint32_t coro_susp_point = self->private_impl.p_decode_plte[0];
39652 v_num_entries = self->private_data.s_decode_plte[0].v_num_entries;
39653 v_i = self->private_data.s_decode_plte[0].v_i;
39658 if ((self->private_impl.f_chunk_length > 768) || ((self->private_impl.f_chunk_length % 3) != 0)) {
39662 v_num_entries = (((uint32_t)(self->private_impl.f_chunk_length)) / 3);
39663 self->private_impl.f_chunk_length = 0;
39672 self->private_data.s_decode_plte[0].scratch = 0;
39679 uint64_t* scratch = &self->private_data.s_decode_plte[0].scratch;
39695 self->private_data.f_src_palette[((4 * v_i) + 0)] = ((uint8_t)(((v_argb >> 0) & 255)));
39696 self->private_data.f_src_palette[((4 * v_i) + 1)] = ((uint8_t)(((v_argb >> 8) & 255)));
39697 self->private_data.f_src_palette[((4 * v_i) + 2)] = ((uint8_t)(((v_argb >> 16) & 255)));
39698 self->private_data.f_src_palette[((4 * v_i) + 3)] = ((uint8_t)(((v_argb >> 24) & 255)));
39702 self->private_data.f_src_palette[((4 * v_i) + 0)] = 0;
39703 self->private_data.f_src_palette[((4 * v_i) + 1)] = 0;
39704 self->private_data.f_src_palette[((4 * v_i) + 2)] = 0;
39705 self->private_data.f_src_palette[((4 * v_i) + 3)] = 255;
39711 self->private_impl.p_decode_plte[0] = 0;
39717 self->private_impl.p_decode_plte[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
39718 self->private_data.s_decode_plte[0].v_num_entries = v_num_entries;
39719 self->private_data.s_decode_plte[0].v_i = v_i;
39734 wuffs_png__decoder* self,
39749 uint32_t coro_susp_point = self->private_impl.p_decode_srgb[0];
39753 if (self->private_impl.f_chunk_length != 1) {
39757 self->private_impl.f_chunk_length = 0;
39758 self->private_impl.f_metadata_flavor = 5;
39759 self->private_impl.f_metadata_fourcc = 1397901122;
39767 self->private_impl.f_metadata_x = t_0;
39769 self->private_impl.f_metadata_y = 0;
39770 self->private_impl.f_metadata_z = 0;
39774 self->private_impl.p_decode_srgb[0] = 0;
39780 self->private_impl.p_decode_srgb[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
39795 wuffs_png__decoder* self,
39814 uint32_t coro_susp_point = self->private_impl.p_decode_trns[0];
39816 v_i = self->private_data.s_decode_trns[0].v_i;
39817 v_n = self->private_data.s_decode_trns[0].v_n;
39822 if (self->private_impl.f_color_type == 0) {
39823 self->private_impl.choosy_filter_and_swizzle = (
39825 if (self->private_impl.f_depth <= 8) {
39826 self->private_impl.f_dst_pixfmt = 2164295816;
39827 self->private_impl.f_src_pixfmt = 2164295816;
39829 self->private_impl.f_dst_pixfmt = 2164308923;
39830 self->private_impl.f_src_pixfmt = 2164308923;
39832 if (self->private_impl.f_chunk_length != 2) {
39836 self->private_impl.f_chunk_length = 0;
39844 self->private_data.s_decode_trns[0].scratch = 0;
39851 uint64_t* scratch = &self->private_data.s_decode_trns[0].scratch;
39866 if (self->private_impl.f_depth <= 1) {
39867 self->private_impl.f_remap_transparency = (((v_u & 1) * 16777215) | 4278190080);
39868 } else if (self->private_impl.f_depth <= 2) {
39869 self->private_impl.f_remap_transparency = (((v_u & 3) * 5592405) | 4278190080);
39870 } else if (self->private_impl.f_depth <= 4) {
39871 self->private_impl.f_remap_transparency = (((v_u & 15) * 1118481) | 4278190080);
39872 } else if (self->private_impl.f_depth <= 8) {
39873 self->private_impl.f_remap_transparency = (((v_u & 255) * 65793) | 4278190080);
39875 self->private_impl.f_remap_transparency = ((v_u * 4295032833) | 18446462598732840960u);
39877 } else if (self->private_impl.f_color_type == 2) {
39878 self->private_impl.choosy_filter_and_swizzle = (
39880 if (self->private_impl.f_depth <= 8) {
39881 self->private_impl.f_dst_pixfmt = 2164295816;
39882 self->private_impl.f_src_pixfmt = 2164295816;
39884 self->private_impl.f_dst_pixfmt = 2164308923;
39885 self->private_impl.f_src_pixfmt = 2164308923;
39887 if (self->private_impl.f_chunk_length != 6) {
39891 self->private_impl.f_chunk_length = 0;
39899 self->private_data.s_decode_trns[0].scratch = 0;
39906 uint64_t* scratch = &self->private_data.s_decode_trns[0].scratch;
39921 if (self->private_impl.f_depth <= 8) {
39922 self->private_impl.f_remap_transparency = ((255 & (v_u >> 0)) |
39927 self->private_impl.f_remap_transparency = (v_u | 18446462598732840960u);
39929 } else if (self->private_impl.f_color_type == 3) {
39930 self->private_impl.f_dst_pixfmt = 2164523016;
39931 self->private_impl.f_src_pixfmt = 2164523016;
39932 if (self->private_impl.f_chunk_length > 256) {
39936 v_n = ((uint32_t)(self->private_impl.f_chunk_length));
39937 self->private_impl.f_chunk_length = 0;
39946 self->private_data.f_src_palette[((4 * v_i) + 3)] = t_2;
39957 self->private_impl.p_decode_trns[0] = 0;
39963 self->private_impl.p_decode_trns[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
39964 self->private_data.s_decode_trns[0].v_i = v_i;
39965 self->private_data.s_decode_trns[0].v_n = v_n;
39980 wuffs_png__decoder* self,
39983 if (!self) {
39986 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
39988 (self->private_impl.magic == WUFFS_BASE__DISABLED)
39993 self->private_impl.magic = WUFFS_BASE__DISABLED;
39996 if ((self->private_impl.active_coroutine != 0) &&
39997 (self->private_impl.active_coroutine != 2)) {
39998 self->private_impl.magic = WUFFS_BASE__DISABLED;
40001 self->private_impl.active_coroutine = 0;
40015 uint32_t coro_susp_point = self->private_impl.p_decode_frame_config[0];
40019 if (self->private_impl.f_call_sequence == 255) {
40022 } else if (self->private_impl.f_call_sequence < 3) {
40027 status = wuffs_png__decoder__decode_image_config(self, NULL, a_src);
40034 } else if (self->private_impl.f_call_sequence == 3) {
40035 if (self->private_impl.f_frame_config_io_position != wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)))) {
40039 } else if (self->private_impl.f_call_sequence == 4) {
40044 status = wuffs_png__decoder__skip_frame(self, a_src);
40051 if (self->private_impl.f_call_sequence == 255) {
40056 if (self->private_impl.f_num_decoded_frame_configs_value == 0) {
40057 self->private_impl.f_frame_rect_x0 = self->private_impl.f_first_rect_x0;
40058 self->private_impl.f_frame_rect_y0 = self->private_impl.f_first_rect_y0;
40059 self->private_impl.f_frame_rect_x1 = self->private_impl.f_first_rect_x1;
40060 self->private_impl.f_frame_rect_y1 = self->private_impl.f_first_rect_y1;
40061 self->private_impl.f_frame_config_io_position = self->private_impl.f_first_config_io_position;
40062 self->private_impl.f_frame_duration = self->private_impl.f_first_duration;
40063 self->private_impl.f_frame_disposal = self->private_impl.f_first_disposal;
40064 self->private_impl.f_frame_overwrite_instead_of_blend = self->private_impl.f_first_overwrite_instead_of_blend;
40074 self->private_data.s_decode_frame_config[0].scratch = 0;
40081 uint64_t* scratch = &self->private_data.s_decode_frame_config[0].scratch;
40094 self->private_impl.f_chunk_length = t_0;
40103 self->private_data.s_decode_frame_config[0].scratch = 0;
40110 uint64_t* scratch = &self->private_data.s_decode_frame_config[0].scratch;
40123 self->private_impl.f_chunk_type = t_1;
40125 if (self->private_impl.f_chunk_type == 1413571686) {
40128 } else if (self->private_impl.f_chunk_type == 1280598886) {
40129 self->private_impl.f_frame_config_io_position = ((uint64_t)(wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src))) - 8));
40134 status = wuffs_png__decoder__decode_fctl(self, a_src);
40141 self->private_data.s_decode_frame_config[0].scratch = 4;
40143 if (self->private_data.s_decode_frame_config[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
40144 self->private_data.s_decode_frame_config[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
40149 iop_a_src += self->private_data.s_decode_frame_config[0].scratch;
40152 self->private_data.s_decode_frame_config[0].scratch = (((uint64_t)(self->private_impl.f_chunk_length)) + 4);
40154 if (self->private_data.s_decode_frame_config[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
40155 self->private_data.s_decode_frame_config[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
40160 iop_a_src += self->private_data.s_decode_frame_config[0].scratch;
40161 self->private_impl.f_chunk_length = 0;
40169 self->private_impl.f_frame_rect_x0,
40170 self->private_impl.f_frame_rect_y0,
40171 self->private_impl.f_frame_rect_x1,
40172 self->private_impl.f_frame_rect_y1),
40173 ((wuffs_base__flicks)(self->private_impl.f_frame_duration)),
40174 ((uint64_t)(self->private_impl.f_num_decoded_frame_configs_value)),
40175 self->private_impl.f_frame_config_io_position,
40176 self->private_impl.f_frame_disposal,
40177 ((self->private_impl.f_color_type <= 3) && ! self->private_impl.f_seen_trns),
40178 self->private_impl.f_frame_overwrite_instead_of_blend,
40181 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_num_decoded_frame_configs_value, 1);
40182 self->private_impl.f_call_sequence = 4;
40185 self->private_impl.p_decode_frame_config[0] = 0;
40191 self->private_impl.p_decode_frame_config[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
40192 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 2 : 0;
40201 self->private_impl.magic = WUFFS_BASE__DISABLED;
40210 wuffs_png__decoder* self,
40227 uint32_t coro_susp_point = self->private_impl.p_skip_frame[0];
40231 self->private_impl.f_chunk_type_array[0] = 0;
40232 self->private_impl.f_chunk_type_array[1] = 0;
40233 self->private_impl.f_chunk_type_array[2] = 0;
40234 self->private_impl.f_chunk_type_array[3] = 0;
40245 self->private_impl.f_chunk_length = wuffs_base__peek_u32be__no_bounds_check(iop_a_src);
40246 self->private_impl.f_chunk_type = ((uint32_t)((wuffs_base__peek_u64le__no_bounds_check(iop_a_src) >> 32)));
40247 if (self->private_impl.f_chunk_type == 1413563465) {
40248 if (self->private_impl.f_chunk_type_array[0] == 102) {
40252 self->private_impl.f_chunk_type_array[0] = 73;
40253 self->private_impl.f_chunk_type_array[1] = 68;
40254 self->private_impl.f_chunk_type_array[2] = 65;
40255 self->private_impl.f_chunk_type_array[3] = 84;
40256 } else if (self->private_impl.f_chunk_type == 1413571686) {
40257 if (self->private_impl.f_chunk_type_array[0] == 73) {
40261 self->private_impl.f_chunk_type_array[0] = 102;
40262 self->private_impl.f_chunk_type_array[1] = 100;
40263 self->private_impl.f_chunk_type_array[2] = 65;
40264 self->private_impl.f_chunk_type_array[3] = 84;
40265 if (self->private_impl.f_chunk_length < 4) {
40269 self->private_impl.f_chunk_length -= 4;
40278 self->private_data.s_skip_frame[0].scratch = 0;
40285 uint64_t* scratch = &self->private_data.s_skip_frame[0].scratch;
40300 if (v_seq_num != self->private_impl.f_next_animation_seq_num) {
40303 } else if (self->private_impl.f_next_animation_seq_num >= 4294967295) {
40307 self->private_impl.f_next_animation_seq_num += 1;
40308 self->private_data.s_skip_frame[0].scratch = (((uint64_t)(self->private_impl.f_chunk_length)) + 4);
40310 if (self->private_data.s_skip_frame[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
40311 self->private_data.s_skip_frame[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
40316 iop_a_src += self->private_data.s_skip_frame[0].scratch;
40317 self->private_impl.f_chunk_length = 0;
40319 } else if (self->private_impl.f_chunk_type_array[0] != 0) {
40321 } else if (self->private_impl.f_chunk_type == 1280598886) {
40325 self->private_data.s_skip_frame[0].scratch = (((uint64_t)(self->private_impl.f_chunk_length)) + 12);
40327 if (self->private_data.s_skip_frame[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
40328 self->private_data.s_skip_frame[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
40333 iop_a_src += self->private_data.s_skip_frame[0].scratch;
40334 self->private_impl.f_chunk_length = 0;
40337 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_num_decoded_frames_value, 1);
40338 if (self->private_impl.f_num_decoded_frames_value < self->private_impl.f_num_animation_frames_value) {
40339 self->private_impl.f_call_sequence = 5;
40341 self->private_impl.f_call_sequence = 255;
40345 self->private_impl.p_skip_frame[0] = 0;
40351 self->private_impl.p_skip_frame[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
40366 wuffs_png__decoder* self,
40372 if (!self) {
40375 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
40377 (self->private_impl.magic == WUFFS_BASE__DISABLED)
40382 self->private_impl.magic = WUFFS_BASE__DISABLED;
40385 if ((self->private_impl.active_coroutine != 0) &&
40386 (self->private_impl.active_coroutine != 3)) {
40387 self->private_impl.magic = WUFFS_BASE__DISABLED;
40390 self->private_impl.active_coroutine = 0;
40409 uint32_t coro_susp_point = self->private_impl.p_decode_frame[0];
40413 if (self->private_impl.f_call_sequence == 255) {
40416 } else if (self->private_impl.f_call_sequence != 4) {
40421 status = wuffs_png__decoder__decode_frame_config(self, NULL, a_src);
40438 self->private_impl.f_chunk_length = wuffs_base__peek_u32be__no_bounds_check(iop_a_src);
40439 self->private_impl.f_chunk_type = ((uint32_t)((wuffs_base__peek_u64le__no_bounds_check(iop_a_src) >> 32)));
40440 if (self->private_impl.f_chunk_type == 1413563465) {
40441 self->private_impl.f_chunk_type_array[0] = 73;
40442 self->private_impl.f_chunk_type_array[1] = 68;
40443 self->private_impl.f_chunk_type_array[2] = 65;
40444 self->private_impl.f_chunk_type_array[3] = 84;
40446 if ( ! self->private_impl.f_ignore_checksum) {
40447 wuffs_base__ignore_status(wuffs_crc32__ieee_hasher__initialize(&self->private_data.f_crc32,
40449 wuffs_crc32__ieee_hasher__update_u32(&self->private_data.f_crc32, wuffs_base__make_slice_u8(self->private_impl.f_chunk_type_array, 4));
40452 } else if (self->private_impl.f_chunk_type == 1413571686) {
40453 self->private_impl.f_chunk_type_array[0] = 102;
40454 self->private_impl.f_chunk_type_array[1] = 100;
40455 self->private_impl.f_chunk_type_array[2] = 65;
40456 self->private_impl.f_chunk_type_array[3] = 84;
40457 if (self->private_impl.f_chunk_length < 4) {
40461 self->private_impl.f_chunk_length -= 4;
40470 self->private_data.s_decode_frame[0].scratch = 0;
40477 uint64_t* scratch = &self->private_data.s_decode_frame[0].scratch;
40492 if (v_seq_num != self->private_impl.f_next_animation_seq_num) {
40495 } else if (self->private_impl.f_next_animation_seq_num >= 4294967295) {
40499 self->private_impl.f_next_animation_seq_num += 1;
40501 } else if (self->private_impl.f_chunk_type == 1280598886) {
40505 self->private_data.s_decode_frame[0].scratch = (((uint64_t)(self->private_impl.f_chunk_length)) + 12);
40507 if (self->private_data.s_decode_frame[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
40508 self->private_data.s_decode_frame[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
40513 iop_a_src += self->private_data.s_decode_frame[0].scratch;
40514 self->private_impl.f_chunk_length = 0;
40517 if (self->private_impl.f_zlib_is_dirty) {
40518 wuffs_base__ignore_status(wuffs_zlib__decoder__initialize(&self->private_data.f_zlib,
40520 if (self->private_impl.f_ignore_checksum) {
40521 wuffs_zlib__decoder__set_quirk_enabled(&self->private_data.f_zlib, 1, true);
40524 self->private_impl.f_zlib_is_dirty = true;
40525 v_status = wuffs_base__pixel_swizzler__prepare(&self->private_impl.f_swizzler,
40527 wuffs_base__pixel_buffer__palette_or_else(a_dst, wuffs_base__make_slice_u8(self->private_data.f_dst_palette, 1024)),
40528 wuffs_base__utility__make_pixel_format(self->private_impl.f_src_pixfmt),
40529 wuffs_base__make_slice_u8(self->private_data.f_src_palette, 1024),
40541 self->private_impl.f_workbuf_hist_pos_base = 0;
40543 if (self->private_impl.f_chunk_type_array[0] == 73) {
40544 v_pass_width = (16777215 & ((((uint32_t)(WUFFS_PNG__INTERLACING[self->private_impl.f_interlace_pass][1])) + self->private_impl.f_width) >> WUFFS_PNG__INTERLACING[self->private_impl.f_interlace_pass][0]));
40545 v_pass_height = (16777215 & ((((uint32_t)(WUFFS_PNG__INTERLACING[self->private_impl.f_interlace_pass][4])) + self->private_impl.f_height) >> WUFFS_PNG__INTERLACING[self->private_impl.f_interlace_pass][3]));
40547 v_pass_width = (16777215 & ((uint32_t)(self->private_impl.f_frame_rect_x1 - self->private_impl.f_frame_rect_x0)));
40548 v_pass_height = (16777215 & ((uint32_t)(self->private_impl.f_frame_rect_y1 - self->private_impl.f_frame_rect_y0)));
40551 self->private_impl.f_pass_bytes_per_row = wuffs_png__decoder__calculate_bytes_per_row(self, v_pass_width);
40552 self->private_impl.f_pass_workbuf_length = (((uint64_t)(v_pass_height)) * (1 + self->private_impl.f_pass_bytes_per_row));
40557 status = wuffs_png__decoder__decode_pass(self, a_src, a_workbuf);
40564 v_status = wuffs_png__decoder__filter_and_swizzle(self, a_dst, a_workbuf);
40575 self->private_impl.f_workbuf_hist_pos_base += self->private_impl.f_pass_workbuf_length;
40577 if ((self->private_impl.f_interlace_pass == 0) || (self->private_impl.f_interlace_pass >= 7)) {
40584 self->private_impl.f_interlace_pass += 1;
40590 wuffs_base__u32__sat_add_indirect(&self->private_impl.f_num_decoded_frames_value, 1);
40591 if (self->private_impl.f_num_decoded_frames_value < self->private_impl.f_num_animation_frames_value) {
40592 self->private_impl.f_call_sequence = 5;
40594 self->private_impl.f_call_sequence = 255;
40598 self->private_impl.p_decode_frame[0] = 0;
40604 self->private_impl.p_decode_frame[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
40605 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 3 : 0;
40614 self->private_impl.magic = WUFFS_BASE__DISABLED;
40623 wuffs_png__decoder* self,
40652 uint32_t coro_susp_point = self->private_impl.p_decode_pass[0];
40656 self->private_impl.f_workbuf_wi = 0;
40659 if ((self->private_impl.f_workbuf_wi > self->private_impl.f_pass_workbuf_length) || (self->private_impl.f_pass_workbuf_length > ((uint64_t)(a_workbuf.len)))) {
40676 self->private_impl.f_workbuf_wi,
40677 self->private_impl.f_pass_workbuf_length),
40678 ((uint64_t)(self->private_impl.f_workbuf_hist_pos_base + self->private_impl.f_workbuf_wi)));
40682 ((uint64_t)(self->private_impl.f_chunk_length)));
40693 wuffs_base__status t_0 = wuffs_zlib__decoder__transform_io(&self->private_data.f_zlib, v_w, a_src, wuffs_base__utility__empty_slice_u8());
40700 if ( ! self->private_impl.f_ignore_checksum) {
40701 wuffs_crc32__ieee_hasher__update_u32(&self->private_data.f_crc32, wuffs_base__io__since(v_r_mark, ((uint64_t)(iop_a_src - io0_a_src)), io0_a_src));
40703 wuffs_base__u32__sat_sub_indirect(&self->private_impl.f_chunk_length, ((uint32_t)((wuffs_base__io__count_since(v_r_mark, ((uint64_t)(iop_a_src - io0_a_src))) & 4294967295))));
40704 wuffs_base__u64__sat_add_indirect(&self->private_impl.f_workbuf_wi, wuffs_base__io__count_since(v_w_mark, ((uint64_t)(iop_v_w - io0_v_w))));
40717 if (self->private_impl.f_chunk_length > 0) {
40728 self->private_data.s_decode_pass[0].scratch = 0;
40735 uint64_t* scratch = &self->private_data.s_decode_pass[0].scratch;
40750 if ( ! self->private_impl.f_ignore_checksum && (self->private_impl.f_chunk_type_array[0] == 73)) {
40751 v_checksum_have = wuffs_crc32__ieee_hasher__update_u32(&self->private_data.f_crc32, wuffs_base__utility__empty_slice_u8());
40759 if ((1 <= self->private_impl.f_interlace_pass) && (self->private_impl.f_interlace_pass <= 6)) {
40773 } else if (self->private_impl.f_chunk_length == 0) {
40781 self->private_data.s_decode_pass[0].scratch = 0;
40788 uint64_t* scratch = &self->private_data.s_decode_pass[0].scratch;
40803 if ( ! self->private_impl.f_ignore_checksum && (self->private_impl.f_chunk_type_array[0] == 73)) {
40804 v_checksum_have = wuffs_crc32__ieee_hasher__update_u32(&self->private_data.f_crc32, wuffs_base__utility__empty_slice_u8());
40817 self->private_data.s_decode_pass[0].scratch = 0;
40824 uint64_t* scratch = &self->private_data.s_decode_pass[0].scratch;
40837 self->private_impl.f_chunk_length = t_3;
40846 self->private_data.s_decode_pass[0].scratch = 0;
40853 uint64_t* scratch = &self->private_data.s_decode_pass[0].scratch;
40866 self->private_impl.f_chunk_type = t_4;
40868 if (self->private_impl.f_chunk_type_array[0] == 73) {
40869 if (self->private_impl.f_chunk_type != 1413563465) {
40873 if ( ! self->private_impl.f_ignore_checksum) {
40874 wuffs_base__ignore_status(wuffs_crc32__ieee_hasher__initialize(&self->private_data.f_crc32,
40876 wuffs_crc32__ieee_hasher__update_u32(&self->private_data.f_crc32, wuffs_base__make_slice_u8(self->private_impl.f_chunk_type_array, 4));
40879 if ((self->private_impl.f_chunk_type != 1413571686) || (self->private_impl.f_chunk_length < 4)) {
40883 self->private_impl.f_chunk_length -= 4;
40891 self->private_data.s_decode_pass[0].scratch = 0;
40898 uint64_t* scratch = &self->private_data.s_decode_pass[0].scratch;
40913 if (v_seq_num != self->private_impl.f_next_animation_seq_num) {
40916 } else if (self->private_impl.f_next_animation_seq_num >= 4294967295) {
40920 self->private_impl.f_next_animation_seq_num += 1;
40931 if (self->private_impl.f_workbuf_wi != self->private_impl.f_pass_workbuf_length) {
40941 self->private_impl.p_decode_pass[0] = 0;
40947 self->private_impl.p_decode_pass[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
40962 const wuffs_png__decoder* self) {
40963 if (!self) {
40966 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
40967 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
40972 self->private_impl.f_frame_rect_x0,
40973 self->private_impl.f_frame_rect_y0,
40974 self->private_impl.f_frame_rect_x1,
40975 self->private_impl.f_frame_rect_y1);
40982 const wuffs_png__decoder* self) {
40983 if (!self) {
40986 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
40987 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
40991 return self->private_impl.f_num_animation_loops_value;
40998 const wuffs_png__decoder* self) {
40999 if (!self) {
41002 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
41003 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
41007 return ((uint64_t)(self->private_impl.f_num_decoded_frame_configs_value));
41014 const wuffs_png__decoder* self) {
41015 if (!self) {
41018 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
41019 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
41023 return ((uint64_t)(self->private_impl.f_num_decoded_frames_value));
41030 wuffs_png__decoder* self,
41033 if (!self) {
41036 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
41038 (self->private_impl.magic == WUFFS_BASE__DISABLED)
41043 if (self->private_impl.f_call_sequence < 3) {
41045 } else if ((a_index >= ((uint64_t)(self->private_impl.f_num_animation_frames_value))) || ((a_index == 0) && (a_io_position != self->private_impl.f_first_config_io_position))) {
41048 self->private_impl.f_call_sequence = 3;
41049 if (self->private_impl.f_interlace_pass >= 1) {
41050 self->private_impl.f_interlace_pass = 1;
41052 self->private_impl.f_frame_config_io_position = a_io_position;
41053 self->private_impl.f_num_decoded_frame_configs_value = ((uint32_t)((a_index & 4294967295)));
41054 self->private_impl.f_num_decoded_frames_value = self->private_impl.f_num_decoded_frame_configs_value;
41062 wuffs_png__decoder* self,
41065 if (!self) {
41068 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
41073 self->private_impl.f_report_metadata_chrm = a_report;
41075 self->private_impl.f_report_metadata_exif = a_report;
41077 self->private_impl.f_report_metadata_gama = a_report;
41079 self->private_impl.f_report_metadata_iccp = a_report;
41081 self->private_impl.f_report_metadata_kvp = a_report;
41083 self->private_impl.f_report_metadata_srgb = a_report;
41092 wuffs_png__decoder* self,
41096 if (!self) {
41099 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
41101 (self->private_impl.magic == WUFFS_BASE__DISABLED)
41106 self->private_impl.magic = WUFFS_BASE__DISABLED;
41109 if ((self->private_impl.active_coroutine != 0) &&
41110 (self->private_impl.active_coroutine != 4)) {
41111 self->private_impl.magic = WUFFS_BASE__DISABLED;
41114 self->private_impl.active_coroutine = 0;
41154 uint32_t coro_susp_point = self->private_impl.p_tell_me_more[0];
41156 v_zlib_status = self->private_data.s_tell_me_more[0].v_zlib_status;
41161 if (self->private_impl.f_call_sequence != 1) {
41165 if (self->private_impl.f_metadata_fourcc == 0) {
41170 if (self->private_impl.f_metadata_flavor == 3) {
41172 if (wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src))) != self->private_impl.f_metadata_y) {
41177 self->private_impl.f_metadata_flavor,
41178 self->private_impl.f_metadata_fourcc,
41179 self->private_impl.f_metadata_x,
41180 self->private_impl.f_metadata_y,
41181 self->private_impl.f_metadata_z);
41183 if (self->private_impl.f_metadata_y >= self->private_impl.f_metadata_z) {
41186 self->private_impl.f_metadata_y = self->private_impl.f_metadata_z;
41191 if (self->private_impl.f_metadata_is_zlib_compressed) {
41192 if (self->private_impl.f_zlib_is_dirty) {
41193 wuffs_base__ignore_status(wuffs_zlib__decoder__initialize(&self->private_data.f_zlib,
41195 if (self->private_impl.f_ignore_checksum) {
41196 wuffs_zlib__decoder__set_quirk_enabled(&self->private_data.f_zlib, 1, true);
41199 self->private_impl.f_zlib_is_dirty = true;
41200 self->private_impl.f_ztxt_hist_pos = 0;
41206 self->private_impl.f_metadata_flavor,
41207 self->private_impl.f_metadata_fourcc,
41208 self->private_impl.f_metadata_x,
41209 self->private_impl.f_metadata_y,
41210 self->private_impl.f_metadata_z);
41212 if (self->private_impl.f_metadata_flavor != 4) {
41215 if (self->private_impl.f_metadata_is_zlib_compressed) {
41216 if (self->private_impl.f_chunk_type == 1346585449) {
41220 ((uint64_t)(self->private_impl.f_chunk_length)));
41232 wuffs_base__status t_0 = wuffs_zlib__decoder__transform_io(&self->private_data.f_zlib, a_dst, a_src, wuffs_base__utility__empty_slice_u8());
41241 wuffs_base__u32__sat_sub_indirect(&self->private_impl.f_chunk_length, ((uint32_t)((wuffs_base__io__count_since(v_r_mark, ((uint64_t)(iop_a_src - io0_a_src))) & 4294967295))));
41248 self->private_impl.f_metadata_is_zlib_compressed = false;
41262 } else if (self->private_impl.f_chunk_type == 1951945833) {
41266 ((uint64_t)(self->private_impl.f_chunk_length)));
41278 wuffs_base__status t_1 = wuffs_zlib__decoder__transform_io(&self->private_data.f_zlib, a_dst, a_src, wuffs_base__utility__empty_slice_u8());
41287 wuffs_base__u32__sat_sub_indirect(&self->private_impl.f_chunk_length, ((uint32_t)((wuffs_base__io__count_since(v_r_mark, ((uint64_t)(iop_a_src - io0_a_src))) & 4294967295))));
41294 self->private_impl.f_metadata_is_zlib_compressed = false;
41308 } else if (self->private_impl.f_chunk_type == 1951945850) {
41309 if (self->private_impl.f_ztxt_ri == self->private_impl.f_ztxt_wi) {
41322 wuffs_base__make_slice_u8(self->private_data.f_dst_palette, 1024),
41323 self->private_impl.f_ztxt_hist_pos);
41327 ((uint64_t)(self->private_impl.f_chunk_length)));
41338 wuffs_base__status t_2 = wuffs_zlib__decoder__transform_io(&self->private_data.f_zlib, v_w, a_src, wuffs_base__utility__empty_slice_u8());
41345 wuffs_base__u32__sat_sub_indirect(&self->private_impl.f_chunk_length, ((uint32_t)((wuffs_base__io__count_since(v_r_mark, ((uint64_t)(iop_a_src - io0_a_src))) & 4294967295))));
41362 self->private_impl.f_ztxt_ri = 0;
41363 self->private_impl.f_ztxt_wi = ((uint32_t)(v_num_written));
41364 wuffs_base__u64__sat_add_indirect(&self->private_impl.f_ztxt_hist_pos, v_num_written);
41366 while (self->private_impl.f_ztxt_ri < self->private_impl.f_ztxt_wi) {
41367 v_c2 = WUFFS_PNG__LATIN_1[self->private_data.f_dst_palette[self->private_impl.f_ztxt_ri]];
41378 self->private_impl.f_ztxt_ri += 1;
41387 self->private_impl.f_ztxt_ri += 1;
41392 self->private_impl.f_metadata_is_zlib_compressed = false;
41411 } else if ((self->private_impl.f_chunk_type == 1951945833) && (self->private_impl.f_metadata_fourcc == 1263947862)) {
41413 if (self->private_impl.f_chunk_length <= 0) {
41424 self->private_impl.f_chunk_length -= 1;
41431 if (self->private_impl.f_chunk_length <= 0) {
41432 if (self->private_impl.f_metadata_fourcc == 1263947851) {
41444 self->private_impl.f_chunk_length -= 1;
41459 self->private_impl.f_chunk_length -= 1;
41469 self->private_impl.f_chunk_length -= 1;
41477 if (self->private_impl.f_metadata_fourcc == 1263947851) {
41478 self->private_impl.f_metadata_fourcc = 1263947862;
41479 if (self->private_impl.f_chunk_type == 1951945833) {
41480 if (self->private_impl.f_chunk_length <= 1) {
41484 self->private_impl.f_chunk_length -= 2;
41495 self->private_impl.f_metadata_is_zlib_compressed = false;
41497 self->private_impl.f_metadata_is_zlib_compressed = true;
41511 if ((v_c != 0) && self->private_impl.f_metadata_is_zlib_compressed) {
41515 self->private_impl.f_metadata_fourcc -= 2;
41516 while (self->private_impl.f_metadata_fourcc != 1263947862) {
41517 self->private_impl.f_metadata_fourcc += 1;
41519 if (self->private_impl.f_chunk_length <= 0) {
41523 self->private_impl.f_chunk_length -= 1;
41539 } else if (self->private_impl.f_chunk_type == 1951945850) {
41540 if (self->private_impl.f_chunk_length <= 0) {
41544 self->private_impl.f_chunk_length -= 1;
41558 self->private_impl.f_metadata_is_zlib_compressed = true;
41560 self->private_impl.f_call_sequence = 2;
41567 if (self->private_impl.f_chunk_length != 0) {
41571 self->private_data.s_tell_me_more[0].scratch = 4;
41573 if (self->private_data.s_tell_me_more[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
41574 self->private_data.s_tell_me_more[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
41579 iop_a_src += self->private_data.s_tell_me_more[0].scratch;
41580 self->private_impl.f_metadata_flavor = 0;
41581 self->private_impl.f_metadata_fourcc = 0;
41582 self->private_impl.f_metadata_x = 0;
41583 self->private_impl.f_metadata_y = 0;
41584 self->private_impl.f_metadata_z = 0;
41585 self->private_impl.f_call_sequence = 2;
41590 self->private_impl.p_tell_me_more[0] = 0;
41596 self->private_impl.p_tell_me_more[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
41597 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 4 : 0;
41598 self->private_data.s_tell_me_more[0].v_zlib_status = v_zlib_status;
41610 self->private_impl.magic = WUFFS_BASE__DISABLED;
41619 const wuffs_png__decoder* self) {
41620 if (!self) {
41623 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
41624 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
41628 return wuffs_base__utility__make_range_ii_u64(self->private_impl.f_overall_workbuf_length, self->private_impl.f_overall_workbuf_length);
41635 wuffs_png__decoder* self,
41638 return (*self->private_impl.choosy_filter_and_swizzle)(self, a_dst, a_workbuf);
41643 wuffs_png__decoder* self,
41665 v_dst_bytes_per_row0 = (((uint64_t)(self->private_impl.f_frame_rect_x0)) * v_dst_bytes_per_pixel);
41666 v_dst_bytes_per_row1 = (((uint64_t)(self->private_impl.f_frame_rect_x1)) * v_dst_bytes_per_pixel);
41667 v_dst_palette = wuffs_base__pixel_buffer__palette_or_else(a_dst, wuffs_base__make_slice_u8(self->private_data.f_dst_palette, 1024));
41689 v_y = self->private_impl.f_frame_rect_y0;
41690 while (v_y < self->private_impl.f_frame_rect_y1) {
41697 if (self->private_impl.f_pass_bytes_per_row > ((uint64_t)(a_workbuf.len))) {
41700 v_curr_row = wuffs_base__slice_u8__subslice_j(a_workbuf, self->private_impl.f_pass_bytes_per_row);
41701 a_workbuf = wuffs_base__slice_u8__subslice_i(a_workbuf, self->private_impl.f_pass_bytes_per_row);
41704 wuffs_png__decoder__filter_1(self, v_curr_row);
41706 wuffs_png__decoder__filter_2(self, v_curr_row, v_prev_row);
41708 wuffs_png__decoder__filter_3(self, v_curr_row, v_prev_row);
41710 wuffs_png__decoder__filter_4(self, v_curr_row, v_prev_row);
41714 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, v_dst, v_dst_palette, v_curr_row);
41725 wuffs_png__decoder* self,
41755 v_dst_bytes_per_row1 = (((uint64_t)(self->private_impl.f_frame_rect_x1)) * v_dst_bytes_per_pixel);
41756 v_dst_palette = wuffs_base__pixel_buffer__palette_or_else(a_dst, wuffs_base__make_slice_u8(self->private_data.f_dst_palette, 1024));
41759 if (self->private_impl.f_depth >= 8) {
41760 v_src_bytes_per_pixel = (((uint64_t)(WUFFS_PNG__NUM_CHANNELS[self->private_impl.f_color_type])) * ((uint64_t)((self->private_impl.f_depth >> 3))));
41762 if (self->private_impl.f_chunk_type_array[0] == 73) {
41763 v_y = ((uint32_t)(WUFFS_PNG__INTERLACING[self->private_impl.f_interlace_pass][5]));
41765 v_y = self->private_impl.f_frame_rect_y0;
41767 while (v_y < self->private_impl.f_frame_rect_y1) {
41777 if (self->private_impl.f_pass_bytes_per_row > ((uint64_t)(a_workbuf.len))) {
41780 v_curr_row = wuffs_base__slice_u8__subslice_j(a_workbuf, self->private_impl.f_pass_bytes_per_row);
41781 a_workbuf = wuffs_base__slice_u8__subslice_i(a_workbuf, self->private_impl.f_pass_bytes_per_row);
41784 wuffs_png__decoder__filter_1(self, v_curr_row);
41786 wuffs_png__decoder__filter_2(self, v_curr_row, v_prev_row);
41788 wuffs_png__decoder__filter_3(self, v_curr_row, v_prev_row);
41790 wuffs_png__decoder__filter_4(self, v_curr_row, v_prev_row);
41795 if (self->private_impl.f_chunk_type_array[0] == 73) {
41796 v_x = ((uint32_t)(WUFFS_PNG__INTERLACING[self->private_impl.f_interlace_pass][2]));
41798 v_x = self->private_impl.f_frame_rect_x0;
41800 if (self->private_impl.f_depth == 8) {
41801 while (v_x < self->private_impl.f_frame_rect_x1) {
41804 if (self->private_impl.f_color_type == 4) {
41811 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, wuffs_base__slice_u8__subslice_i(v_dst, v_i), v_dst_palette, wuffs_base__make_slice_u8(v_bits_unpacked, 4));
41813 } else if (((uint32_t)((self->private_impl.f_remap_transparency & 4294967295))) != 0) {
41814 if (self->private_impl.f_color_type == 0) {
41821 if (((uint32_t)((self->private_impl.f_remap_transparency & 4294967295))) == ((((uint32_t)(v_bits_unpacked[0])) << 0) |
41830 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, wuffs_base__slice_u8__subslice_i(v_dst, v_i), v_dst_palette, wuffs_base__make_slice_u8(v_bits_unpacked, 4));
41839 if (((uint32_t)((self->private_impl.f_remap_transparency & 4294967295))) == ((((uint32_t)(v_bits_unpacked[0])) << 0) |
41848 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, wuffs_base__slice_u8__subslice_i(v_dst, v_i), v_dst_palette, wuffs_base__make_slice_u8(v_bits_unpacked, 4));
41852 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, wuffs_base__slice_u8__subslice_i(v_dst, v_i), v_dst_palette, wuffs_base__slice_u8__subslice_j(v_s, v_src_bytes_per_pixel));
41856 v_x += (((uint32_t)(1)) << WUFFS_PNG__INTERLACING[self->private_impl.f_interlace_pass][0]);
41858 } else if (self->private_impl.f_depth < 8) {
41860 if (self->private_impl.f_color_type == 0) {
41861 v_multiplier = WUFFS_PNG__LOW_BIT_DEPTH_MULTIPLIERS[self->private_impl.f_depth];
41863 v_shift = ((8 - self->private_impl.f_depth) & 7);
41865 while (v_x < self->private_impl.f_frame_rect_x1) {
41869 v_packs_remaining = WUFFS_PNG__LOW_BIT_DEPTH_NUM_PACKS[self->private_impl.f_depth];
41874 v_bits_packed = ((uint8_t)(v_bits_packed << self->private_impl.f_depth));
41876 if (((uint32_t)((self->private_impl.f_remap_transparency & 4294967295))) != 0) {
41880 if (((uint32_t)((self->private_impl.f_remap_transparency & 4294967295))) == ((((uint32_t)(v_bits_unpacked[0])) << 0) |
41889 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, wuffs_base__slice_u8__subslice_i(v_dst, v_i), v_dst_palette, wuffs_base__make_slice_u8(v_bits_unpacked, 4));
41891 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, wuffs_base__slice_u8__subslice_i(v_dst, v_i), v_dst_palette, wuffs_base__make_slice_u8(v_bits_unpacked, 1));
41894 v_x += (((uint32_t)(1)) << WUFFS_PNG__INTERLACING[self->private_impl.f_interlace_pass][0]);
41897 while (v_x < self->private_impl.f_frame_rect_x1) {
41900 if (self->private_impl.f_color_type == 0) {
41911 if (self->private_impl.f_remap_transparency == ((((uint64_t)(v_bits_unpacked[0])) << 0) |
41929 } else if (self->private_impl.f_color_type == 2) {
41940 if (self->private_impl.f_remap_transparency == ((((uint64_t)(v_bits_unpacked[0])) << 0) |
41958 } else if (self->private_impl.f_color_type == 4) {
41983 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, wuffs_base__slice_u8__subslice_i(v_dst, v_i), v_dst_palette, wuffs_base__make_slice_u8(v_bits_unpacked, 8));
41985 v_x += (((uint32_t)(1)) << WUFFS_PNG__INTERLACING[self->private_impl.f_interlace_pass][0]);
41989 v_y += (((uint32_t)(1)) << WUFFS_PNG__INTERLACING[self->private_impl.f_interlace_pass][3]);
42050 wuffs_tga__decoder* self,
42054 if (!self) {
42057 if (sizeof(*self) != sizeof_star_self) {
42066 // The whole point of this if-check is to detect an uninitialized *self.
42072 if (self->private_impl.magic != 0) {
42080 memset(self, 0, sizeof(*self));
42083 memset(&(self->private_impl), 0, sizeof(self->private_impl));
42087 self->private_impl.magic = WUFFS_BASE__MAGIC;
42088 self->private_impl.vtable_for__wuffs_base__image_decoder.vtable_name =
42090 self->private_impl.vtable_for__wuffs_base__image_decoder.function_pointers =
42121 wuffs_tga__decoder* self,
42131 wuffs_tga__decoder* self,
42134 if (!self) {
42137 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
42139 (self->private_impl.magic == WUFFS_BASE__DISABLED)
42144 self->private_impl.magic = WUFFS_BASE__DISABLED;
42147 if ((self->private_impl.active_coroutine != 0) &&
42148 (self->private_impl.active_coroutine != 1)) {
42149 self->private_impl.magic = WUFFS_BASE__DISABLED;
42152 self->private_impl.active_coroutine = 0;
42170 uint32_t coro_susp_point = self->private_impl.p_decode_image_config[0];
42172 v_i = self->private_data.s_decode_image_config[0].v_i;
42177 if (self->private_impl.f_call_sequence != 0) {
42188 self->private_impl.f_header_id_length = t_0;
42197 self->private_impl.f_header_color_map_type = t_1;
42199 if (self->private_impl.f_header_color_map_type > 1) {
42210 self->private_impl.f_header_image_type = t_2;
42212 if ((self->private_impl.f_header_image_type == 1) ||
42213 (self->private_impl.f_header_image_type == 2) ||
42214 (self->private_impl.f_header_image_type == 3) ||
42215 (self->private_impl.f_header_image_type == 9) ||
42216 (self->private_impl.f_header_image_type == 10) ||
42217 (self->private_impl.f_header_image_type == 11)) {
42229 self->private_data.s_decode_image_config[0].scratch = 0;
42236 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
42249 self->private_impl.f_header_color_map_first_entry_index = t_3;
42258 self->private_data.s_decode_image_config[0].scratch = 0;
42265 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
42278 self->private_impl.f_header_color_map_length = t_4;
42287 self->private_impl.f_header_color_map_entry_size = t_5;
42289 if (self->private_impl.f_header_color_map_type != 0) {
42290 if ((self->private_impl.f_header_color_map_first_entry_index != 0) || (self->private_impl.f_header_color_map_length > 256)) {
42293 } else if ((self->private_impl.f_header_color_map_entry_size != 15) &&
42294 (self->private_impl.f_header_color_map_entry_size != 16) &&
42295 (self->private_impl.f_header_color_map_entry_size != 24) &&
42296 (self->private_impl.f_header_color_map_entry_size != 32)) {
42301 if ((self->private_impl.f_header_color_map_first_entry_index != 0) || (self->private_impl.f_header_color_map_length != 0) || (self->private_impl.f_header_color_map_entry_size != 0)) {
42306 self->private_data.s_decode_image_config[0].scratch = 4;
42308 if (self->private_data.s_decode_image_config[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
42309 self->private_data.s_decode_image_config[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
42314 iop_a_src += self->private_data.s_decode_image_config[0].scratch;
42322 self->private_data.s_decode_image_config[0].scratch = 0;
42329 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
42342 self->private_impl.f_width = t_6;
42351 self->private_data.s_decode_image_config[0].scratch = 0;
42358 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
42371 self->private_impl.f_height = t_7;
42380 self->private_impl.f_header_pixel_depth = t_8;
42382 if ((self->private_impl.f_header_pixel_depth != 1) &&
42383 (self->private_impl.f_header_pixel_depth != 8) &&
42384 (self->private_impl.f_header_pixel_depth != 15) &&
42385 (self->private_impl.f_header_pixel_depth != 16) &&
42386 (self->private_impl.f_header_pixel_depth != 24) &&
42387 (self->private_impl.f_header_pixel_depth != 32)) {
42391 if ((self->private_impl.f_header_image_type | 8) == 9) {
42392 self->private_impl.f_scratch_bytes_per_pixel = 1;
42393 self->private_impl.f_src_bytes_per_pixel = 1;
42394 self->private_impl.f_src_pixfmt = 2164523016;
42395 self->private_impl.f_opaque = ((self->private_impl.f_header_color_map_entry_size == 15) || (self->private_impl.f_header_color_map_entry_size == 24));
42396 } else if ((self->private_impl.f_header_image_type | 8) == 10) {
42397 if ((self->private_impl.f_header_pixel_depth == 15) || (self->private_impl.f_header_pixel_depth == 16)) {
42398 self->private_impl.f_scratch_bytes_per_pixel = 4;
42399 self->private_impl.f_src_bytes_per_pixel = 0;
42400 self->private_impl.f_src_pixfmt = 2164295816;
42401 } else if (self->private_impl.f_header_pixel_depth == 24) {
42402 self->private_impl.f_scratch_bytes_per_pixel = 3;
42403 self->private_impl.f_src_bytes_per_pixel = 3;
42404 self->private_impl.f_src_pixfmt = 2147485832;
42405 self->private_impl.f_opaque = true;
42406 } else if (self->private_impl.f_header_pixel_depth == 32) {
42407 self->private_impl.f_scratch_bytes_per_pixel = 4;
42408 self->private_impl.f_src_bytes_per_pixel = 4;
42409 self->private_impl.f_src_pixfmt = 2164295816;
42415 if (self->private_impl.f_header_pixel_depth == 8) {
42416 self->private_impl.f_scratch_bytes_per_pixel = 1;
42417 self->private_impl.f_src_bytes_per_pixel = 1;
42418 self->private_impl.f_src_pixfmt = 536870920;
42419 self->private_impl.f_opaque = true;
42432 self->private_impl.f_header_image_descriptor = t_9;
42434 if ((self->private_impl.f_header_image_descriptor & 16) != 0) {
42438 self->private_data.s_decode_image_config[0].scratch = ((uint32_t)(self->private_impl.f_header_id_length));
42440 if (self->private_data.s_decode_image_config[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
42441 self->private_data.s_decode_image_config[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
42446 iop_a_src += self->private_data.s_decode_image_config[0].scratch;
42447 if (self->private_impl.f_header_color_map_type != 0) {
42448 while (v_i < ((uint32_t)(self->private_impl.f_header_color_map_length))) {
42449 if (self->private_impl.f_header_color_map_entry_size == 24) {
42457 self->private_data.s_decode_image_config[0].scratch = 0;
42464 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
42479 self->private_data.f_src_palette[(((v_i & 255) * 4) + 0)] = ((uint8_t)(((v_c >> 0) & 255)));
42480 self->private_data.f_src_palette[(((v_i & 255) * 4) + 1)] = ((uint8_t)(((v_c >> 8) & 255)));
42481 self->private_data.f_src_palette[(((v_i & 255) * 4) + 2)] = ((uint8_t)(((v_c >> 16) & 255)));
42482 self->private_data.f_src_palette[(((v_i & 255) * 4) + 3)] = 255;
42483 } else if (self->private_impl.f_header_color_map_entry_size == 32) {
42491 self->private_data.s_decode_image_config[0].scratch = 0;
42498 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
42513 self->private_data.f_src_palette[(((v_i & 255) * 4) + 0)] = ((uint8_t)(((v_c >> 0) & 255)));
42514 self->private_data.f_src_palette[(((v_i & 255) * 4) + 1)] = ((uint8_t)(((v_c >> 8) & 255)));
42515 self->private_data.f_src_palette[(((v_i & 255) * 4) + 2)] = ((uint8_t)(((v_c >> 16) & 255)));
42516 self->private_data.f_src_palette[(((v_i & 255) * 4) + 3)] = ((uint8_t)(((v_c >> 24) & 255)));
42525 self->private_data.s_decode_image_config[0].scratch = 0;
42532 uint64_t* scratch = &self->private_data.s_decode_image_config[0].scratch;
42548 self->private_data.f_src_palette[(((v_i & 255) * 4) + 0)] = ((uint8_t)(((v_c5 << 3) | (v_c5 >> 2))));
42550 self->private_data.f_src_palette[(((v_i & 255) * 4) + 1)] = ((uint8_t)(((v_c5 << 3) | (v_c5 >> 2))));
42552 self->private_data.f_src_palette[(((v_i & 255) * 4) + 2)] = ((uint8_t)(((v_c5 << 3) | (v_c5 >> 2))));
42553 self->private_data.f_src_palette[(((v_i & 255) * 4) + 3)] = 255;
42558 self->private_data.f_src_palette[((v_i * 4) + 0)] = 0;
42559 self->private_data.f_src_palette[((v_i * 4) + 1)] = 0;
42560 self->private_data.f_src_palette[((v_i * 4) + 2)] = 0;
42561 self->private_data.f_src_palette[((v_i * 4) + 3)] = 255;
42565 self->private_impl.f_frame_config_io_position = wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)));
42569 self->private_impl.f_src_pixfmt,
42571 self->private_impl.f_width,
42572 self->private_impl.f_height,
42573 self->private_impl.f_frame_config_io_position,
42574 self->private_impl.f_opaque);
42576 self->private_impl.f_call_sequence = 3;
42580 self->private_impl.p_decode_image_config[0] = 0;
42586 self->private_impl.p_decode_image_config[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
42587 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
42588 self->private_data.s_decode_image_config[0].v_i = v_i;
42597 self->private_impl.magic = WUFFS_BASE__DISABLED;
42606 wuffs_tga__decoder* self,
42609 if (!self) {
42612 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
42614 (self->private_impl.magic == WUFFS_BASE__DISABLED)
42619 self->private_impl.magic = WUFFS_BASE__DISABLED;
42622 if ((self->private_impl.active_coroutine != 0) &&
42623 (self->private_impl.active_coroutine != 2)) {
42624 self->private_impl.magic = WUFFS_BASE__DISABLED;
42627 self->private_impl.active_coroutine = 0;
42641 uint32_t coro_susp_point = self->private_impl.p_decode_frame_config[0];
42645 if (self->private_impl.f_call_sequence < 3) {
42650 status = wuffs_tga__decoder__decode_image_config(self, NULL, a_src);
42657 } else if (self->private_impl.f_call_sequence == 3) {
42658 if (self->private_impl.f_frame_config_io_position != wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)))) {
42662 } else if (self->private_impl.f_call_sequence == 4) {
42663 self->private_impl.f_call_sequence = 255;
42676 self->private_impl.f_width,
42677 self->private_impl.f_height),
42680 self->private_impl.f_frame_config_io_position,
42682 self->private_impl.f_opaque,
42686 self->private_impl.f_call_sequence = 4;
42689 self->private_impl.p_decode_frame_config[0] = 0;
42695 self->private_impl.p_decode_frame_config[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
42696 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 2 : 0;
42705 self->private_impl.magic = WUFFS_BASE__DISABLED;
42714 wuffs_tga__decoder* self,
42720 if (!self) {
42723 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
42725 (self->private_impl.magic == WUFFS_BASE__DISABLED)
42730 self->private_impl.magic = WUFFS_BASE__DISABLED;
42733 if ((self->private_impl.active_coroutine != 0) &&
42734 (self->private_impl.active_coroutine != 3)) {
42735 self->private_impl.magic = WUFFS_BASE__DISABLED;
42738 self->private_impl.active_coroutine = 0;
42773 uint32_t coro_susp_point = self->private_impl.p_decode_frame[0];
42775 v_dst_bytes_per_pixel = self->private_data.s_decode_frame[0].v_dst_bytes_per_pixel;
42776 v_dst_x = self->private_data.s_decode_frame[0].v_dst_x;
42777 v_dst_y = self->private_data.s_decode_frame[0].v_dst_y;
42778 v_mark = self->private_data.s_decode_frame[0].v_mark;
42779 v_num_pixels32 = self->private_data.s_decode_frame[0].v_num_pixels32;
42780 v_lit_length = self->private_data.s_decode_frame[0].v_lit_length;
42781 v_run_length = self->private_data.s_decode_frame[0].v_run_length;
42782 v_num_dst_bytes = self->private_data.s_decode_frame[0].v_num_dst_bytes;
42787 if (self->private_impl.f_call_sequence < 4) {
42792 status = wuffs_tga__decoder__decode_frame_config(self, NULL, a_src);
42799 } else if (self->private_impl.f_call_sequence == 4) {
42804 if (self->private_impl.f_header_color_map_type != 0) {
42805 v_src_palette = wuffs_base__make_slice_u8(self->private_data.f_src_palette, 1024);
42807 v_status = wuffs_base__pixel_swizzler__prepare(&self->private_impl.f_swizzler,
42809 wuffs_base__pixel_buffer__palette_or_else(a_dst, wuffs_base__make_slice_u8(self->private_data.f_dst_palette, 1024)),
42810 wuffs_base__utility__make_pixel_format(self->private_impl.f_src_pixfmt),
42830 if ((self->private_impl.f_header_image_descriptor & 32) == 0) {
42831 v_dst_y = ((uint32_t)(self->private_impl.f_height - 1));
42833 if ((self->private_impl.f_header_image_type & 8) == 0) {
42834 v_lit_length = self->private_impl.f_width;
42839 v_dst_palette = wuffs_base__pixel_buffer__palette_or_else(a_dst, wuffs_base__make_slice_u8(self->private_data.f_dst_palette, 1024));
42840 while (v_dst_y < self->private_impl.f_height) {
42848 while (v_dst_x < self->private_impl.f_width) {
42849 if (self->private_impl.f_src_bytes_per_pixel > 0) {
42852 v_num_pixels64 = (((uint64_t)(io2_a_src - iop_a_src)) / ((uint64_t)(self->private_impl.f_src_bytes_per_pixel)));
42855 v_num_src_bytes = (v_num_pixels32 * self->private_impl.f_src_bytes_per_pixel);
42856 self->private_data.s_decode_frame[0].scratch = v_num_src_bytes;
42858 if (self->private_data.s_decode_frame[0].scratch > ((uint64_t)(io2_a_src - iop_a_src))) {
42859 self->private_data.s_decode_frame[0].scratch -= ((uint64_t)(io2_a_src - iop_a_src));
42864 iop_a_src += self->private_data.s_decode_frame[0].scratch;
42865 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, v_dst, v_dst_palette, wuffs_base__io__since(v_mark, ((uint64_t)(iop_a_src - io0_a_src)), io0_a_src));
42880 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, v_dst, v_dst_palette, wuffs_base__slice_u8__subslice_j(wuffs_base__make_slice_u8(self->private_data.f_scratch, 4), self->private_impl.f_scratch_bytes_per_pixel));
42894 if ((v_lit_length + v_dst_x) > self->private_impl.f_width) {
42899 if (self->private_impl.f_src_bytes_per_pixel == 1) {
42907 self->private_data.f_scratch[0] = wuffs_base__peek_u8be__no_bounds_check(iop_a_src);
42909 } else if (self->private_impl.f_src_bytes_per_pixel == 3) {
42917 self->private_data.f_scratch[0] = wuffs_base__peek_u8be__no_bounds_check(iop_a_src);
42919 self->private_data.f_scratch[1] = wuffs_base__peek_u8be__no_bounds_check(iop_a_src);
42921 self->private_data.f_scratch[2] = wuffs_base__peek_u8be__no_bounds_check(iop_a_src);
42931 self->private_data.f_scratch[0] = wuffs_base__peek_u8be__no_bounds_check(iop_a_src);
42933 self->private_data.f_scratch[1] = wuffs_base__peek_u8be__no_bounds_check(iop_a_src);
42935 self->private_data.f_scratch[2] = wuffs_base__peek_u8be__no_bounds_check(iop_a_src);
42937 self->private_data.f_scratch[3] = wuffs_base__peek_u8be__no_bounds_check(iop_a_src);
42940 if ((v_run_length + v_dst_x) > self->private_impl.f_width) {
42956 self->private_data.f_scratch[0] = ((uint8_t)(((v_c5 << 3) | (v_c5 >> 2))));
42958 self->private_data.f_scratch[1] = ((uint8_t)(((v_c5 << 3) | (v_c5 >> 2))));
42960 self->private_data.f_scratch[2] = ((uint8_t)(((v_c5 << 3) | (v_c5 >> 2))));
42961 self->private_data.f_scratch[3] = 255;
42962 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, v_dst, v_dst_palette, wuffs_base__make_slice_u8(self->private_data.f_scratch, 4));
42970 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, v_dst, v_dst_palette, wuffs_base__slice_u8__subslice_j(wuffs_base__make_slice_u8(self->private_data.f_scratch, 4), self->private_impl.f_scratch_bytes_per_pixel));
42984 if ((v_lit_length + v_dst_x) > self->private_impl.f_width) {
42999 self->private_data.f_scratch[0] = ((uint8_t)(((v_c5 << 3) | (v_c5 >> 2))));
43001 self->private_data.f_scratch[1] = ((uint8_t)(((v_c5 << 3) | (v_c5 >> 2))));
43003 self->private_data.f_scratch[2] = ((uint8_t)(((v_c5 << 3) | (v_c5 >> 2))));
43004 self->private_data.f_scratch[3] = 255;
43005 if ((v_run_length + v_dst_x) > self->private_impl.f_width) {
43014 if ((self->private_impl.f_header_image_descriptor & 32) == 0) {
43019 if ((self->private_impl.f_header_image_type & 8) == 0) {
43020 v_lit_length = self->private_impl.f_width;
43026 self->private_impl.f_call_sequence = 255;
43029 self->private_impl.p_decode_frame[0] = 0;
43035 self->private_impl.p_decode_frame[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
43036 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 3 : 0;
43037 self->private_data.s_decode_frame[0].v_dst_bytes_per_pixel = v_dst_bytes_per_pixel;
43038 self->private_data.s_decode_frame[0].v_dst_x = v_dst_x;
43039 self->private_data.s_decode_frame[0].v_dst_y = v_dst_y;
43040 self->private_data.s_decode_frame[0].v_mark = v_mark;
43041 self->private_data.s_decode_frame[0].v_num_pixels32 = v_num_pixels32;
43042 self->private_data.s_decode_frame[0].v_lit_length = v_lit_length;
43043 self->private_data.s_decode_frame[0].v_run_length = v_run_length;
43044 self->private_data.s_decode_frame[0].v_num_dst_bytes = v_num_dst_bytes;
43053 self->private_impl.magic = WUFFS_BASE__DISABLED;
43062 const wuffs_tga__decoder* self) {
43063 if (!self) {
43066 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
43067 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
43074 self->private_impl.f_width,
43075 self->private_impl.f_height);
43082 const wuffs_tga__decoder* self) {
43083 if (!self) {
43086 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
43087 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
43098 const wuffs_tga__decoder* self) {
43099 if (!self) {
43102 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
43103 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
43107 if (self->private_impl.f_call_sequence > 3) {
43117 const wuffs_tga__decoder* self) {
43118 if (!self) {
43121 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
43122 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
43126 if (self->private_impl.f_call_sequence > 4) {
43136 wuffs_tga__decoder* self,
43139 if (!self) {
43142 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
43144 (self->private_impl.magic == WUFFS_BASE__DISABLED)
43149 if (self->private_impl.f_call_sequence < 3) {
43155 self->private_impl.f_call_sequence = 3;
43156 self->private_impl.f_frame_config_io_position = a_io_position;
43164 wuffs_tga__decoder* self,
43174 wuffs_tga__decoder* self,
43178 if (!self) {
43181 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
43183 (self->private_impl.magic == WUFFS_BASE__DISABLED)
43188 self->private_impl.magic = WUFFS_BASE__DISABLED;
43191 if ((self->private_impl.active_coroutine != 0) &&
43192 (self->private_impl.active_coroutine != 4)) {
43193 self->private_impl.magic = WUFFS_BASE__DISABLED;
43196 self->private_impl.active_coroutine = 0;
43207 self->private_impl.magic = WUFFS_BASE__DISABLED;
43216 const wuffs_tga__decoder* self) {
43217 if (!self) {
43220 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
43221 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
43282 wuffs_wbmp__decoder* self,
43286 if (!self) {
43289 if (sizeof(*self) != sizeof_star_self) {
43298 // The whole point of this if-check is to detect an uninitialized *self.
43304 if (self->private_impl.magic != 0) {
43312 memset(self, 0, sizeof(*self));
43315 memset(&(self->private_impl), 0, sizeof(self->private_impl));
43319 self->private_impl.magic = WUFFS_BASE__MAGIC;
43320 self->private_impl.vtable_for__wuffs_base__image_decoder.vtable_name =
43322 self->private_impl.vtable_for__wuffs_base__image_decoder.function_pointers =
43353 wuffs_wbmp__decoder* self,
43363 wuffs_wbmp__decoder* self,
43366 if (!self) {
43369 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
43371 (self->private_impl.magic == WUFFS_BASE__DISABLED)
43376 self->private_impl.magic = WUFFS_BASE__DISABLED;
43379 if ((self->private_impl.active_coroutine != 0) &&
43380 (self->private_impl.active_coroutine != 1)) {
43381 self->private_impl.magic = WUFFS_BASE__DISABLED;
43384 self->private_impl.active_coroutine = 0;
43403 uint32_t coro_susp_point = self->private_impl.p_decode_image_config[0];
43405 v_i = self->private_data.s_decode_image_config[0].v_i;
43406 v_x32 = self->private_data.s_decode_image_config[0].v_x32;
43411 if (self->private_impl.f_call_sequence != 0) {
43458 self->private_impl.f_width = v_x32;
43460 self->private_impl.f_height = v_x32;
43464 self->private_impl.f_frame_config_io_position = wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)));
43470 self->private_impl.f_width,
43471 self->private_impl.f_height,
43472 self->private_impl.f_frame_config_io_position,
43475 self->private_impl.f_call_sequence = 3;
43479 self->private_impl.p_decode_image_config[0] = 0;
43485 self->private_impl.p_decode_image_config[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
43486 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 1 : 0;
43487 self->private_data.s_decode_image_config[0].v_i = v_i;
43488 self->private_data.s_decode_image_config[0].v_x32 = v_x32;
43497 self->private_impl.magic = WUFFS_BASE__DISABLED;
43506 wuffs_wbmp__decoder* self,
43509 if (!self) {
43512 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
43514 (self->private_impl.magic == WUFFS_BASE__DISABLED)
43519 self->private_impl.magic = WUFFS_BASE__DISABLED;
43522 if ((self->private_impl.active_coroutine != 0) &&
43523 (self->private_impl.active_coroutine != 2)) {
43524 self->private_impl.magic = WUFFS_BASE__DISABLED;
43527 self->private_impl.active_coroutine = 0;
43541 uint32_t coro_susp_point = self->private_impl.p_decode_frame_config[0];
43545 if (self->private_impl.f_call_sequence < 3) {
43550 status = wuffs_wbmp__decoder__decode_image_config(self, NULL, a_src);
43557 } else if (self->private_impl.f_call_sequence == 3) {
43558 if (self->private_impl.f_frame_config_io_position != wuffs_base__u64__sat_add((a_src ? a_src->meta.pos : 0), ((uint64_t)(iop_a_src - io0_a_src)))) {
43562 } else if (self->private_impl.f_call_sequence == 4) {
43563 self->private_impl.f_call_sequence = 255;
43576 self->private_impl.f_width,
43577 self->private_impl.f_height),
43580 self->private_impl.f_frame_config_io_position,
43586 self->private_impl.f_call_sequence = 4;
43589 self->private_impl.p_decode_frame_config[0] = 0;
43595 self->private_impl.p_decode_frame_config[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
43596 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 2 : 0;
43605 self->private_impl.magic = WUFFS_BASE__DISABLED;
43614 wuffs_wbmp__decoder* self,
43620 if (!self) {
43623 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
43625 (self->private_impl.magic == WUFFS_BASE__DISABLED)
43630 self->private_impl.magic = WUFFS_BASE__DISABLED;
43633 if ((self->private_impl.active_coroutine != 0) &&
43634 (self->private_impl.active_coroutine != 3)) {
43635 self->private_impl.magic = WUFFS_BASE__DISABLED;
43638 self->private_impl.active_coroutine = 0;
43664 uint32_t coro_susp_point = self->private_impl.p_decode_frame[0];
43666 v_dst_bytes_per_pixel = self->private_data.s_decode_frame[0].v_dst_bytes_per_pixel;
43667 v_dst_x = self->private_data.s_decode_frame[0].v_dst_x;
43668 v_dst_y = self->private_data.s_decode_frame[0].v_dst_y;
43669 memcpy(v_src, self->private_data.s_decode_frame[0].v_src, sizeof(v_src));
43670 v_c = self->private_data.s_decode_frame[0].v_c;
43675 if (self->private_impl.f_call_sequence < 4) {
43680 status = wuffs_wbmp__decoder__decode_frame_config(self, NULL, a_src);
43687 } else if (self->private_impl.f_call_sequence == 4) {
43692 v_status = wuffs_base__pixel_swizzler__prepare(&self->private_impl.f_swizzler,
43715 if (self->private_impl.f_width > 0) {
43717 while (v_dst_y < self->private_impl.f_height) {
43720 while (v_dst_x < self->private_impl.f_width) {
43741 wuffs_base__pixel_swizzler__swizzle_interleaved_from_slice(&self->private_impl.f_swizzler, v_dst, wuffs_base__utility__empty_slice_u8(), wuffs_base__make_slice_u8(v_src, 1));
43750 self->private_impl.f_call_sequence = 255;
43753 self->private_impl.p_decode_frame[0] = 0;
43759 self->private_impl.p_decode_frame[0] = wuffs_base__status__is_suspension(&status) ? coro_susp_point : 0;
43760 self->private_impl.active_coroutine = wuffs_base__status__is_suspension(&status) ? 3 : 0;
43761 self->private_data.s_decode_frame[0].v_dst_bytes_per_pixel = v_dst_bytes_per_pixel;
43762 self->private_data.s_decode_frame[0].v_dst_x = v_dst_x;
43763 self->private_data.s_decode_frame[0].v_dst_y = v_dst_y;
43764 memcpy(self->private_data.s_decode_frame[0].v_src, v_src, sizeof(v_src));
43765 self->private_data.s_decode_frame[0].v_c = v_c;
43774 self->private_impl.magic = WUFFS_BASE__DISABLED;
43783 const wuffs_wbmp__decoder* self) {
43784 if (!self) {
43787 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
43788 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
43795 self->private_impl.f_width,
43796 self->private_impl.f_height);
43803 const wuffs_wbmp__decoder* self) {
43804 if (!self) {
43807 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
43808 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
43819 const wuffs_wbmp__decoder* self) {
43820 if (!self) {
43823 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
43824 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
43828 if (self->private_impl.f_call_sequence > 3) {
43838 const wuffs_wbmp__decoder* self) {
43839 if (!self) {
43842 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
43843 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
43847 if (self->private_impl.f_call_sequence > 4) {
43857 wuffs_wbmp__decoder* self,
43860 if (!self) {
43863 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
43865 (self->private_impl.magic == WUFFS_BASE__DISABLED)
43870 if (self->private_impl.f_call_sequence < 3) {
43876 self->private_impl.f_call_sequence = 3;
43877 self->private_impl.f_frame_config_io_position = a_io_position;
43885 wuffs_wbmp__decoder* self,
43895 wuffs_wbmp__decoder* self,
43899 if (!self) {
43902 if (self->private_impl.magic != WUFFS_BASE__MAGIC) {
43904 (self->private_impl.magic == WUFFS_BASE__DISABLED)
43909 self->private_impl.magic = WUFFS_BASE__DISABLED;
43912 if ((self->private_impl.active_coroutine != 0) &&
43913 (self->private_impl.active_coroutine != 4)) {
43914 self->private_impl.magic = WUFFS_BASE__DISABLED;
43917 self->private_impl.active_coroutine = 0;
43928 self->private_impl.magic = WUFFS_BASE__DISABLED;
43937 const wuffs_wbmp__decoder* self) {
43938 if (!self) {
43941 if ((self->private_impl.magic != WUFFS_BASE__MAGIC) &&
43942 (self->private_impl.magic != WUFFS_BASE__DISABLED)) {
44878 DIHM0(void* self,
44883 static_cast<wuffs_base__image_decoder*>(self), a_dst, a_minfo, a_src);
44887 DIHM1(void* self,
44890 return static_cast<DecodeImageCallbacks*>(self)->HandleMetadata(*minfo, raw);