Adds support for reading and writing 10/12-bit y4m

The y4m extension used is the same as the one used in ffmpeg/x264.
The patch is adapted from the highbitdepth branch.

Also adds unit tests for y4m header parsing and md5 check
of the raw frame data, as well as y4m writing.

[build fix for Mac/VS by not using tuples with strings]

Change-Id: I40897ee37d289e4b6cea6fedc67047d692b8cb46
This commit is contained in:
Deb Mukherjee
2014-06-12 16:53:13 -07:00
parent 3643544fe0
commit 5820c5d614
17 changed files with 435 additions and 37 deletions

View File

@@ -38,24 +38,30 @@ class Y4mVideoSource : public VideoSource {
CloseSource();
}
virtual void Begin() {
virtual void OpenSource() {
CloseSource();
input_file_ = OpenTestDataFile(file_name_);
ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
<< file_name_;
<< file_name_;
}
y4m_input_open(&y4m_, input_file_, NULL, 0, 0);
virtual void ReadSourceToStart() {
ASSERT_TRUE(input_file_ != NULL);
ASSERT_FALSE(y4m_input_open(&y4m_, input_file_, NULL, 0, 0));
framerate_numerator_ = y4m_.fps_n;
framerate_denominator_ = y4m_.fps_d;
frame_ = 0;
for (unsigned int i = 0; i < start_; i++) {
Next();
Next();
}
FillFrame();
}
virtual void Begin() {
OpenSource();
ReadSourceToStart();
}
virtual void Next() {
++frame_;
FillFrame();