frame compression on line basis
it also takes in account lines of other frames
This commit is contained in:
parent
bca7bde569
commit
f98e83b8fa
32
frame.cpp
32
frame.cpp
@ -6,6 +6,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
enum ExitStatus {
|
enum ExitStatus {
|
||||||
BAD_ARGUMENT = 1,
|
BAD_ARGUMENT = 1,
|
||||||
@ -30,15 +31,6 @@ int main(int argc, char** argv) {
|
|||||||
jump_table << "#include \"macro.h\"" << std::endl;
|
jump_table << "#include \"macro.h\"" << std::endl;
|
||||||
jump_table << "#include <avr/io.h>" << std::endl;
|
jump_table << "#include <avr/io.h>" << std::endl;
|
||||||
|
|
||||||
for (int current_image = 0; current_image < images; ++current_image) {
|
|
||||||
jump_table << ".global line_jump_table_" << current_image << std::endl;
|
|
||||||
jump_table << "line_jump_table_" << current_image << ":" << std::endl;
|
|
||||||
for (int i = 0; i < 256; ++i) {
|
|
||||||
jump_table << '\t' << "jmp line_" << current_image << "_" << i << std::endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char** image = new char*[images];
|
char** image = new char*[images];
|
||||||
|
|
||||||
for (int current_image = 0; current_image < images; ++current_image) {
|
for (int current_image = 0; current_image < images; ++current_image) {
|
||||||
@ -87,7 +79,29 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
infile.close();
|
infile.close();
|
||||||
|
|
||||||
|
jump_table << ".global line_jump_table_" << current_image << std::endl;
|
||||||
|
jump_table << "line_jump_table_" << current_image << ":" << std::endl;
|
||||||
|
|
||||||
for (int y = 0; y < height; ++y) {
|
for (int y = 0; y < height; ++y) {
|
||||||
|
|
||||||
|
int diff = 1;
|
||||||
|
|
||||||
|
for (int other_image = 0; other_image <= current_image; ++other_image) {
|
||||||
|
for (int other_y = 0; other_y < height && other_y < y; ++other_y) {
|
||||||
|
diff = memcmp(&(image[current_image][y * width + 0]), &(image[other_image][other_y * width + 0]), width);
|
||||||
|
if (diff == 0) {
|
||||||
|
jump_table << '\t' << "jmp line_" << other_image << "_" << other_y << std::endl;
|
||||||
|
goto nested_loop_end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nested_loop_end:
|
||||||
|
|
||||||
|
if (diff == 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
jump_table << '\t' << "jmp line_" << current_image << "_" << y << std::endl;
|
||||||
asm_code << "line_" << current_image << "_" << y << ":" << std::endl;
|
asm_code << "line_" << current_image << "_" << y << ":" << std::endl;
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user