From b3c5719e3a3c13d54d0b13ff9c988cbf5985005c Mon Sep 17 00:00:00 2001 From: minjaesong Date: Wed, 29 Apr 2026 12:27:52 +0900 Subject: [PATCH] it2taud sample signedness fix --- it2taud.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/it2taud.py b/it2taud.py index e3a5578..9d2b959 100644 --- a/it2taud.py +++ b/it2taud.py @@ -330,8 +330,11 @@ def _it214_decompress_block(payload: bytes, num_samples: int, width = new_w continue - # Real sample: sign-extend delta and accumulate - delta = _sign_extend(v, width) + # Real sample: sign-extend delta and accumulate. + # Full-form (width == init_width): top bit was the escape flag, so the + # actual signed delta occupies the lower (init_width-1) bits — equivalent + # to C's (int8)val / (int16)val. All other widths use their full width. + delta = _sign_extend(v, min(width, init_width - 1)) if is_16bit: d1 = _wrap16(d1 + delta) if is_it215: