diff options
author | metamuffin <metamuffin@disroot.org> | 2023-03-08 21:26:35 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-03-08 21:26:35 +0100 |
commit | 292519649c4244adb6672488efe7c2e906726c58 (patch) | |
tree | 41e2cd62d53b47afa7995d91a326ef2e361029c7 /lvc/src/encode.rs | |
parent | 5b3c03bc0cfcf89e76953dde13ed58a39b5d1dd0 (diff) | |
download | video-codec-experiments-292519649c4244adb6672488efe7c2e906726c58.tar video-codec-experiments-292519649c4244adb6672488efe7c2e906726c58.tar.bz2 video-codec-experiments-292519649c4244adb6672488efe7c2e906726c58.tar.zst |
about to implement huff
Diffstat (limited to 'lvc/src/encode.rs')
-rw-r--r-- | lvc/src/encode.rs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/lvc/src/encode.rs b/lvc/src/encode.rs index fde4f94..4ec72cf 100644 --- a/lvc/src/encode.rs +++ b/lvc/src/encode.rs @@ -49,14 +49,18 @@ pub fn optimize_ref( frame: &Frame, view: View, r: Ref, - granularity: i32, + g: i32, target_average: Pixel, ) -> (u32, Ref) { [ - Some(r.apply(|r| r.pos_off.x += granularity)), - Some(r.apply(|r| r.pos_off.x -= granularity)), - Some(r.apply(|r| r.pos_off.y += granularity)), - Some(r.apply(|r| r.pos_off.y -= granularity)), + Some(r.apply(|r| r.pos_off += P2 { x: g, y: 0 })), + Some(r.apply(|r| r.pos_off += P2 { x: g, y: g })), + Some(r.apply(|r| r.pos_off += P2 { x: 0, y: g })), + Some(r.apply(|r| r.pos_off += P2 { x: -g, y: g })), + Some(r.apply(|r| r.pos_off += P2 { x: -g, y: 0 })), + Some(r.apply(|r| r.pos_off += P2 { x: -g, y: -g })), + Some(r.apply(|r| r.pos_off += P2 { x: 0, y: -g })), + Some(r.apply(|r| r.pos_off += P2 { x: g, y: -g })), { let mut r = r; let last_avr = average_color(last_frame, view); @@ -68,12 +72,12 @@ pub fn optimize_ref( None } }, - // n(|r, g| r.color_off.r += (g as i16) << 2); - // n(|r, g| r.color_off.r -= (g as i16) << 2); - // n(|r, g| r.color_off.g += (g as i16) << 2); - // n(|r, g| r.color_off.g -= (g as i16) << 2); - // n(|r, g| r.color_off.b += (g as i16) << 2); - // n(|r, g| r.color_off.b -= (g as i16) << 2); + // Some(r.apply(|r| r.color_off.r += (g as i16) << 2)), + // Some(r.apply(|r| r.color_off.r -= (g as i16) << 2)), + // Some(r.apply(|r| r.color_off.g += (g as i16) << 2)), + // Some(r.apply(|r| r.color_off.g -= (g as i16) << 2)), + // Some(r.apply(|r| r.color_off.b += (g as i16) << 2)), + // Some(r.apply(|r| r.color_off.b -= (g as i16) << 2)), ] .into_iter() .flatten() |