mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 08:38:14 +01:00
std/xz: implement apply_filter_05_powerpc
This commit is contained in:
1 parent
d2a63a7e34
commit
30133ad4b2
8 files changed
+91
No files matched your search
@@ -170,6 +170,36 @@ pri func decoder.apply_filter_04_x86!(dst_slice: slice base.u8) base.u8 {
|
||||
return s.length() as base.u8
|
||||
}
|
||||
|
||||
pri func decoder.apply_filter_05_powerpc!(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 & 0xFC00_0003) == 0x4800_0001 {
|
||||
x = (((x & 0x03FF_FFFC) ~mod- p) & 0x03FF_FFFC) | 0x4800_0001
|
||||
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
|
||||
}
|
||||
|
||||
pri func decoder.apply_filter_07_arm!(dst_slice: slice base.u8) base.u8 {
|
||||
var s : slice base.u8
|
||||
var p : base.u32
|
||||
|
||||
@@ -425,6 +425,8 @@ pri func decoder.decode_block_header_sans_padding?(src: base.io_reader) {
|
||||
this.filters[f] = filter_id as base.u32
|
||||
if filter_id == 0x04 {
|
||||
choose apply_non_final_filters = [apply_filter_04_x86]
|
||||
} else if filter_id == 0x05 {
|
||||
choose apply_non_final_filters = [apply_filter_05_powerpc]
|
||||
} else if filter_id == 0x07 {
|
||||
choose apply_non_final_filters = [apply_filter_07_arm]
|
||||
} else if filter_id == 0x08 {
|
||||
|
||||
Reference in new issue
Block a user