Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
aom-rav1e
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiph.Org
aom-rav1e
Commits
6b747766
Commit
6b747766
authored
10 years ago
by
Minghai Shang
Browse files
Options
Downloads
Patches
Plain Diff
[spatial svc]Combine first and second pass test to keep stats data in memory.
Change-Id: Idccbfe35bebe6f05655bd54da7d8b616b1bffe03
parent
e0c65072
No related branches found
Branches containing commit
No related tags found
Loading
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
test/svc_test.cc
+26
-34
26 additions, 34 deletions
test/svc_test.cc
test/test-data.sha1
+0
-1
0 additions, 1 deletion
test/test-data.sha1
test/test.mk
+0
-1
0 additions, 1 deletion
test/test.mk
with
26 additions
and
36 deletions
test/svc_test.cc
+
26
−
34
View file @
6b747766
...
...
@@ -31,7 +31,6 @@ class SvcTest : public ::testing::Test {
SvcTest
()
:
codec_iface_
(
0
),
test_file_name_
(
"hantro_collage_w352h288.yuv"
),
stats_file_name_
(
"hantro_collage_w352h288.stat"
),
codec_initialized_
(
false
),
decoder_
(
0
)
{
memset
(
&
svc_
,
0
,
sizeof
(
svc_
));
...
...
@@ -74,7 +73,6 @@ class SvcTest : public ::testing::Test {
struct
vpx_codec_enc_cfg
codec_enc_
;
vpx_codec_iface_t
*
codec_iface_
;
std
::
string
test_file_name_
;
std
::
string
stats_file_name_
;
bool
codec_initialized_
;
Decoder
*
decoder_
;
};
...
...
@@ -364,7 +362,9 @@ TEST_F(SvcTest, GetLayerResolution) {
EXPECT_EQ
(
kHeight
*
8
/
16
,
layer_height
);
}
TEST_F
(
SvcTest
,
FirstPassEncode
)
{
TEST_F
(
SvcTest
,
TwoPassEncode
)
{
// First pass encode
std
::
string
stats_buf
;
svc_
.
spatial_layers
=
2
;
codec_enc_
.
g_pass
=
VPX_RC_FIRST_PASS
;
vpx_svc_set_scale_factors
(
&
svc_
,
"4/16,16/16"
);
...
...
@@ -383,50 +383,44 @@ TEST_F(SvcTest, FirstPassEncode) {
res
=
vpx_svc_encode
(
&
svc_
,
&
codec_
,
video
.
img
(),
video
.
pts
(),
video
.
duration
(),
VPX_DL_GOOD_QUALITY
);
ASSERT_EQ
(
VPX_CODEC_OK
,
res
);
EXPECT_GT
(
vpx_svc_get_rc_stats_buffer_size
(
&
svc_
),
0U
);
size_t
stats_size
=
vpx_svc_get_rc_stats_buffer_size
(
&
svc_
);
EXPECT_GT
(
stats_size
,
0U
);
const
char
*
stats_data
=
vpx_svc_get_rc_stats_buffer
(
&
svc_
);
ASSERT_TRUE
(
stats_data
!=
NULL
);
stats_buf
.
append
(
stats_data
,
stats_size
);
// FRAME 1
video
.
Next
();
res
=
vpx_svc_encode
(
&
svc_
,
&
codec_
,
video
.
img
(),
video
.
pts
(),
video
.
duration
(),
VPX_DL_GOOD_QUALITY
);
ASSERT_EQ
(
VPX_CODEC_OK
,
res
);
EXPECT_GT
(
vpx_svc_get_rc_stats_buffer_size
(
&
svc_
),
0U
);
stats_size
=
vpx_svc_get_rc_stats_buffer_size
(
&
svc_
);
EXPECT_GT
(
stats_size
,
0U
);
stats_data
=
vpx_svc_get_rc_stats_buffer
(
&
svc_
);
ASSERT_TRUE
(
stats_data
!=
NULL
);
stats_buf
.
append
(
stats_data
,
stats_size
);
// Flush encoder and test EOS packet
res
=
vpx_svc_encode
(
&
svc_
,
&
codec_
,
NULL
,
video
.
pts
(),
video
.
duration
(),
VPX_DL_GOOD_QUALITY
);
ASSERT_EQ
(
VPX_CODEC_OK
,
res
);
EXPECT_GT
(
vpx_svc_get_rc_stats_buffer_size
(
&
svc_
),
0U
);
}
TEST_F
(
SvcTest
,
SecondPassEncode
)
{
svc_
.
spatial_layers
=
2
;
codec_enc_
.
g_pass
=
VPX_RC_LAST_PASS
;
stats_size
=
vpx_svc_get_rc_stats_buffer_size
(
&
svc_
);
EXPECT_GT
(
stats_size
,
0U
);
stats_data
=
vpx_svc_get_rc_stats_buffer
(
&
svc_
);
ASSERT_TRUE
(
stats_data
!=
NULL
);
stats_buf
.
append
(
stats_data
,
stats_size
);
FILE
*
const
stats_file
=
libvpx_test
::
OpenTestDataFile
(
stats_file_name_
);
ASSERT_TRUE
(
stats_file
!=
NULL
)
<<
"Stats file open failed. Filename: "
<<
stats_file
;
// Tear down encoder
vpx_svc_release
(
&
svc_
);
vpx_codec_destroy
(
&
codec_
)
;
struct
vpx_fixed_buf
stats_buf
;
fseek
(
stats_file
,
0
,
SEEK_END
);
stats_buf
.
sz
=
static_cast
<
size_t
>
(
ftell
(
stats_file
));
fseek
(
stats_file
,
0
,
SEEK_SET
);
stats_buf
.
buf
=
malloc
(
stats_buf
.
sz
);
ASSERT_TRUE
(
stats_buf
.
buf
!=
NULL
);
const
size_t
bytes_read
=
fread
(
stats_buf
.
buf
,
1
,
stats_buf
.
sz
,
stats_file
);
ASSERT_EQ
(
bytes_read
,
stats_buf
.
sz
);
fclose
(
stats_file
);
codec_enc_
.
rc_twopass_stats_in
=
stats_buf
;
// Second pass encode
codec_enc_
.
g_pass
=
VPX_RC_LAST_PASS
;
codec_enc_
.
rc_twopass_stats_in
.
buf
=
&
stats_buf
[
0
];
codec_enc_
.
rc_twopass_stats_in
.
sz
=
stats_buf
.
size
();
vpx_codec_err_t
res
=
vpx_svc_init
(
&
svc_
,
&
codec_
,
vpx_codec_vp9_cx
(),
&
codec_enc_
);
res
=
vpx_svc_init
(
&
svc_
,
&
codec_
,
vpx_codec_vp9_cx
(),
&
codec_enc_
);
ASSERT_EQ
(
VPX_CODEC_OK
,
res
);
codec_initialized_
=
true
;
libvpx_test
::
I420VideoSource
video
(
test_file_name_
,
kWidth
,
kHeight
,
codec_enc_
.
g_timebase
.
den
,
codec_enc_
.
g_timebase
.
num
,
0
,
30
);
// FRAME 0
video
.
Begin
();
// This frame is a keyframe.
...
...
@@ -465,8 +459,6 @@ TEST_F(SvcTest, SecondPassEncode) {
static_cast
<
const
uint8_t
*>
(
vpx_svc_get_buffer
(
&
svc_
)),
vpx_svc_get_frame_size
(
&
svc_
));
ASSERT_EQ
(
VPX_CODEC_OK
,
res_dec
)
<<
decoder_
->
DecodeError
();
free
(
stats_buf
.
buf
);
}
}
// namespace
This diff is collapsed.
Click to expand it.
test/test-data.sha1
+
0
−
1
View file @
6b747766
d5dfb0151c9051f8c85999255645d7a23916d3c0 hantro_collage_w352h288.yuv
998cec53307c94aa5835aaf8d5731f6a3c7c2e5a hantro_collage_w352h288.stat
b87815bf86020c592ccc7a846ba2e28ec8043902 hantro_odd.yuv
b1f1c3ec79114b9a0651af24ce634afb44a9a419 rush_hour_444.y4m
5184c46ddca8b1fadd16742e8500115bc8f749da vp80-00-comprehensive-001.ivf
...
...
This diff is collapsed.
Click to expand it.
test/test.mk
+
0
−
1
View file @
6b747766
...
...
@@ -131,7 +131,6 @@ endif # CONFIG_SHARED
## TEST DATA
##
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS)
+=
hantro_collage_w352h288.yuv
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS)
+=
hantro_collage_w352h288.stat
LIBVPX_TEST_DATA-$(CONFIG_ENCODERS)
+=
hantro_odd.yuv
LIBVPX_TEST_DATA-$(CONFIG_VP9_ENCODER)
+=
rush_hour_444.y4m
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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