Big rework: everything now matches the latest spec

This commit is contained in:
Ivan Smirnov 2021-12-29 22:41:39 +03:00
commit b0467472ae
4 changed files with 144 additions and 261 deletions

View file

@ -1,23 +1,11 @@
// 2-bit tag
pub const QOI_INDEX: u8 = 0x00; // (00)000000
pub const QOI_DIFF_8: u8 = 0x80; // (10)000000
pub const QOI_OP_INDEX: u8 = 0x00; // 00xxxxxx
pub const QOI_OP_DIFF: u8 = 0x40; // 01xxxxxx
pub const QOI_OP_LUMA: u8 = 0x80; // 10xxxxxx
pub const QOI_OP_RUN: u8 = 0xc0; // 11xxxxxx
pub const QOI_OP_RGB: u8 = 0xfe; // 11111110
pub const QOI_OP_RGBA: u8 = 0xff; // 11111111
// 3-bit tag
pub const QOI_RUN_8: u8 = 0x40; // (010)00000
pub const QOI_RUN_16: u8 = 0x60; // (011)00000
pub const QOI_DIFF_16: u8 = 0xc0; // (110)00000
// 4-bit tag
pub const QOI_DIFF_24: u8 = 0xe0; // (1110)0000
pub const QOI_COLOR: u8 = 0xf0; // (1111)0000
// tag masks
#[allow(unused)]
pub const QOI_MASK_2: u8 = 0xc0; // (11)000000
#[allow(unused)]
pub const QOI_MASK_3: u8 = 0xe0; // (111)00000
#[allow(unused)]
pub const QOI_MASK_4: u8 = 0xf0; // (1111)0000
pub const QOI_HEADER_SIZE: usize = 14;