From 9ed6f2a8d84bc0fa0a78cac2bf4b1f73a4f4d1d0 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 12 May 2026 01:18:50 +0000 Subject: [PATCH] codec-re: add segment 1 block dumper for analysis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Investigated multi-segment Tran continuation but couldn't crack it. Each hypothesis tried (segment header consumes 0/1/2 T deltas, blocks continue Tran with various interpretations) breaks at sample ~512. Block budget for V70 segment 1: 264 nibbles + 244 RLE zeros = 508 deltas — exactly the segment size. So the block structure CAN encode 508 single-channel samples, but applying segment 1 blocks as Tran gives wrong values. Most likely the channel ordering changes in segment 1+ (e.g., segment 0 = Tran, segment 1 = Vert, segment 2 = Long, etc.) but I couldn't verify cleanly. Stopping here — segment-0 Tran decode is solid and multi-segment work needs more fresh thinking. --- analysis/seg1_blocks.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 analysis/seg1_blocks.py diff --git a/analysis/seg1_blocks.py b/analysis/seg1_blocks.py new file mode 100644 index 0000000..e29133d --- /dev/null +++ b/analysis/seg1_blocks.py @@ -0,0 +1,28 @@ +"""Dump all blocks in segment 1 of each event with their data.""" +import sys +sys.path.insert(0, ".") +from minimateplus.waveform_codec import walk_body, find_data_start + + +def main(): + for stem in ("M529LL1A.SP0", "M529LL1L.JQ0", "M529LL1L.V70"): + path = f"decode-re/5-11-26/{stem}" + with open(path, "rb") as f: + body = f.read()[43:-26] + blocks = walk_body(body, find_data_start(body)) + + # Find segment 1 (between first and second 40 02) + seg40_indices = [i for i, b in enumerate(blocks) if b.tag_hi == 0x40] + if len(seg40_indices) < 2: + print(f"\n{stem}: only {len(seg40_indices)} segment headers found") + seg1_blocks = blocks[seg40_indices[0]:] if seg40_indices else [] + else: + seg1_blocks = blocks[seg40_indices[0]:seg40_indices[1]+1] + print(f"\n=== {stem} segment 1 ({len(seg1_blocks)} blocks) ===") + for b in seg1_blocks[:25]: + tag = f"{b.tag_hi:02x}{b.tag_lo:02x}" + print(f" off={b.offset:>5} {tag} NN=0x{b.tag_lo:02x}({b.tag_lo:>3}) len={b.length:>3} data={b.data[:16].hex(' ')}{'...' if len(b.data)>16 else ''}") + + +if __name__ == "__main__": + main()