it2taud sample signedness fix

This commit is contained in:
minjaesong
2026-04-29 12:27:52 +09:00
parent 27e4bc1ae5
commit b3c5719e3a

View File

@@ -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: