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
3cdcb2f5
Commit
3cdcb2f5
authored
11 years ago
by
Dmitry Kovalev
Browse files
Options
Download
Patches
Plain Diff
Simplifying target_size_from_buffer_level() function.
Change-Id: I1d556ddf04ab0a98eadf412972a6977c1055446f
parent
2b6e0fe0
v1.14.0-linphone
1.4.X
feature/update_to_v1.9.0-linphone
feature/uwp_nuget
frame_parallel
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
playground
sandbox/Jingning/experimental
sandbox/Jingning/transcode
sandbox/Jingning/vpx
sandbox/aconverse@google.com/ansbench
sandbox/hkuang/frame_parallel
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
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vp9/encoder/vp9_ratectrl.c
+18
-26
vp9/encoder/vp9_ratectrl.c
with
18 additions
and
26 deletions
vp9/encoder/vp9_ratectrl.c
+
18
−
26
View file @
3cdcb2f5
...
@@ -309,14 +309,14 @@ int vp9_drop_frame(VP9_COMP *const cpi) {
...
@@ -309,14 +309,14 @@ int vp9_drop_frame(VP9_COMP *const cpi) {
}
}
// Adjust active_worst_quality level based on buffer level.
// Adjust active_worst_quality level based on buffer level.
static
int
adjust_active_worst_quality_from_buffer_level
(
const
VP9_COMP
*
cpi
)
{
static
int
adjust_active_worst_quality_from_buffer_level
(
const
VP9_CONFIG
*
oxcf
,
const
RATE_CONTROL
*
rc
)
{
// Adjust active_worst_quality: If buffer is above the optimal/target level,
// Adjust active_worst_quality: If buffer is above the optimal/target level,
// bring active_worst_quality down depending on fullness over buffer.
// bring active_worst_quality down depending on fullness over buffer.
// If buffer is below the optimal level, let the active_worst_quality go from
// If buffer is below the optimal level, let the active_worst_quality go from
// ambient Q (at buffer = optimal level) to worst_quality level
// ambient Q (at buffer = optimal level) to worst_quality level
// (at buffer = critical level).
// (at buffer = critical level).
const
RATE_CONTROL
*
const
rc
=
&
cpi
->
rc
;
const
VP9_CONFIG
*
const
oxcf
=
&
cpi
->
oxcf
;
int
active_worst_quality
=
rc
->
active_worst_quality
;
int
active_worst_quality
=
rc
->
active_worst_quality
;
// Maximum limit for down adjustment, ~20%.
// Maximum limit for down adjustment, ~20%.
int
max_adjustment_down
=
active_worst_quality
/
5
;
int
max_adjustment_down
=
active_worst_quality
/
5
;
...
@@ -353,31 +353,23 @@ static int adjust_active_worst_quality_from_buffer_level(const VP9_COMP *cpi) {
...
@@ -353,31 +353,23 @@ static int adjust_active_worst_quality_from_buffer_level(const VP9_COMP *cpi) {
}
}
// Adjust target frame size with respect to the buffering constraints:
// Adjust target frame size with respect to the buffering constraints:
static
int
target_size_from_buffer_level
(
const
VP9_COMP
*
cpi
)
{
static
int
target_size_from_buffer_level
(
const
VP9_CONFIG
*
oxcf
,
const
RATE_CONTROL
*
const
rc
=
&
cpi
->
rc
;
const
RATE_CONTROL
*
rc
)
{
const
VP9_CONFIG
*
const
oxcf
=
&
cpi
->
oxcf
;
int
target
=
rc
->
this_frame_target
;
int
this_frame_target
=
cpi
->
rc
.
this_frame_target
;
const
int64_t
diff
=
oxcf
->
optimal_buffer_level
-
rc
->
buffer_level
;
int
percent_low
=
0
;
const
int
one_pct_bits
=
1
+
oxcf
->
optimal_buffer_level
/
100
;
int
percent_high
=
0
;
int
one_percent_bits
=
(
int
)(
1
+
oxcf
->
optimal_buffer_level
/
100
);
if
(
rc
->
buffer_level
<
oxcf
->
optimal_buffer_level
)
{
percent_low
=
(
int
)((
oxcf
->
optimal_buffer_level
-
rc
->
buffer_level
)
/
one_percent_bits
);
if
(
percent_low
>
oxcf
->
under_shoot_pct
)
percent_low
=
oxcf
->
under_shoot_pct
;
if
(
diff
>
0
)
{
// Lower the target bandwidth for this frame.
// Lower the target bandwidth for this frame.
this_frame_target
-=
(
this_frame_target
*
percent_low
)
/
200
;
const
int
pct_low
=
MIN
(
diff
/
one_pct_bits
,
oxcf
->
under_shoot_pct
);
}
else
if
(
rc
->
buffer_level
>
oxcf
->
optimal_buffer_level
)
{
target
-=
(
target
*
pct_low
)
/
200
;
percent_high
=
(
int
)((
rc
->
buffer_level
-
oxcf
->
optimal_buffer_level
)
/
}
else
if
(
diff
<
0
)
{
one_percent_bits
);
if
(
percent_high
>
oxcf
->
over_shoot_pct
)
percent_high
=
oxcf
->
over_shoot_pct
;
// Increase the target bandwidth for this frame.
// Increase the target bandwidth for this frame.
this_frame_target
+=
(
this_frame_target
*
percent_high
)
/
200
;
const
int
pct_high
=
MIN
(
-
diff
/
one_pct_bits
,
oxcf
->
over_shoot_pct
);
target
+=
(
target
*
pct_high
)
/
200
;
}
}
return
this_frame_target
;
return
target
;
}
}
static
void
calc_pframe_target_size
(
VP9_COMP
*
const
cpi
)
{
static
void
calc_pframe_target_size
(
VP9_COMP
*
const
cpi
)
{
...
@@ -399,10 +391,10 @@ static void calc_pframe_target_size(VP9_COMP *const cpi) {
...
@@ -399,10 +391,10 @@ static void calc_pframe_target_size(VP9_COMP *const cpi) {
// For now, use: cpi->rc.av_per_frame_bandwidth / 16:
// For now, use: cpi->rc.av_per_frame_bandwidth / 16:
min_frame_target
=
MAX
(
rc
->
av_per_frame_bandwidth
>>
4
,
min_frame_target
=
MAX
(
rc
->
av_per_frame_bandwidth
>>
4
,
FRAME_OVERHEAD_BITS
);
FRAME_OVERHEAD_BITS
);
rc
->
this_frame_target
=
target_size_from_buffer_level
(
cpi
);
rc
->
this_frame_target
=
target_size_from_buffer_level
(
oxcf
,
rc
);
// Adjust qp-max based on buffer level.
// Adjust qp-max based on buffer level.
rc
->
active_worst_quality
=
rc
->
active_worst_quality
=
adjust_active_worst_quality_from_buffer_level
(
cpi
);
adjust_active_worst_quality_from_buffer_level
(
oxcf
,
rc
);
}
}
}
}
...
...
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