/*****************************************************************************
* 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();
}