forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

tables.rs23 lines, 1.2 KiBHistoryRawDownload
1//! Scan orders and entropy codebooks (RDD 36 section 7).
2
3/// Progressive scan: coefficient index in decode order -> raster position.
4pub const PROGRESSIVE_SCAN: [u8; 64] = [
5 0, 1, 8, 9, 2, 3, 10, 11, 16, 17, 24, 25, 18, 19, 26, 27, 4, 5, 12, 20, 13, 6, 7, 14, 21, 28,
6 29, 22, 15, 23, 30, 31, 32, 33, 40, 48, 41, 34, 35, 42, 49, 56, 57, 50, 43, 36, 37, 44, 51, 58,
7 59, 52, 45, 38, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63,
8];
9
10/// Interlaced (field) scan.
11pub const INTERLACED_SCAN: [u8; 64] = [
12 0, 8, 1, 9, 16, 24, 17, 25, 2, 10, 3, 11, 18, 26, 19, 27, 32, 40, 33, 34, 41, 48, 56, 49, 42,
13 35, 43, 50, 57, 58, 51, 59, 4, 12, 5, 6, 13, 20, 28, 21, 14, 7, 15, 22, 29, 36, 44, 37, 30, 23,
14 31, 38, 45, 52, 60, 53, 46, 39, 47, 54, 61, 62, 55, 63,
15];
16
17/// Codebook byte: `rice_order << 5 | exp_golomb_order << 2 | (switch_bits - 1)`.
18pub const FIRST_DC_CB: u8 = 0xB8;
19pub const DC_CB: [u8; 7] = [0x04, 0x28, 0x28, 0x4D, 0x4D, 0x70, 0x70];
20pub const RUN_CB: [u8; 16] = [
21 0x06, 0x06, 0x05, 0x05, 0x04, 0x29, 0x29, 0x29, 0x29, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x4C,
22];
23pub const LEVEL_CB: [u8; 10] = [0x04, 0x0A, 0x05, 0x06, 0x04, 0x28, 0x28, 0x28, 0x28, 0x4C];