add 8x8 cell partial update encoding
This commit is contained in:
parent
1f61cebd50
commit
b85cb52ce0
3 changed files with 83 additions and 4 deletions
|
@ -8,6 +8,7 @@ pub use util::*;
|
|||
|
||||
const INSPECT_ENC: bool = false;
|
||||
const INSPECT_DEC: bool = false;
|
||||
const MAX_ERROR: usize = 0;
|
||||
|
||||
fn main() {
|
||||
let frames = get_all_frames("../video/frames/");
|
||||
|
@ -56,8 +57,8 @@ fn encode(frames: &[Frame]) -> Vec<u8> {
|
|||
enc::rle_diff_horizontal,
|
||||
enc::rle_diff_vertical,
|
||||
enc::bg_strips_horizontal,
|
||||
enc::cell_diff_8_horizontal,
|
||||
];
|
||||
let max_error = 0;
|
||||
|
||||
let mut last_frame = FRAME_0;
|
||||
for (i, frame) in frames.iter().enumerate() {
|
||||
|
@ -67,7 +68,7 @@ fn encode(frames: &[Frame]) -> Vec<u8> {
|
|||
let decode = get_matching_decoder(encoded.encoding);
|
||||
let decoded = decode(&last_frame, &encoded.data, &mut 0);
|
||||
let error = frame_error(frame, &decoded);
|
||||
if error <= max_error {
|
||||
if error <= MAX_ERROR {
|
||||
options.push(encoded);
|
||||
} else {
|
||||
// dbg!(&encoded);
|
||||
|
@ -108,7 +109,7 @@ enum Encoding {
|
|||
// BGStripsV,
|
||||
// QuadTree,
|
||||
// DrawCommands,
|
||||
// CellDiff8H,
|
||||
CellDiff8H,
|
||||
// CellDiff8V,
|
||||
// CellDiff4HH,
|
||||
// CellDiff4HV,
|
||||
|
@ -128,7 +129,7 @@ fn get_matching_decoder(encoding: Encoding) -> FrameDecoder {
|
|||
// Encoding::BGStripsV => todo!(),
|
||||
// Encoding::QuadTree => todo!(),
|
||||
// Encoding::DrawCommands => todo!(),
|
||||
// Encoding::CellDiff8H => todo!(),
|
||||
Encoding::CellDiff8H => dec::cell_diff_8_horizontal,
|
||||
// Encoding::CellDiff8V => todo!(),
|
||||
// Encoding::CellDiff4HH => todo!(),
|
||||
// Encoding::CellDiff4HV => todo!(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue