summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/advtime.c6
-rw-r--r--src/util.c9
-rw-r--r--src/util.h5
3 files changed, 7 insertions, 13 deletions
diff --git a/src/advtime.c b/src/advtime.c
index 217b7ed..e4cd9a9 100644
--- a/src/advtime.c
+++ b/src/advtime.c
@@ -112,9 +112,9 @@ main(int argc, char **argv)
if (diff > 40.0) {
snprintf(filename, BUFSIZ, "img/%04i.pgm", i);
- frame_mix_pgm_save(frame_a, frame_b, filename);
-// pgm_save(frame_a->data, frame_a->stride, frame_a->width,
-// frame_a->height, filename);
+ frame_mix(frame_a, frame_b);
+ pgm_save(frame_a->data, frame_a->stride, frame_a->width,
+ frame_a->height, filename);
}
printf("\n");
diff --git a/src/util.c b/src/util.c
index 4e496a4..9ab6e25 100644
--- a/src/util.c
+++ b/src/util.c
@@ -17,8 +17,7 @@ pgm_save(unsigned char *buf, int wrap, int xsize, int ysize, char *filename)
}
void
-frame_mix_pgm_save(struct video_frame *frame_a, struct video_frame *frame_b,
- char *filename)
+frame_mix(struct video_frame *frame_a, struct video_frame *frame_b)
{
uint8_t *row_a = frame_a->data, *col_a = NULL;
uint8_t *row_b = frame_b->data, *col_b = NULL;
@@ -35,10 +34,4 @@ frame_mix_pgm_save(struct video_frame *frame_a, struct video_frame *frame_b,
row_a += frame_a->stride;
row_b += frame_b->stride;
}
-
- FILE *f = fopen(filename, "w");
- fprintf(f, "P5\n%d %d\n%d\n", frame_a->width, frame_a->height, 255);
- for (int i = 0; i < frame_a->height; i++)
- fwrite(frame_a->data+i*frame_a->stride, 1, frame_a->width, f);
- fclose(f);
}
diff --git a/src/util.h b/src/util.h
index e6f9bcf..8e0503a 100644
--- a/src/util.h
+++ b/src/util.h
@@ -3,8 +3,9 @@
void
pgm_save(unsigned char *buf, int wrap, int xsize, int ysize, char *filename);
+
+/* Store half of frame_a and half of frame_b in frame_a */
void
-frame_mix_pgm_save(struct video_frame *frame_a, struct video_frame *frame_b,
- char *filename);
+frame_mix(struct video_frame *frame_a, struct video_frame *frame_b);
#endif /* _UTIL_H_ */