Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
aom-rav1e
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
aom-rav1e
Commits
01236769
Commit
01236769
authored
Jan 11, 2014
by
James Zern
Committed by
Gerrit Code Review
Jan 11, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge "datarate_test: fix some type conversions"
parents
2c60f875
cac85f82
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
test/datarate_test.cc
test/datarate_test.cc
+15
-14
No files found.
test/datarate_test.cc
View file @
01236769
...
...
@@ -55,21 +55,22 @@ class DatarateTest : public ::libvpx_test::EncoderTest,
duration
=
1
;
// Add to the buffer the bits we'd expect from a constant bitrate server.
bits_in_buffer_model_
+=
duration
*
timebase_
*
cfg_
.
rc_target_bitrate
*
1000
;
bits_in_buffer_model_
+=
static_cast
<
int64_t
>
(
duration
*
timebase_
*
cfg_
.
rc_target_bitrate
*
1000
)
;
/* Test the buffer model here before subtracting the frame. Do so because
* the way the leaky bucket model works in libvpx is to allow the buffer to
* empty - and then stop showing frames until we've got enough bits to
* show one. As noted in comment below (issue 495), this does not currently
* apply to key frames. For now exclude key frames in condition below. */
bool
key_frame
=
(
pkt
->
data
.
frame
.
flags
&
VPX_FRAME_IS_KEY
)
?
true
:
false
;
const
bool
key_frame
=
(
pkt
->
data
.
frame
.
flags
&
VPX_FRAME_IS_KEY
)
?
true
:
false
;
if
(
!
key_frame
)
{
ASSERT_GE
(
bits_in_buffer_model_
,
0
)
<<
"Buffer Underrun at frame "
<<
pkt
->
data
.
frame
.
pts
;
}
const
in
t
frame_size_in_bits
=
pkt
->
data
.
frame
.
sz
*
8
;
const
size_
t
frame_size_in_bits
=
pkt
->
data
.
frame
.
sz
*
8
;
// Subtract from the buffer the bits associated with a played back frame.
bits_in_buffer_model_
-=
frame_size_in_bits
;
...
...
@@ -93,7 +94,7 @@ class DatarateTest : public ::libvpx_test::EncoderTest,
virtual
void
EndPassHook
(
void
)
{
if
(
bits_total_
)
{
const
double
file_size_in_kb
=
bits_total_
/
1000
;
/* bits per kilobit */
const
double
file_size_in_kb
=
bits_total_
/
1000
.
;
// bits per kilobit
duration_
=
(
last_pts_
+
1
)
*
timebase_
;
...
...
@@ -106,7 +107,7 @@ class DatarateTest : public ::libvpx_test::EncoderTest,
}
vpx_codec_pts_t
last_pts_
;
int
bits_in_buffer_model_
;
int
64_t
bits_in_buffer_model_
;
double
timebase_
;
int
frame_number_
;
vpx_codec_pts_t
first_drop_
;
...
...
@@ -114,7 +115,7 @@ class DatarateTest : public ::libvpx_test::EncoderTest,
double
duration_
;
double
file_datarate_
;
double
effective_datarate_
;
in
t
bits_in_last_frame_
;
size_
t
bits_in_last_frame_
;
};
TEST_P
(
DatarateTest
,
BasicBufferModel
)
{
...
...
@@ -216,14 +217,14 @@ class DatarateTestVP9 : public ::libvpx_test::EncoderTest,
vpx_codec_pts_t
duration
=
pkt
->
data
.
frame
.
pts
-
last_pts_
;
// Add to the buffer the bits we'd expect from a constant bitrate server.
bits_in_buffer_model_
+=
duration
*
timebase_
*
cfg_
.
rc_target_bitrate
*
1000
;
bits_in_buffer_model_
+=
static_cast
<
int64_t
>
(
duration
*
timebase_
*
cfg_
.
rc_target_bitrate
*
1000
)
;
// Buffer should not go negative.
ASSERT_GE
(
bits_in_buffer_model_
,
0
)
<<
"Buffer Underrun at frame "
<<
pkt
->
data
.
frame
.
pts
;
const
in
t
frame_size_in_bits
=
pkt
->
data
.
frame
.
sz
*
8
;
const
size_
t
frame_size_in_bits
=
pkt
->
data
.
frame
.
sz
*
8
;
bits_total_
+=
frame_size_in_bits
;
// If first drop not set and we have a drop set it to this time.
...
...
@@ -232,7 +233,7 @@ class DatarateTestVP9 : public ::libvpx_test::EncoderTest,
// Update the number of frame drops.
if
(
duration
>
1
)
{
num_drops_
+=
(
duration
-
1
);
num_drops_
+=
static_cast
<
int
>
(
duration
-
1
);
}
// Update the most recent pts.
...
...
@@ -255,8 +256,8 @@ class DatarateTestVP9 : public ::libvpx_test::EncoderTest,
double
duration_
;
double
effective_datarate_
;
int
set_cpu_used_
;
int
bits_in_buffer_model_
;
in
t
first_drop_
;
int
64_t
bits_in_buffer_model_
;
vpx_codec_pts_
t
first_drop_
;
int
num_drops_
;
};
...
...
@@ -305,7 +306,7 @@ TEST_P(DatarateTestVP9, ChangingDropFrameThresh) {
30
,
1
,
0
,
140
);
const
int
kDropFrameThreshTestStep
=
30
;
in
t
last_drop
=
140
;
vpx_codec_pts_
t
last_drop
=
140
;
int
last_num_drops
=
0
;
for
(
int
i
=
10
;
i
<
100
;
i
+=
kDropFrameThreshTestStep
)
{
cfg_
.
rc_dropframe_thresh
=
i
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment