Merge CV, ver=5.1; ops/methods from HV, and interface from CV where possible
[goodguy/history.git] / cinelerra-5.1 / mpeg2enc / create_mtable.c
diff --git a/cinelerra-5.1/mpeg2enc/create_mtable.c b/cinelerra-5.1/mpeg2enc/create_mtable.c
new file mode 100644 (file)
index 0000000..2553519
--- /dev/null
@@ -0,0 +1,31 @@
+#include <stdio.h>
+
+int main(char**, int)
+{
+  FILE *fout;
+  int i, j, v;
+
+  fout = fopen("mtable.h", "wt");
+  fprintf(fout, "const unsigned char motion_lookup[256][256] = {\n");
+  for (i = 0; i < 256; i++)
+  {
+    fprintf(fout, "{");
+    for (j = 0; j < 256; j++)
+    {
+      v = i - j;
+      if (v < 0)
+        v = -v;
+      fprintf(fout, "%3d", v);
+      if (j != 255)
+        fprintf(fout, ", ");
+      if ((j) && (j % 16 == 0))
+        fprintf(fout, "\n");
+    }
+    if (i != 255)
+      fprintf(fout, "},\n");
+  }
+  fprintf(fout, "}};\n");
+  fclose(fout);
+
+  return 0;
+}