1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
pub mod bc1;
pub mod bc3;
pub mod bc4;
pub mod color;
pub mod utils;
pub use crate::{
bc1::{encode_image_bc1, encode_image_bc1_conv_u8},
bc3::{encode_image_bc3, encode_image_bc3_conv_u8},
bc4::{
encode_image_bc4_r8, encode_image_bc4_r8_conv_u8, encode_image_bc4_rg8,
encode_image_bc4_rg8_conv_u8,
},
};
#[cfg(test)]
mod tests {
use crate::bc1::{encode_block_bc1, Block8};
use crate::color::Rgba8;
#[test]
fn test_encode_block() {
let block = [
Rgba8::new(0, 0, 0, 0),
Rgba8::new(64, 0, 0, 0),
Rgba8::new(128, 0, 0, 0),
Rgba8::new(255, 0, 0, 0),
Rgba8::new(0, 0, 0, 0),
Rgba8::new(64, 0, 0, 0),
Rgba8::new(128, 0, 0, 0),
Rgba8::new(255, 0, 0, 0),
Rgba8::new(0, 0, 0, 0),
Rgba8::new(64, 0, 0, 0),
Rgba8::new(128, 0, 0, 0),
Rgba8::new(255, 0, 0, 0),
Rgba8::new(0, 0, 0, 0),
Rgba8::new(64, 0, 0, 0),
Rgba8::new(128, 0, 0, 0),
Rgba8::new(255, 0, 0, 0),
];
assert_eq!(
encode_block_bc1(block),
Block8 {
max: 63488,
min: 0,
color_table: 4294967295,
}
);
}
}