From 1ac167fc3db2f81517f59a6ed69116b07f9c1a3e Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Sat, 13 Jun 2026 10:31:56 +1000 Subject: [PATCH] std/vp8: tweak decoder.clip_127 --- release/c/wuffs-unsupported-snapshot.c | 8 ++++---- std/vp8/decode_first_partition.wuffs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index 6a73336c..67193e5c 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -82305,12 +82305,12 @@ static uint32_t wuffs_vp8__decoder__clip_127( const wuffs_vp8__decoder* self, uint32_t a_a) { - if (a_a >= 2147483648u) { - return 0u; - } else if (a_a >= 127u) { + if (a_a <= 127u) { + return a_a; + } else if (a_a < 2147483648u) { return 127u; } - return a_a; + return 0u; } // -------- func vp8.decoder.decode_other_partition_lengths diff --git a/std/vp8/decode_first_partition.wuffs b/std/vp8/decode_first_partition.wuffs index df806c80..6a151961 100644 --- a/std/vp8/decode_first_partition.wuffs +++ b/std/vp8/decode_first_partition.wuffs @@ -239,12 +239,12 @@ pri func decoder.calculate_dequants!() { } pri func decoder.clip_127(a: base.u32) base.u32[..= 127] { - if args.a >= 0x8000_0000 { - return 0 - } else if args.a >= 127 { + if args.a <= 127 { + return args.a + } else if args.a < 0x8000_0000 { return 127 } - return args.a + return 0 } pri func decoder.decode_other_partition_lengths!(workbuf: roslice base.u8) base.status {