mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 08:38:14 +01:00
std/xz: implement apply_filter_09_sparc
This commit is contained in:
1 parent
af6c7b56af
commit
03bb04d80c
6 files changed
+112
No files matched your search
@@ -78,3 +78,34 @@ pri func decoder.apply_filter_07_arm!(dst_slice: slice base.u8) base.u8 {
|
||||
this.bcj_pos = p ~mod- 8
|
||||
return s.length() as base.u8
|
||||
}
|
||||
|
||||
pri func decoder.apply_filter_09_sparc!(dst_slice: slice base.u8) base.u8 {
|
||||
var s : slice base.u8
|
||||
var p : base.u32
|
||||
var x : base.u32
|
||||
|
||||
s = args.dst_slice
|
||||
p = this.bcj_pos
|
||||
|
||||
while s.length() >= 4,
|
||||
post s.length() < 4,
|
||||
{
|
||||
x = ((s[0] as base.u32) << 0x18) |
|
||||
((s[1] as base.u32) << 0x10) |
|
||||
((s[2] as base.u32) << 0x08) |
|
||||
((s[3] as base.u32) << 0x00)
|
||||
if ((x >> 22) == 0x100) or ((x >> 22) == 0x1FF) {
|
||||
x = ((x ~mod<< 2) ~mod- p) >> 2
|
||||
x = (0x4000_0000 - (x & 0x40_0000)) | 0x4000_0000 | (x & 0x3F_FFFF)
|
||||
s[0] = ((x >> 0x18) & 0xFF) as base.u8
|
||||
s[1] = ((x >> 0x10) & 0xFF) as base.u8
|
||||
s[2] = ((x >> 0x08) & 0xFF) as base.u8
|
||||
s[3] = ((x >> 0x00) & 0xFF) as base.u8
|
||||
}
|
||||
p ~mod+= 4
|
||||
s = s[4 ..]
|
||||
} endwhile
|
||||
|
||||
this.bcj_pos = p
|
||||
return s.length() as base.u8
|
||||
}
|
||||
@@ -423,6 +423,8 @@ pri func decoder.decode_block_header_sans_padding?(src: base.io_reader) {
|
||||
this.filters[f] = filter_id as base.u32
|
||||
if filter_id == 0x07 {
|
||||
choose apply_non_final_filters = [apply_filter_07_arm]
|
||||
} else if filter_id == 0x09 {
|
||||
choose apply_non_final_filters = [apply_filter_09_sparc]
|
||||
} else {
|
||||
return "#unsupported filter"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user