Module decode

Module decode 

Source
Expand description

This module contains the main functions for decoding XBEN and BEN files.

XBEN files are generally transformed back into BEN files, and BEN files are transformed into a JSONL file with the formatting

{"assignment": [...], "sample": #}

The BEN file format is a bit-packed binary format that is used to store run-length encoded assignment vectors, and is streamable. Therefore, the BEN file format works well with the read submodule of this module which is designed to extract a single assignment vector from a BEN file.

Modules§

read
Module documentation.

Structs§

BenDecoder
BenFrame
A single frame from a BEN file.
BenFrameDecoeder
SubsampleFrameDecoder
XBenDecoder
Iterator over decoded assignments inside an XBEN stream. Yields (assignment, count) where count is the repetition count
XBenFrameDecoder
Iterator over raw ben32 frames inside an XBEN stream.

Enums§

DecoderInitError
Frame
A generalized frame object that can be either a BenFrame or a XBEN frame (raw bytes + variant).
Selection

Functions§

build_frame_iter
Build a frame iterator from a file path and mode (“ben” or “xben”)
count_samples_from_file
decode_ben_line
This is a helper function that is designed to read in a single ben encoded line and convert it to a regular run-length encoded assignment vector.
decode_ben_to_jsonl
This function takes a reader containing a file encoded in the BEN format and decodes it into a JSONL file.
decode_xben_to_ben
This function takes a reader containing a file encoded in the XBEN format and decodes it into a BEN file.
decode_xben_to_jsonl
This function takes a reader containing a file encoded in the XBEN format and decodes it into a JSONL file.
xz_decompress
This is a convenience function that decodes a general level 9 LZMA2 compressed file.

Type Aliases§

Ben32Frame
A frame is the raw ben32 bytes plus its repetition count (1 for Standard).
FrameIter
MkvRecord