diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2013-02-01 08:22:59 +0100 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2013-02-01 08:22:59 +0100 |
commit | b5570c833d8b41100cbeca41bf3f08ce968f3441 (patch) | |
tree | 9be29b95f95c9ebb1a28e52e7cd5650a11619775 | |
parent | 77babe2d63b8f6cc49965b97b769479129b703f7 (diff) | |
download | advtime-b5570c833d8b41100cbeca41bf3f08ce968f3441.tar.gz advtime-b5570c833d8b41100cbeca41bf3f08ce968f3441.tar.bz2 advtime-b5570c833d8b41100cbeca41bf3f08ce968f3441.zip |
Also put frame_average into util
Not yet needed by other tools than cuttime,
but its really just a utility function.
-rw-r--r-- | src/cuttime.c | 19 | ||||
-rw-r--r-- | src/util.c | 20 | ||||
-rw-r--r-- | src/util.h | 3 |
3 files changed, 23 insertions, 19 deletions
diff --git a/src/cuttime.c b/src/cuttime.c index 422e4be..4b1a494 100644 --- a/src/cuttime.c +++ b/src/cuttime.c @@ -18,25 +18,6 @@ start_new_szene(int64_t prev_szene_end, int64_t start) prev_dts_start = start; } -static double -frame_average(struct video_frame *frame) -{ - double average = 0; - uint8_t *row = frame->data; - uint8_t *col = NULL; - - for (int y = 0; y < frame->height; ++y) { - col = row; - for (int x = 0; x < frame->width; ++x) { - average += *col; - col++; - } - row += frame->stride; - } - - return average / (frame->width * frame->height); -} - static void usage(void) { @@ -103,6 +103,26 @@ frame_diff(struct video_frame *frame_a, struct video_frame *frame_b) return average / (frame_a->width * frame_a->height); } +double +frame_average(struct video_frame *frame) +{ + double average = 0; + uint8_t *row = frame->data; + uint8_t *col = NULL; + + for (int y = 0; y < frame->height; ++y) { + col = row; + for (int x = 0; x < frame->width; ++x) { + average += *col; + col++; + } + row += frame->stride; + } + + return average / (frame->width * frame->height); +} + + /* print time in format: "hh:mm:ss.xxx" */ void print_time(int64_t msec) { @@ -26,6 +26,9 @@ frame_mix(struct video_frame *frame_a, struct video_frame *frame_b); double frame_diff(struct video_frame *frame_a, struct video_frame *frame_b); +double +frame_average(struct video_frame *frame); + void print_time(int64_t msec); |