10 fn get(x: usize, y: usize, size: usize) -> Self {
13 } else if y == size - 1 {
17 } else if x == size - 1 {
34 fn get(edge0: GlyphEdge, edge1: GlyphEdge) -> Self {
35 match (edge0, edge1) {
36 (GlyphEdge::Left, GlyphEdge::Right) |
37 (GlyphEdge::Right, GlyphEdge::Left) => GlyphDir::Up,
38 (GlyphEdge::Top, GlyphEdge::Bottom) |
39 (GlyphEdge::Bottom, GlyphEdge::Top) => GlyphDir::Right,
40 (GlyphEdge::Bottom, _) |
41 (_, GlyphEdge::Bottom) => GlyphDir::Up,
43 (_, GlyphEdge::Top) => GlyphDir::Down,
44 (GlyphEdge::Left, _) |
45 (_, GlyphEdge::Left) => GlyphDir::Left,
46 (GlyphEdge::Right, _) |
47 (_, GlyphEdge::Right) => GlyphDir::Right,
53 const XVEC4: [usize; 16] = [0, 1, 2, 3, 3, 3, 3, 2, 1, 0, 0, 0, 1, 2, 2, 1];
54 const YVEC4: [usize; 16] = [0, 0, 0, 0, 1, 2, 3, 3, 3, 3, 2, 1, 1, 1, 2, 2];
55 const XVEC8: [usize; 16] = [0, 2, 5, 7, 7, 7, 7, 7, 7, 5, 2, 0, 0, 0, 0, 0];
56 const YVEC8: [usize; 16] = [0, 0, 0, 0, 1, 3, 4, 6, 7, 7, 7, 7, 6, 4, 3, 1];
58 fn make_glyphs_47(glyphs4: &mut [[u8; 16]; 256], glyphs8: &mut [[u8; 64]; 256]) {
59 for (n, glyph) in glyphs4.iter_mut().enumerate() {
62 make_glyph_47(glyph, XVEC4[i], YVEC4[i], XVEC4[j], YVEC4[j], 4);
64 for (n, glyph) in glyphs8.iter_mut().enumerate() {
67 make_glyph_47(glyph, XVEC8[i], YVEC8[i], XVEC8[j], YVEC8[j], 8);
70 fn make_glyph_47(dst: &mut [u8], xi: usize, yi: usize, xj: usize, yj: usize, size: usize) {
71 let edge0 = GlyphEdge::get(xi, yi, size);
72 let edge1 = GlyphEdge::get(xj, yj, size);
73 let dir = GlyphDir::get(edge0, edge1);
74 let npoints = if xi > xj { xi - xj } else { xj - xi }.max(if yi > yj { yi - yj } else { yj - yi });
75 for ipoint in 0..=npoints {
76 let (p0, p1) = if npoints > 0 {
77 (interpolate(xi, xj, ipoint, npoints),
78 interpolate(yi, yj, ipoint, npoints))
82 let off = p0 + p1 * size;
86 dst[off - i * size] = 1;
91 dst[off + i * size] = 1;
100 for i in 0..size-p0 {
108 fn interpolate(a: usize, b: usize, pos1: usize, range: usize) -> usize {
109 (a * pos1 + b * (range - pos1) + range / 2) / range
113 pub use v1::get_decoder_video_v1;
115 pub use v2::get_decoder_video_v2;
118 pub use iact::get_decoder_iact;
120 pub use vima::get_decoder_vima;