Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
aom-rav1e
Commits
93169f8b
Commit
93169f8b
authored
Apr 11, 2014
by
Dmitry Kovalev
Browse files
vp9_rc_postencode_update() cleanup.
Change-Id: Idb1289aa0eadff8f75dcf995547ab3a1b9e27375
parent
dc89e9b0
Changes
1
Show whitespace changes
Inline
Side-by-side
vp9/encoder/vp9_ratectrl.c
View file @
93169f8b
...
...
@@ -1094,6 +1094,7 @@ void vp9_rc_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) {
const
VP9_COMMON
*
const
cm
=
&
cpi
->
common
;
const
VP9_CONFIG
*
const
oxcf
=
&
cpi
->
oxcf
;
RATE_CONTROL
*
const
rc
=
&
cpi
->
rc
;
const
int
qindex
=
cm
->
base_qindex
;
// Update rate control heuristics
rc
->
projected_frame_size
=
(
int
)(
bytes_used
<<
3
);
...
...
@@ -1105,25 +1106,24 @@ void vp9_rc_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) {
// Keep a record of last Q and ambient average Q.
if
(
cm
->
frame_type
==
KEY_FRAME
)
{
rc
->
last_q
[
KEY_FRAME
]
=
cm
->
base_
qindex
;
rc
->
avg_frame_qindex
[
KEY_FRAME
]
=
ROUND_POWER_OF_TWO
(
3
*
rc
->
avg_frame_qindex
[
KEY_FRAME
]
+
cm
->
base_
qindex
,
2
);
rc
->
last_q
[
KEY_FRAME
]
=
qindex
;
rc
->
avg_frame_qindex
[
KEY_FRAME
]
=
ROUND_POWER_OF_TWO
(
3
*
rc
->
avg_frame_qindex
[
KEY_FRAME
]
+
qindex
,
2
);
}
else
if
(
!
rc
->
is_src_frame_alt_ref
&&
(
cpi
->
refresh_golden_frame
||
cpi
->
refresh_alt_ref_frame
)
&&
!
(
cpi
->
use_svc
&&
oxcf
->
end_usage
==
USAGE_STREAM_FROM_SERVER
))
{
rc
->
last_q
[
2
]
=
cm
->
base_
qindex
;
rc
->
avg_frame_qindex
[
2
]
=
ROUND_POWER_OF_TWO
(
3
*
rc
->
avg_frame_qindex
[
2
]
+
cm
->
base_
qindex
,
2
);
rc
->
last_q
[
2
]
=
qindex
;
rc
->
avg_frame_qindex
[
2
]
=
ROUND_POWER_OF_TWO
(
3
*
rc
->
avg_frame_qindex
[
2
]
+
qindex
,
2
);
}
else
{
rc
->
last_q
[
INTER_FRAME
]
=
cm
->
base_
qindex
;
rc
->
avg_frame_qindex
[
INTER_FRAME
]
=
ROUND_POWER_OF_TWO
(
3
*
rc
->
avg_frame_qindex
[
INTER_FRAME
]
+
cm
->
base_
qindex
,
2
);
rc
->
last_q
[
INTER_FRAME
]
=
qindex
;
rc
->
avg_frame_qindex
[
INTER_FRAME
]
=
ROUND_POWER_OF_TWO
(
3
*
rc
->
avg_frame_qindex
[
INTER_FRAME
]
+
qindex
,
2
);
rc
->
ni_frames
++
;
rc
->
tot_q
+=
vp9_convert_qindex_to_q
(
cm
->
base_qindex
);
rc
->
avg_q
=
rc
->
tot_q
/
(
double
)
rc
->
ni_frames
;
rc
->
tot_q
+=
vp9_convert_qindex_to_q
(
qindex
);
rc
->
avg_q
=
rc
->
tot_q
/
rc
->
ni_frames
;
// Calculate the average Q for normal inter frames (not key or GFU frames).
rc
->
ni_tot_qi
+=
cm
->
base_
qindex
;
rc
->
ni_tot_qi
+=
qindex
;
rc
->
ni_av_qi
=
rc
->
ni_tot_qi
/
rc
->
ni_frames
;
}
...
...
@@ -1132,11 +1132,11 @@ void vp9_rc_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) {
// If all mbs in this group are skipped only update if the Q value is
// better than that already stored.
// This is used to help set quality in forced key frames to reduce popping
if
((
cm
->
base_
qindex
<
rc
->
last_boosted_qindex
)
||
if
((
qindex
<
rc
->
last_boosted_qindex
)
||
((
cpi
->
static_mb_pct
<
100
)
&&
((
cm
->
frame_type
==
KEY_FRAME
)
||
cpi
->
refresh_alt_ref_frame
||
(
cpi
->
refresh_golden_frame
&&
!
rc
->
is_src_frame_alt_ref
))))
{
rc
->
last_boosted_qindex
=
cm
->
base_
qindex
;
rc
->
last_boosted_qindex
=
qindex
;
}
update_buffer_level
(
cpi
,
rc
->
projected_frame_size
);
...
...
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