This commit is contained in:
Mike Jerris
2016-09-26 14:31:51 -04:00
parent 2b1f0da5c4
commit 8c5f0301f3
1008 changed files with 110177 additions and 201326 deletions

View File

@@ -25,19 +25,11 @@ namespace libvpx_test {
class YUVVideoSource : public VideoSource {
public:
YUVVideoSource(const std::string &file_name, vpx_img_fmt format,
unsigned int width, unsigned int height,
int rate_numerator, int rate_denominator,
unsigned int start, int limit)
: file_name_(file_name),
input_file_(NULL),
img_(NULL),
start_(start),
limit_(limit),
frame_(0),
width_(0),
height_(0),
format_(VPX_IMG_FMT_NONE),
framerate_numerator_(rate_numerator),
unsigned int width, unsigned int height, int rate_numerator,
int rate_denominator, unsigned int start, int limit)
: file_name_(file_name), input_file_(NULL), img_(NULL), start_(start),
limit_(limit), frame_(0), width_(0), height_(0),
format_(VPX_IMG_FMT_NONE), framerate_numerator_(rate_numerator),
framerate_denominator_(rate_denominator) {
// This initializes format_, raw_size_, width_, height_ and allocates img.
SetSize(width, height, format);
@@ -45,18 +37,17 @@ class YUVVideoSource : public VideoSource {
virtual ~YUVVideoSource() {
vpx_img_free(img_);
if (input_file_)
fclose(input_file_);
if (input_file_) fclose(input_file_);
}
virtual void Begin() {
if (input_file_)
fclose(input_file_);
if (input_file_) fclose(input_file_);
input_file_ = OpenTestDataFile(file_name_);
ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
<< file_name_;
if (start_)
if (start_) {
fseek(input_file_, static_cast<unsigned>(raw_size_) * start_, SEEK_SET);
}
frame_ = start_;
FillFrame();
@@ -67,7 +58,7 @@ class YUVVideoSource : public VideoSource {
FillFrame();
}
virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }
virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }
// Models a stream where Timebase = 1/FPS, so pts == frame.
virtual vpx_codec_pts_t pts() const { return frame_; }
@@ -93,32 +84,15 @@ class YUVVideoSource : public VideoSource {
height_ = height;
format_ = format;
switch (format) {
case VPX_IMG_FMT_I420:
raw_size_ = width * height * 3 / 2;
break;
case VPX_IMG_FMT_I422:
raw_size_ = width * height * 2;
break;
case VPX_IMG_FMT_I440:
raw_size_ = width * height * 2;
break;
case VPX_IMG_FMT_I444:
raw_size_ = width * height * 3;
break;
case VPX_IMG_FMT_I42016:
raw_size_ = width * height * 3;
break;
case VPX_IMG_FMT_I42216:
raw_size_ = width * height * 4;
break;
case VPX_IMG_FMT_I44016:
raw_size_ = width * height * 4;
break;
case VPX_IMG_FMT_I44416:
raw_size_ = width * height * 6;
break;
default:
ASSERT_TRUE(0);
case VPX_IMG_FMT_I420: raw_size_ = width * height * 3 / 2; break;
case VPX_IMG_FMT_I422: raw_size_ = width * height * 2; break;
case VPX_IMG_FMT_I440: raw_size_ = width * height * 2; break;
case VPX_IMG_FMT_I444: raw_size_ = width * height * 3; break;
case VPX_IMG_FMT_I42016: raw_size_ = width * height * 3; break;
case VPX_IMG_FMT_I42216: raw_size_ = width * height * 4; break;
case VPX_IMG_FMT_I44016: raw_size_ = width * height * 4; break;
case VPX_IMG_FMT_I44416: raw_size_ = width * height * 6; break;
default: ASSERT_TRUE(0);
}
}
}