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
c9426aaa
Commit
c9426aaa
authored
9 years ago
by
Marco Paniconi
Browse files
Options
Downloads
Patches
Plain Diff
Add unittest for SVC 1pass CBR mode with 4 threads.
Change-Id: I2b25d495d0dd3eedea31aa12cb908a90480f25de
parent
2808dd12
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/datarate_test.cc
+60
-1
60 additions, 1 deletion
test/datarate_test.cc
with
60 additions
and
1 deletion
test/datarate_test.cc
+
60
−
1
View file @
c9426aaa
...
...
@@ -761,6 +761,8 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
first_drop_
=
0
;
bits_total_
=
0
;
duration_
=
0.0
;
mismatch_psnr_
=
0.0
;
mismatch_nframes_
=
0
;
}
virtual
void
BeginPassHook
(
unsigned
int
/*pass*/
)
{
}
...
...
@@ -781,6 +783,7 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
encoder
->
Control
(
VP8E_SET_CPUUSED
,
speed_setting_
);
encoder
->
Control
(
VP9E_SET_TILE_COLUMNS
,
0
);
encoder
->
Control
(
VP8E_SET_MAX_INTRA_BITRATE_PCT
,
300
);
encoder
->
Control
(
VP9E_SET_TILE_COLUMNS
,
(
cfg_
.
g_threads
>>
1
));
}
const
vpx_rational_t
tb
=
video
->
timebase
();
timebase_
=
static_cast
<
double
>
(
tb
.
num
)
/
tb
.
den
;
...
...
@@ -816,6 +819,18 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
file_datarate_
=
file_size_in_kb
/
duration_
;
}
}
virtual
void
MismatchHook
(
const
vpx_image_t
*
img1
,
const
vpx_image_t
*
img2
)
{
double
mismatch_psnr
=
compute_psnr
(
img1
,
img2
);
mismatch_psnr_
+=
mismatch_psnr
;
++
mismatch_nframes_
;
}
unsigned
int
GetMismatchFrames
()
{
return
mismatch_nframes_
;
}
vpx_codec_pts_t
last_pts_
;
int64_t
bits_in_buffer_model_
;
double
timebase_
;
...
...
@@ -828,6 +843,8 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,
size_t
bits_in_last_frame_
;
vpx_svc_extra_cfg_t
svc_params_
;
int
speed_setting_
;
double
mismatch_psnr_
;
int
mismatch_nframes_
;
};
static
void
assign_layer_bitrates
(
vpx_codec_enc_cfg_t
*
const
enc_cfg
,
const
vpx_svc_extra_cfg_t
*
svc_params
,
...
...
@@ -867,7 +884,7 @@ static void assign_layer_bitrates(vpx_codec_enc_cfg_t *const enc_cfg,
}
// Check basic rate targeting for 1 pass CBR SVC: 2 spatial layers and
// 3 temporal layers.
// 3 temporal layers.
Run CIF clip with 1 thread.
TEST_P
(
DatarateOnePassCbrSvc
,
OnePassCbrSvc
)
{
cfg_
.
rc_buf_initial_sz
=
500
;
cfg_
.
rc_buf_optimal_sz
=
500
;
...
...
@@ -882,6 +899,7 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc) {
cfg_
.
ts_rate_decimator
[
1
]
=
2
;
cfg_
.
ts_rate_decimator
[
2
]
=
1
;
cfg_
.
g_error_resilient
=
1
;
cfg_
.
g_threads
=
1
;
cfg_
.
temporal_layering_mode
=
3
;
svc_params_
.
scaling_factor_num
[
0
]
=
144
;
svc_params_
.
scaling_factor_den
[
0
]
=
288
;
...
...
@@ -905,9 +923,50 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc) {
<<
" The datarate for the file exceeds the target by too much!"
;
ASSERT_LE
(
cfg_
.
rc_target_bitrate
,
file_datarate_
*
1.15
)
<<
" The datarate for the file is lower than the target by too much!"
;
EXPECT_EQ
(
GetMismatchFrames
(),
(
unsigned
int
)
0
);
}
}
// Check basic rate targeting for 1 pass CBR SVC: 2 spatial layers and
// 3 temporal layers. Run HD clip with 4 threads.
TEST_P
(
DatarateOnePassCbrSvc
,
OnePassCbrSvc4threads
)
{
cfg_
.
rc_buf_initial_sz
=
500
;
cfg_
.
rc_buf_optimal_sz
=
500
;
cfg_
.
rc_buf_sz
=
1000
;
cfg_
.
rc_min_quantizer
=
0
;
cfg_
.
rc_max_quantizer
=
63
;
cfg_
.
rc_end_usage
=
VPX_CBR
;
cfg_
.
g_lag_in_frames
=
0
;
cfg_
.
ss_number_layers
=
2
;
cfg_
.
ts_number_layers
=
3
;
cfg_
.
ts_rate_decimator
[
0
]
=
4
;
cfg_
.
ts_rate_decimator
[
1
]
=
2
;
cfg_
.
ts_rate_decimator
[
2
]
=
1
;
cfg_
.
g_error_resilient
=
1
;
cfg_
.
g_threads
=
4
;
cfg_
.
temporal_layering_mode
=
3
;
svc_params_
.
scaling_factor_num
[
0
]
=
144
;
svc_params_
.
scaling_factor_den
[
0
]
=
288
;
svc_params_
.
scaling_factor_num
[
1
]
=
288
;
svc_params_
.
scaling_factor_den
[
1
]
=
288
;
// TODO(wonkap/marpan): No frame drop for now, we need to implement correct
// frame dropping for SVC.
cfg_
.
rc_dropframe_thresh
=
0
;
::
libvpx_test
::
I420VideoSource
video
(
"niklas_1280_720_30.y4m"
,
1280
,
720
,
30
,
1
,
0
,
300
);
cfg_
.
rc_target_bitrate
=
800
;
ResetModel
();
assign_layer_bitrates
(
&
cfg_
,
&
svc_params_
,
cfg_
.
ss_number_layers
,
cfg_
.
ts_number_layers
,
cfg_
.
temporal_layering_mode
,
cfg_
.
rc_target_bitrate
);
ASSERT_NO_FATAL_FAILURE
(
RunLoop
(
&
video
));
ASSERT_GE
(
cfg_
.
rc_target_bitrate
,
effective_datarate_
*
0.85
)
<<
" The datarate for the file exceeds the target by too much!"
;
ASSERT_LE
(
cfg_
.
rc_target_bitrate
,
file_datarate_
*
1.15
)
<<
" The datarate for the file is lower than the target by too much!"
;
EXPECT_EQ
(
GetMismatchFrames
(),
(
unsigned
int
)
0
);
}
VP8_INSTANTIATE_TEST_CASE
(
DatarateTestLarge
,
ALL_TEST_MODES
);
VP9_INSTANTIATE_TEST_CASE
(
DatarateTestVP9Large
,
::
testing
::
Values
(
::
libvpx_test
::
kOnePassGood
,
...
...
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