changeset 274:81641d82ccc6

fbdump2ppm: adjust for R2D's extra 32-bit word
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 20 Jan 2018 21:00:13 +0000
parents f233f0a012c9
children cbd944ebeff0
files miscprog/fbdump2ppm.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/miscprog/fbdump2ppm.c	Sat Jan 20 20:46:08 2018 +0000
+++ b/miscprog/fbdump2ppm.c	Sat Jan 20 21:00:13 2018 +0000
@@ -1,13 +1,18 @@
 /*
  * This program converts a dump of TI's R2D framebuffer (176x220 pix, 16-bit)
  * captured via fc-memdump into PPM format for viewing.
+ *
+ * TI's R2D code adds an extra 32-bit word to each horizontal line in its
+ * framebuffer representation, hence one needs to capture 0x131F0 bytes
+ * (178*2*220 instead of 176*2*220), and we treat the image as being
+ * 178x220 pixels for simplicity.
  */
 
 #include <sys/types.h>
 #include <stdio.h>
 #include <stdlib.h>
 
-#define	NPIX	(176*220)
+#define	NPIX	(178*220)
 
 FILE *inf, *outf;
 
@@ -53,7 +58,7 @@
 		perror(argv[2]);
 		exit(1);
 	}
-	fprintf(outf, "P6\n176 220\n255\n");
+	fprintf(outf, "P6\n178 220\n255\n");
 	for (n = 0; n < NPIX; n++)
 		convert_pixel();
 	exit(0);