summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-15 10:18:09 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2012-11-15 10:21:09 +0100
commita2ed9d553a54f48f771a74280fb63f95a8b228ae (patch)
tree98c7baed5a1236b1208a223f36ec4c44209fcaee /src
parent7b53d084fcb90a3e0de053154bbdd2b10454a64f (diff)
downloadadvtime-a2ed9d553a54f48f771a74280fb63f95a8b228ae.tar.gz
advtime-a2ed9d553a54f48f771a74280fb63f95a8b228ae.tar.bz2
advtime-a2ed9d553a54f48f771a74280fb63f95a8b228ae.zip
util: Remove pgm output in frame_mix function
That should be up to the utility user, to use pgm_save afterwards.
Diffstat (limited to 'src')
-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_ */