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.
- BenFrame
Decoeder - Subsample
Frame Decoder - XBen
Decoder - Iterator over decoded assignments inside an XBEN stream.
Yields
(assignment, count)wherecountis the repetition count - XBen
Frame Decoder - Iterator over raw ben32 frames inside an XBEN stream.
Enums§
- Decoder
Init Error - 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§
- Ben32
Frame - A frame is the raw ben32 bytes plus its repetition count (1 for Standard).
- Frame
Iter - MkvRecord