mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 00:47:56 +01:00
Prepare to call decode_huffman_fast more often
This commit is contained in:
1 parent
1af543866c
commit
2fd03f42b5
2 files changed
+51
-46
No files matched your search
@@ -5552,42 +5552,45 @@ wuffs_deflate__decoder__decode_blocks(wuffs_deflate__decoder* self,
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
self->private_impl.f_end_of_block = false;
|
self->private_impl.f_end_of_block = false;
|
||||||
if (a_src.private_impl.buf) {
|
while (true) {
|
||||||
a_src.private_impl.buf->meta.ri =
|
if (a_src.private_impl.buf) {
|
||||||
iop_a_src - a_src.private_impl.buf->data.ptr;
|
a_src.private_impl.buf->meta.ri =
|
||||||
}
|
iop_a_src - a_src.private_impl.buf->data.ptr;
|
||||||
v_status =
|
}
|
||||||
wuffs_deflate__decoder__decode_huffman_fast(self, a_dst, a_src);
|
v_status =
|
||||||
if (a_src.private_impl.buf) {
|
wuffs_deflate__decoder__decode_huffman_fast(self, a_dst, a_src);
|
||||||
iop_a_src =
|
if (a_src.private_impl.buf) {
|
||||||
a_src.private_impl.buf->data.ptr + a_src.private_impl.buf->meta.ri;
|
iop_a_src = a_src.private_impl.buf->data.ptr +
|
||||||
}
|
a_src.private_impl.buf->meta.ri;
|
||||||
if (wuffs_base__status__is_error(v_status)) {
|
}
|
||||||
status = v_status;
|
if (wuffs_base__status__is_error(v_status)) {
|
||||||
|
status = v_status;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
if (self->private_impl.f_end_of_block) {
|
||||||
|
goto label_0_continue;
|
||||||
|
}
|
||||||
|
if (a_src.private_impl.buf) {
|
||||||
|
a_src.private_impl.buf->meta.ri =
|
||||||
|
iop_a_src - a_src.private_impl.buf->data.ptr;
|
||||||
|
}
|
||||||
|
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
||||||
|
status =
|
||||||
|
wuffs_deflate__decoder__decode_huffman_slow(self, a_dst, a_src);
|
||||||
|
if (a_src.private_impl.buf) {
|
||||||
|
iop_a_src = a_src.private_impl.buf->data.ptr +
|
||||||
|
a_src.private_impl.buf->meta.ri;
|
||||||
|
}
|
||||||
|
if (status) {
|
||||||
|
goto suspend;
|
||||||
|
}
|
||||||
|
if (self->private_impl.f_end_of_block) {
|
||||||
|
goto label_0_continue;
|
||||||
|
}
|
||||||
|
status =
|
||||||
|
wuffs_deflate__error__internal_error_inconsistent_huffman_end_of_block;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
if (self->private_impl.f_end_of_block) {
|
|
||||||
goto label_0_continue;
|
|
||||||
}
|
|
||||||
if (a_src.private_impl.buf) {
|
|
||||||
a_src.private_impl.buf->meta.ri =
|
|
||||||
iop_a_src - a_src.private_impl.buf->data.ptr;
|
|
||||||
}
|
|
||||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
|
||||||
status = wuffs_deflate__decoder__decode_huffman_slow(self, a_dst, a_src);
|
|
||||||
if (a_src.private_impl.buf) {
|
|
||||||
iop_a_src =
|
|
||||||
a_src.private_impl.buf->data.ptr + a_src.private_impl.buf->meta.ri;
|
|
||||||
}
|
|
||||||
if (status) {
|
|
||||||
goto suspend;
|
|
||||||
}
|
|
||||||
if (self->private_impl.f_end_of_block) {
|
|
||||||
goto label_0_continue;
|
|
||||||
}
|
|
||||||
status =
|
|
||||||
wuffs_deflate__error__internal_error_inconsistent_huffman_end_of_block;
|
|
||||||
goto exit;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
goto ok;
|
goto ok;
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ pri func decoder.decode_blocks?(dst base.io_writer, src base.io_reader) {
|
|||||||
var type base.u32
|
var type base.u32
|
||||||
var status base.status
|
var status base.status
|
||||||
|
|
||||||
while final == 0 {
|
while:outer final == 0 {
|
||||||
while this.n_bits < 3,
|
while this.n_bits < 3,
|
||||||
post this.n_bits >= 3,
|
post this.n_bits >= 3,
|
||||||
{
|
{
|
||||||
@@ -218,18 +218,20 @@ pri func decoder.decode_blocks?(dst base.io_writer, src base.io_reader) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.end_of_block = false
|
this.end_of_block = false
|
||||||
status = this.decode_huffman_fast!(dst:args.dst, src:args.src)
|
while true {
|
||||||
if status.is_error() {
|
status = this.decode_huffman_fast!(dst:args.dst, src:args.src)
|
||||||
return status
|
if status.is_error() {
|
||||||
|
return status
|
||||||
|
}
|
||||||
|
if this.end_of_block {
|
||||||
|
continue:outer
|
||||||
|
}
|
||||||
|
this.decode_huffman_slow?(dst:args.dst, src:args.src)
|
||||||
|
if this.end_of_block {
|
||||||
|
continue:outer
|
||||||
|
}
|
||||||
|
return "?internal error: inconsistent Huffman end_of_block"
|
||||||
}
|
}
|
||||||
if this.end_of_block {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
this.decode_huffman_slow?(dst:args.dst, src:args.src)
|
|
||||||
if this.end_of_block {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
return "?internal error: inconsistent Huffman end_of_block"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user