summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cuttime.c19
-rw-r--r--src/util.c20
-rw-r--r--src/util.h3
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)
{
diff --git a/src/util.c b/src/util.c
index e642762..ddd46d3 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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) {
diff --git a/src/util.h b/src/util.h
index bc926b6..4666b06 100644
--- a/src/util.h
+++ b/src/util.h
@@ -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);