mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 00:55:11 +01:00
Prepare to call decode_huffman_fast more often
This commit is contained in:
1 parent
1af543866c
commit
2fd03f42b5
2 files changed
+13
-8
No files matched your search
@@ -5552,6 +5552,7 @@ 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;
|
||||||
|
while (true) {
|
||||||
if (a_src.private_impl.buf) {
|
if (a_src.private_impl.buf) {
|
||||||
a_src.private_impl.buf->meta.ri =
|
a_src.private_impl.buf->meta.ri =
|
||||||
iop_a_src - a_src.private_impl.buf->data.ptr;
|
iop_a_src - a_src.private_impl.buf->data.ptr;
|
||||||
@@ -5559,8 +5560,8 @@ wuffs_deflate__decoder__decode_blocks(wuffs_deflate__decoder* self,
|
|||||||
v_status =
|
v_status =
|
||||||
wuffs_deflate__decoder__decode_huffman_fast(self, a_dst, a_src);
|
wuffs_deflate__decoder__decode_huffman_fast(self, a_dst, a_src);
|
||||||
if (a_src.private_impl.buf) {
|
if (a_src.private_impl.buf) {
|
||||||
iop_a_src =
|
iop_a_src = a_src.private_impl.buf->data.ptr +
|
||||||
a_src.private_impl.buf->data.ptr + a_src.private_impl.buf->meta.ri;
|
a_src.private_impl.buf->meta.ri;
|
||||||
}
|
}
|
||||||
if (wuffs_base__status__is_error(v_status)) {
|
if (wuffs_base__status__is_error(v_status)) {
|
||||||
status = v_status;
|
status = v_status;
|
||||||
@@ -5574,10 +5575,11 @@ wuffs_deflate__decoder__decode_blocks(wuffs_deflate__decoder* self,
|
|||||||
iop_a_src - a_src.private_impl.buf->data.ptr;
|
iop_a_src - a_src.private_impl.buf->data.ptr;
|
||||||
}
|
}
|
||||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
|
||||||
status = wuffs_deflate__decoder__decode_huffman_slow(self, a_dst, a_src);
|
status =
|
||||||
|
wuffs_deflate__decoder__decode_huffman_slow(self, a_dst, a_src);
|
||||||
if (a_src.private_impl.buf) {
|
if (a_src.private_impl.buf) {
|
||||||
iop_a_src =
|
iop_a_src = a_src.private_impl.buf->data.ptr +
|
||||||
a_src.private_impl.buf->data.ptr + a_src.private_impl.buf->meta.ri;
|
a_src.private_impl.buf->meta.ri;
|
||||||
}
|
}
|
||||||
if (status) {
|
if (status) {
|
||||||
goto suspend;
|
goto suspend;
|
||||||
@@ -5589,6 +5591,7 @@ wuffs_deflate__decoder__decode_blocks(wuffs_deflate__decoder* self,
|
|||||||
wuffs_deflate__error__internal_error_inconsistent_huffman_end_of_block;
|
wuffs_deflate__error__internal_error_inconsistent_huffman_end_of_block;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
goto ok;
|
goto ok;
|
||||||
ok:
|
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,20 +218,22 @@ pri func decoder.decode_blocks?(dst base.io_writer, src base.io_reader) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.end_of_block = false
|
this.end_of_block = false
|
||||||
|
while true {
|
||||||
status = this.decode_huffman_fast!(dst:args.dst, src:args.src)
|
status = this.decode_huffman_fast!(dst:args.dst, src:args.src)
|
||||||
if status.is_error() {
|
if status.is_error() {
|
||||||
return status
|
return status
|
||||||
}
|
}
|
||||||
if this.end_of_block {
|
if this.end_of_block {
|
||||||
continue
|
continue:outer
|
||||||
}
|
}
|
||||||
this.decode_huffman_slow?(dst:args.dst, src:args.src)
|
this.decode_huffman_slow?(dst:args.dst, src:args.src)
|
||||||
if this.end_of_block {
|
if this.end_of_block {
|
||||||
continue
|
continue:outer
|
||||||
}
|
}
|
||||||
return "?internal error: inconsistent Huffman end_of_block"
|
return "?internal error: inconsistent Huffman end_of_block"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// decode_uncompressed decodes an uncompresed block as per the RFC section
|
// decode_uncompressed decodes an uncompresed block as per the RFC section
|
||||||
// 3.2.4.
|
// 3.2.4.
|
||||||
|
|||||||
Reference in new issue
Block a user