diff options
-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); |