From 8992cb1d0d07edc33d274f6d7924ecdf6f83d994 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Thu, 5 Sep 2013 17:57:22 +0100 Subject: making act segmenter --- ffmpeg-fas/test/seek_test.c | 162 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 ffmpeg-fas/test/seek_test.c (limited to 'ffmpeg-fas/test/seek_test.c') diff --git a/ffmpeg-fas/test/seek_test.c b/ffmpeg-fas/test/seek_test.c new file mode 100644 index 0000000..b145447 --- /dev/null +++ b/ffmpeg-fas/test/seek_test.c @@ -0,0 +1,162 @@ +/***************************************************************************** + * Copyright 2008. Pittsburgh Pattern Recognition, Inc. + * + * This file is part of the Frame Accurate Seeking extension library to + * ffmpeg (ffmpeg-fas). + * + * ffmpeg-fas is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at your + * option) any later version. + * + * The ffmpeg-fas library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the ffmpeg-fas library. If not, see . + * + ******************************************************************************/ + +#include "ffmpeg_fas.h" +#include "seek_indices.h" +#include "test_support.h" +#include + +#define TEST_SET_SIZE 1000 +#define N_ITERATIONS 500 + +int compare_frames(fas_raw_image_type img1, fas_raw_image_type img2) +{ + // printf("(%d %d) (%d %d) (%d %d) (%d %d)\n", img1.width, img2.width, + // img1.height, img2.height, + // img1.bytes_per_line, img2.bytes_per_line, + // img1.color_space, img2.color_space); + + if ((img1.width != img2.width) || + (img1.height != img2.height) || + (img1.bytes_per_line != img2.bytes_per_line) || + (img1.color_space != img2.color_space)) + return 0; + + int i,j; + int mask = 0; + + for (i=0;i%d)\n", prev_index, index); + + fail(buffer); + } + + fas_free_frame(test_frame); + } + + for (i=0;i\n", argv[0]); + fail("arguments\n"); + } + + fprintf(stderr, "%s : ", argv[1]); + + fas_initialize (FAS_FALSE, FAS_RGB24); + + video_error = fas_open_video (&context, argv[1]); + if (video_error != FAS_SUCCESS) fail("fail on open\n"); + + if (fas_get_frame_count(context) < 0) + fail("failed on counting frames (completing seek table... bad table?)\n"); + + if (fas_get_frame_count(context) < TEST_SET_SIZE) + do_random_test(context, 0, fas_get_frame_count(context) - 1, N_ITERATIONS); + else if (fas_get_frame_count(context) < TEST_SET_SIZE * 2) + { + do_random_test(context, 0, fas_get_frame_count(context) / 2 - 1, N_ITERATIONS / 2); + do_random_test(context, fas_get_frame_count(context) / 2 + 1, fas_get_frame_count(context) - 1 , N_ITERATIONS / 2); + } + else + { + do_random_test(context, 0, TEST_SET_SIZE, N_ITERATIONS / 2); + do_random_test(context, fas_get_frame_count(context) - TEST_SET_SIZE, fas_get_frame_count(context) - 1 , N_ITERATIONS / 2); + } + + fas_close_video(context); + + success(); +} + -- cgit v1.2.3