mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 17:01:35 +01:00
Add write_to_ib_instead_of_w transition support
This commit is contained in:
1 parent
a66f8201cf
commit
9d524be60d
3 files changed
+20
No files matched your search
@@ -1258,6 +1258,7 @@ typedef struct {
|
||||
uint8_t v_lw;
|
||||
uint64_t v_block_size;
|
||||
wuffs_gif__status v_z;
|
||||
bool v_write_to_ib_instead_of_w;
|
||||
uint64_t v_n_copied;
|
||||
} c_decode_id_part1[1];
|
||||
} private_impl;
|
||||
@@ -3036,6 +3037,7 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id_part1(
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(ioptr_w);
|
||||
WUFFS_BASE__IGNORE_POTENTIALLY_UNUSED_VARIABLE(iobounds1_w);
|
||||
wuffs_gif__status v_z;
|
||||
bool v_write_to_ib_instead_of_w;
|
||||
wuffs_base__slice_u8 v_pass_through;
|
||||
uint64_t v_n_copied;
|
||||
wuffs_base__table_u8 v_tab;
|
||||
@@ -3085,12 +3087,15 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id_part1(
|
||||
v_block_size = self->private_impl.c_decode_id_part1[0].v_block_size;
|
||||
v_w = ((wuffs_base__io_writer){});
|
||||
v_z = self->private_impl.c_decode_id_part1[0].v_z;
|
||||
v_write_to_ib_instead_of_w =
|
||||
self->private_impl.c_decode_id_part1[0].v_write_to_ib_instead_of_w;
|
||||
v_pass_through = ((wuffs_base__slice_u8){});
|
||||
v_n_copied = self->private_impl.c_decode_id_part1[0].v_n_copied;
|
||||
v_tab = ((wuffs_base__table_u8){});
|
||||
v_pixel_data = ((wuffs_base__slice_u8){});
|
||||
} else {
|
||||
v_w = ((wuffs_base__io_writer){});
|
||||
v_write_to_ib_instead_of_w = false;
|
||||
v_pass_through = ((wuffs_base__slice_u8){});
|
||||
v_tab = ((wuffs_base__table_u8){});
|
||||
v_pixel_data = ((wuffs_base__slice_u8){});
|
||||
@@ -3219,6 +3224,8 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id_part1(
|
||||
a_src = o_0_a_src;
|
||||
}
|
||||
if ((v_z == 0) || (v_z == WUFFS_GIF__SUSPENSION_SHORT_WRITE)) {
|
||||
v_write_to_ib_instead_of_w = false;
|
||||
if (!v_write_to_ib_instead_of_w) {
|
||||
while (self->private_impl.f_uncompressed_ri <
|
||||
self->private_impl.f_uncompressed_wi) {
|
||||
v_pass_through = wuffs_base__slice_u8__subslice_ij(
|
||||
@@ -3241,12 +3248,14 @@ static wuffs_gif__status wuffs_gif__decoder__decode_id_part1(
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(7);
|
||||
}
|
||||
label_2_break:;
|
||||
} else {
|
||||
v_tab = wuffs_base__image_buffer__plane(a_ib, 0);
|
||||
if (((uint64_t)(v_tab.width)) == ((uint64_t)(v_tab.stride))) {
|
||||
v_pixel_data = wuffs_base__table_u8__linearize(v_tab);
|
||||
if (((uint64_t)(v_pixel_data.len)) == 0) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (v_z == WUFFS_GIF__SUSPENSION_SHORT_WRITE) {
|
||||
goto label_1_continue;
|
||||
}
|
||||
@@ -3278,6 +3287,8 @@ suspend:
|
||||
self->private_impl.c_decode_id_part1[0].v_lw = v_lw;
|
||||
self->private_impl.c_decode_id_part1[0].v_block_size = v_block_size;
|
||||
self->private_impl.c_decode_id_part1[0].v_z = v_z;
|
||||
self->private_impl.c_decode_id_part1[0].v_write_to_ib_instead_of_w =
|
||||
v_write_to_ib_instead_of_w;
|
||||
self->private_impl.c_decode_id_part1[0].v_n_copied = v_n_copied;
|
||||
|
||||
goto exit;
|
||||
|
||||
@@ -1258,6 +1258,7 @@ typedef struct {
|
||||
uint8_t v_lw;
|
||||
uint64_t v_block_size;
|
||||
wuffs_gif__status v_z;
|
||||
bool v_write_to_ib_instead_of_w;
|
||||
uint64_t v_n_copied;
|
||||
} c_decode_id_part1[1];
|
||||
} private_impl;
|
||||
|
||||
@@ -385,6 +385,11 @@ pri func decoder.decode_id_part1?(ib ptr base.image_buffer, dst base.io_writer,
|
||||
//
|
||||
// TODO: in.dst should be a ptr base.image_buffer and we should
|
||||
// composite the pixels instead of just copying them.
|
||||
//
|
||||
// TODO: delete the write_to_ib_instead_of_w hack. It should
|
||||
// always be true.
|
||||
var write_to_ib_instead_of_w base.bool = false
|
||||
if not write_to_ib_instead_of_w {
|
||||
while this.uncompressed_ri < this.uncompressed_wi {
|
||||
var pass_through slice base.u8 = this.uncompressed[this.uncompressed_ri:this.uncompressed_wi]
|
||||
var n_copied base.u64 = in.dst.copy_from_slice!(s:pass_through)
|
||||
@@ -397,6 +402,8 @@ pri func decoder.decode_id_part1?(ib ptr base.image_buffer, dst base.io_writer,
|
||||
// TODO: "closed for writes" instead?
|
||||
yield suspension "short write"
|
||||
}
|
||||
|
||||
} else {
|
||||
// TODO: don't assume a packed pixel format.
|
||||
var tab table base.u8 = in.ib.plane(p:0)
|
||||
if tab.width() == tab.stride() {
|
||||
@@ -407,6 +414,7 @@ pri func decoder.decode_id_part1?(ib ptr base.image_buffer, dst base.io_writer,
|
||||
} else {
|
||||
// TODO.
|
||||
}
|
||||
}
|
||||
|
||||
if z == suspension "short write" {
|
||||
continue:inner
|
||||
|
||||
Reference in new issue
Block a user