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

@@ -29,19 +29,13 @@ static unsigned int MemGetLe32(const uint8_t *mem) {
class IVFVideoSource : public CompressedVideoSource {
public:
explicit IVFVideoSource(const std::string &file_name)
: file_name_(file_name),
input_file_(NULL),
compressed_frame_buf_(NULL),
frame_sz_(0),
frame_(0),
end_of_file_(false) {
}
: file_name_(file_name), input_file_(NULL), compressed_frame_buf_(NULL),
frame_sz_(0), frame_(0), end_of_file_(false) {}
virtual ~IVFVideoSource() {
delete[] compressed_frame_buf_;
if (input_file_)
fclose(input_file_);
if (input_file_) fclose(input_file_);
}
virtual void Init() {
@@ -54,15 +48,16 @@ class IVFVideoSource : public CompressedVideoSource {
virtual void Begin() {
input_file_ = OpenTestDataFile(file_name_);
ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
<< file_name_;
<< file_name_;
// Read file header
uint8_t file_hdr[kIvfFileHdrSize];
ASSERT_EQ(kIvfFileHdrSize, fread(file_hdr, 1, kIvfFileHdrSize, input_file_))
<< "File header read failed.";
// Check file header
ASSERT_TRUE(file_hdr[0] == 'D' && file_hdr[1] == 'K' && file_hdr[2] == 'I'
&& file_hdr[3] == 'F') << "Input is not an IVF file.";
ASSERT_TRUE(file_hdr[0] == 'D' && file_hdr[1] == 'K' &&
file_hdr[2] == 'I' && file_hdr[3] == 'F')
<< "Input is not an IVF file.";
FillFrame();
}
@@ -76,8 +71,8 @@ class IVFVideoSource : public CompressedVideoSource {
ASSERT_TRUE(input_file_ != NULL);
uint8_t frame_hdr[kIvfFrameHdrSize];
// Check frame header and read a frame from input_file.
if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_)
!= kIvfFrameHdrSize) {
if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_) !=
kIvfFrameHdrSize) {
end_of_file_ = true;
} else {
end_of_file_ = false;