You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bound Book Format (.bbf) is a high-performance, archival-grade binary container designed specifically for digital comic books and manga. Unlike CBR/CBZ, BBF is built for DirectSotrage/mmap, easy integrity checks, and mixed-codec containerization.
9
+
10
+
## Technical Details
11
+
BBF is designed as a Footer-indexed binary format. This allows for rapid append-only creation and immediate random access to any page without scanning the entire file.
12
+
13
+
### Binary Layout
14
+
1.**Header (13 bytes)**: Magic `BBF1`, versioning, and initial padding.
15
+
2.**Page Data**: The raw image payloads (AVIF, PNG, etc.), each padded to **4096-byte boundaries**.
16
+
3.**String Pool**: A deduplicated pool of null-terminated strings for metadata and section titles.
17
+
4.**Asset Table**: A registry of physical data blobs with XXH3 hashes.
18
+
5.**Page Table**: The logical reading order, mapping logical pages to assets.
19
+
6.**Section Table**: Markers for chapters, volumes, or gallery sections.
20
+
7.**Metadata Table**: Key-Value pairs for archival data (Author, Scanlation team, etc.).
21
+
8.**Footer (76 bytes)**: Table offsets and a final integrity hash.
22
+
23
+
### 4KB Alignment & DirectStorage
24
+
Every asset in a BBF file starts on a 4KB boundary. This alignment is critical for modern NVMe-based systems. It allows developers to utilize `mmap` or **DirectStorage** to transfer image data directly from disk to GPU memory, bypassing the CPU-bottlenecked "copy and decompress" cycles found in Zip-based formats.
25
+
26
+
---
27
+
28
+
## Features
29
+
30
+
### Content Deduplication
31
+
BBF uses **[XXH3_64](https://github.com/Cyan4973/xxHash)** hashing to identify identical pages. If a book contains duplicate pages, the data is stored exactly once on disk while being referenced multiple times in the Page Table.
32
+
33
+
### Archival Integrity
34
+
Traditional bit-rot is the enemy of the archivist. BBF stores a 64-bit hash for *every individual asset*. The `bbfmux --verify` command can pinpoint exactly which page in a 2GB file has been damaged, rather than simply failing to open the entire archive.
35
+
36
+
### Mixed-Codec Support
37
+
Preserve covers in **Lossless PNG** while encoding internal story pages in **AVIF** to save 70% space. BBF explicitly flags the codec for every asset, allowing readers to initialize the correct decoder instantly without "guessing" the file type.
38
+
39
+
---
40
+
41
+
## CLI Usage: `bbfmux`
42
+
43
+
The included `bbfmux` tool is a reference implementation for creating and managing BBF files.
44
+
45
+
## CLI Features
46
+
47
+
The `bbfmux` utility provides a powerful interface for managing Bound Book files:
48
+
49
+
***Flexible Ingestion**: Create books by passing individual files, entire directories, or a mix of both.
50
+
***Logical Structuring**: Add named **Sections** (Chapters, Volumes, Galleries) to define the internal hierarchy of the book.
51
+
***Custom Metadata**: Embed arbitrary Key:Value pairs into the global string pool for archival indexing.
52
+
***Content-Aware Extraction**: Extract the entire book or target specific sections by name.
53
+
54
+
## Usage Examples
55
+
56
+
### Create a new BBF
57
+
You can mix individual images and folders. `bbfmux` will sort inputs alphabetically, deduplicate identical assets, and align data to 4KB boundaries.
58
+
59
+
NOTE: It's not quite implemented yet in the CLI, but the `AssetTable` enables you to specify custom reading orders.
60
+
61
+
```bash
62
+
bbfmux cover.png ./chapter1/ endcard.png \
63
+
--section="Cover":1 \
64
+
--section="Chapter 1":2 \
65
+
--section="Credits":24 \
66
+
--meta=Title:"Akira" \
67
+
--meta=Author:"Katsuhiro Otomo" \
68
+
akira.bbf
69
+
```
70
+
71
+
### Verify Integrity
72
+
Scan for bit-rot or data corruption. Will tell you which assets are corrupted.
0 commit comments