comparison miscprog/fbdump2ppm.c @ 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
comparison
equal deleted inserted replaced
273:f233f0a012c9 274:81641d82ccc6
1 /* 1 /*
2 * This program converts a dump of TI's R2D framebuffer (176x220 pix, 16-bit) 2 * This program converts a dump of TI's R2D framebuffer (176x220 pix, 16-bit)
3 * captured via fc-memdump into PPM format for viewing. 3 * captured via fc-memdump into PPM format for viewing.
4 *
5 * TI's R2D code adds an extra 32-bit word to each horizontal line in its
6 * framebuffer representation, hence one needs to capture 0x131F0 bytes
7 * (178*2*220 instead of 176*2*220), and we treat the image as being
8 * 178x220 pixels for simplicity.
4 */ 9 */
5 10
6 #include <sys/types.h> 11 #include <sys/types.h>
7 #include <stdio.h> 12 #include <stdio.h>
8 #include <stdlib.h> 13 #include <stdlib.h>
9 14
10 #define NPIX (176*220) 15 #define NPIX (178*220)
11 16
12 FILE *inf, *outf; 17 FILE *inf, *outf;
13 18
14 convert_pixel() 19 convert_pixel()
15 { 20 {
51 outf = fopen(argv[2], "w"); 56 outf = fopen(argv[2], "w");
52 if (!outf) { 57 if (!outf) {
53 perror(argv[2]); 58 perror(argv[2]);
54 exit(1); 59 exit(1);
55 } 60 }
56 fprintf(outf, "P6\n176 220\n255\n"); 61 fprintf(outf, "P6\n178 220\n255\n");
57 for (n = 0; n < NPIX; n++) 62 for (n = 0; n < NPIX; n++)
58 convert_pixel(); 63 convert_pixel();
59 exit(0); 64 exit(0);
60 } 65 }