Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
libvpx
Commits
94fbfb9f
Commit
94fbfb9f
authored
10 years ago
by
Deb Mukherjee
Committed by
Gerrit Code Review
10 years ago
Browse files
Options
Download
Plain Diff
Merge "Rework y4mwrite test to pass google3 tests"
parents
f55f68c1
a4635138
v1.14.0-linphone
1.4.X
feature/update_to_v1.9.0-linphone
feature/uwp_nuget
highbitdepth
indianrunnerduck
javanwhistlingduck
khakicampbell
linphone
linphone-android
linphone-old
longtailedduck
m49-2623
m52-2743
m54-2840
m56-2924
m66-3359
m68-3440
mandarinduck
nextgen
nextgenv2
sandbox/Jingning/experimental
sandbox/Jingning/vpx
sandbox/aconverse@google.com/ansbench
sandbox/hkuang@google.com/decode
sandbox/jimbankoski@google.com/proposed-aom
sandbox/jingning@google.com/decoder_test_suite
sandbox/jingning@google.com/experimental
sandbox/jzern@google.com/test
sandbox/wangch@google.com/vp9
sandbox/yaowu@google.com/mergeaom
v1.12.0-linphone
v1.6.1_linphone
v1.7.0-linphone
v1.9.0-linphone
v1.9.0
v1.9.0-rc1
v1.8.2
v1.8.1
v1.8.0
v1.7.0
v1.6.1
v1.6.0
v1.5.0
v1.4.0
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/video_source.h
+21
-38
test/video_source.h
test/y4m_test.cc
+9
-2
test/y4m_test.cc
with
30 additions
and
40 deletions
test/video_source.h
+
21
−
38
View file @
94fbfb9f
...
@@ -53,55 +53,33 @@ static FILE *OpenTestDataFile(const std::string& file_name) {
...
@@ -53,55 +53,33 @@ static FILE *OpenTestDataFile(const std::string& file_name) {
return
fopen
(
path_to_source
.
c_str
(),
"rb"
);
return
fopen
(
path_to_source
.
c_str
(),
"rb"
);
}
}
static
FILE
*
OpenTestOutFile
(
const
std
::
string
&
file_name
)
{
static
FILE
*
GetTempOutFile
(
std
::
string
*
file_name
)
{
const
std
::
string
path_to_source
=
GetDataPath
()
+
"/"
+
file_name
;
file_name
->
clear
();
return
fopen
(
path_to_source
.
c_str
(),
"wb"
);
}
static
std
::
string
GetTempOutFilename
()
{
std
::
string
basename
;
#if defined(_WIN32)
#if defined(_WIN32)
char
fname
[
MAX_PATH
];
char
fname
[
MAX_PATH
];
// Assume for now that the filename generated is unique per process
char
tmppath
[
MAX_PATH
];
const
UINT
ret
=
GetTempFileNameA
(
if
(
GetTempPathA
(
MAX_PATH
,
tmppath
))
{
GetDataPath
().
c_str
(),
"lvx"
,
0
,
fname
);
// Assume for now that the filename generated is unique per process
if
(
ret
!=
0
)
{
if
(
GetTempFileNameA
(
tmppath
,
"lvx"
,
0
,
fname
))
{
const
char
*
slash
=
strrchr
(
fname
,
'\\'
);
file_name
->
assign
(
fname
);
if
(
slash
==
NULL
)
slash
=
strrchr
(
fname
,
'/'
);
return
fopen
(
fname
,
"wb+"
);
if
(
slash
==
NULL
)
}
basename
.
assign
(
fname
);
else
basename
.
assign
(
slash
+
1
);
}
else
{
basename
.
clear
();
}
}
return
NULL
;
#else
#else
char
fname
[
256
];
return
tmpfile
();
const
std
::
string
templ
=
GetDataPath
()
+
"/libvpx_test_XXXXXX"
;
strncpy
(
fname
,
templ
.
c_str
(),
templ
.
size
());
fname
[
templ
.
size
()]
=
'\0'
;
const
int
fd
=
mkstemp
(
fname
);
if
(
fd
!=
-
1
)
{
close
(
fd
);
basename
.
assign
(
strrchr
(
fname
,
'/'
)
+
1
);
}
else
{
basename
.
clear
();
}
#endif
#endif
return
basename
;
}
}
class
TempOutFile
{
class
TempOutFile
{
public:
public:
TempOutFile
()
{
TempOutFile
()
{
file_name_
=
GetTempOutFilename
();
file_
=
GetTempOutFile
(
&
file_name_
);
file_
=
OpenTestOutFile
(
file_name_
);
}
}
~
TempOutFile
()
{
~
TempOutFile
()
{
CloseFile
();
CloseFile
();
if
(
!
file_name_
.
empty
())
{
if
(
!
file_name_
.
empty
())
{
const
std
::
string
path_to_source
=
GetDataPath
()
+
"/"
+
file_name_
;
EXPECT_EQ
(
0
,
remove
(
file_name_
.
c_str
()));
EXPECT_EQ
(
0
,
remove
(
path_to_source
.
c_str
()));
}
}
}
}
FILE
*
file
()
{
FILE
*
file
()
{
...
@@ -110,14 +88,19 @@ class TempOutFile {
...
@@ -110,14 +88,19 @@ class TempOutFile {
const
std
::
string
&
file_name
()
{
const
std
::
string
&
file_name
()
{
return
file_name_
;
return
file_name_
;
}
}
protected
:
void
CloseFile
()
{
void
CloseFile
()
{
if
(
file_
)
{
if
(
file_
)
{
fclose
(
file_
);
// Close if file pointer is associated with an open file
#if defined(_WIN32)
if
(
file_
->
_ptr
!=
NULL
)
fclose
(
file_
);
#else
if
(
fileno
(
file_
)
!=
-
1
)
fclose
(
file_
);
#endif
file_
=
NULL
;
file_
=
NULL
;
}
}
}
}
protected
:
FILE
*
file_
;
FILE
*
file_
;
std
::
string
file_name_
;
std
::
string
file_name_
;
};
};
...
...
This diff is collapsed.
Click to expand it.
test/y4m_test.cc
+
9
−
2
View file @
94fbfb9f
...
@@ -145,6 +145,14 @@ class Y4mVideoWriteTest
...
@@ -145,6 +145,14 @@ class Y4mVideoWriteTest
delete
tmpfile_
;
delete
tmpfile_
;
}
}
virtual
void
ReplaceInputFile
(
FILE
*
input_file
)
{
CloseSource
();
frame_
=
0
;
input_file_
=
input_file
;
rewind
(
input_file_
);
ReadSourceToStart
();
}
// Writes out a y4m file and then reads it back
// Writes out a y4m file and then reads it back
void
WriteY4mAndReadBack
()
{
void
WriteY4mAndReadBack
()
{
ASSERT_TRUE
(
input_file_
!=
NULL
);
ASSERT_TRUE
(
input_file_
!=
NULL
);
...
@@ -163,8 +171,7 @@ class Y4mVideoWriteTest
...
@@ -163,8 +171,7 @@ class Y4mVideoWriteTest
write_image_file
(
img
(),
tmpfile_
->
file
());
write_image_file
(
img
(),
tmpfile_
->
file
());
Next
();
Next
();
}
}
tmpfile_
->
CloseFile
();
ReplaceInputFile
(
tmpfile_
->
file
());
Y4mVideoSourceTest
::
Init
(
tmpfile_
->
file_name
(),
limit_
);
}
}
virtual
void
Init
(
const
std
::
string
&
file_name
,
int
limit
)
{
virtual
void
Init
(
const
std
::
string
&
file_name
,
int
limit
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets