From d33484c3c85d5c04f05cf3fb8bc3e6050a7bbe04 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Wed, 29 Apr 2026 15:49:57 +0900 Subject: [PATCH] perkele --- it2taud.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/it2taud.py b/it2taud.py index 5bed015..6abb0dd 100644 --- a/it2taud.py +++ b/it2taud.py @@ -327,9 +327,11 @@ def _it214_decompress_block(payload: bytes, num_samples: int, width = (v & (top_bit - 1)) + 1 continue - # Real sample delta. For full-form the top bit was the escape flag so the - # signed delta is in the lower (init_width-1) bits — same as C's (int8)value. - delta = _sign_extend(v, min(width, init_width - 1)) + # Delta is always cast to the native sample type regardless of current bit-width. + # IT SDK: d1 += (signed char)value — i.e. always 8-bit (or 16-bit) signed cast. + # Upper-half short-form values (v > escape midpoint) are larger *positive* deltas, + # not negatives; _sign_extend(v, width) would wrongly negate them. + delta = _sign_extend(v, init_width - 1) if is_16bit: d1 = _wrap16(d1 + delta) if is_it215: