aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--experiments/conv/.gitignore1
-rwxr-xr-xexperiments/conv/bin2h11
-rwxr-xr-xexperiments/conv/crop8
-rw-r--r--experiments/conv/makefile4
4 files changed, 24 insertions, 0 deletions
diff --git a/experiments/conv/.gitignore b/experiments/conv/.gitignore
index 3b4db56..791d796 100644
--- a/experiments/conv/.gitignore
+++ b/experiments/conv/.gitignore
@@ -2,3 +2,4 @@ venv
__pycache__
*.bin
*.png
+*.h
diff --git a/experiments/conv/bin2h b/experiments/conv/bin2h
new file mode 100755
index 0000000..9123848
--- /dev/null
+++ b/experiments/conv/bin2h
@@ -0,0 +1,11 @@
+#!/bin/sh
+input_file="$1"
+cat <<EOF
+#pragma once
+const unsigned int VSR_PC_MSG_DATA_LEN = $(wc -c < "$input_file");
+const unsigned char VSR_PC_MSG_DATA[] = {
+$(xxd -include < "$input_file")
+};
+
+EOF
+
diff --git a/experiments/conv/crop b/experiments/conv/crop
new file mode 100755
index 0000000..072bb75
--- /dev/null
+++ b/experiments/conv/crop
@@ -0,0 +1,8 @@
+#!/bin/sh
+input_file="$1"
+output_file="${input_file%.*}-crop.png"
+magick "$input_file" \
+ -resize 256x80^ \
+ -gravity center -extent 256x80 \
+ "$output_file"
+
diff --git a/experiments/conv/makefile b/experiments/conv/makefile
index f4f3cd5..ae2f70d 100644
--- a/experiments/conv/makefile
+++ b/experiments/conv/makefile
@@ -1,2 +1,6 @@
%.png: %.bin
./pc2png $<
+
+%.h: %.bin
+ ./bin2h $< > $@
+