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
ed364b21
Commit
ed364b21
authored
Jan 10, 2014
by
Dmitry Kovalev
Committed by
Gerrit Code Review
Jan 10, 2014
Browse files
Options
Browse Files
Download
Plain Diff
Merge "Adding {get, set}_rate_correction_factor() functions."
parents
a260369a
c01fe86c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
33 deletions
+26
-33
vp9/encoder/vp9_ratectrl.c
vp9/encoder/vp9_ratectrl.c
+26
-33
No files found.
vp9/encoder/vp9_ratectrl.c
View file @
ed364b21
...
...
@@ -430,10 +430,32 @@ static void calc_pframe_target_size(VP9_COMP *const cpi) {
}
}
static
double
get_rate_correction_factor
(
const
VP9_COMP
*
cpi
)
{
if
(
cpi
->
common
.
frame_type
==
KEY_FRAME
)
{
return
cpi
->
rc
.
key_frame_rate_correction_factor
;
}
else
{
if
(
cpi
->
refresh_alt_ref_frame
||
cpi
->
refresh_golden_frame
)
return
cpi
->
rc
.
gf_rate_correction_factor
;
else
return
cpi
->
rc
.
rate_correction_factor
;
}
}
static
void
set_rate_correction_factor
(
VP9_COMP
*
cpi
,
double
factor
)
{
if
(
cpi
->
common
.
frame_type
==
KEY_FRAME
)
{
cpi
->
rc
.
key_frame_rate_correction_factor
=
factor
;
}
else
{
if
(
cpi
->
refresh_alt_ref_frame
||
cpi
->
refresh_golden_frame
)
cpi
->
rc
.
gf_rate_correction_factor
=
factor
;
else
cpi
->
rc
.
rate_correction_factor
=
factor
;
}
}
void
vp9_rc_update_rate_correction_factors
(
VP9_COMP
*
cpi
,
int
damp_var
)
{
const
int
q
=
cpi
->
common
.
base_qindex
;
int
correction_factor
=
100
;
double
rate_correction_factor
;
double
rate_correction_factor
=
get_rate_correction_factor
(
cpi
)
;
double
adjustment_limit
;
int
projected_size_based_on_q
=
0
;
...
...
@@ -441,15 +463,6 @@ void vp9_rc_update_rate_correction_factors(VP9_COMP *cpi, int damp_var) {
// Clear down mmx registers to allow floating point in what follows
vp9_clear_system_state
();
// __asm emms;
if
(
cpi
->
common
.
frame_type
==
KEY_FRAME
)
{
rate_correction_factor
=
cpi
->
rc
.
key_frame_rate_correction_factor
;
}
else
{
if
(
cpi
->
refresh_alt_ref_frame
||
cpi
->
refresh_golden_frame
)
rate_correction_factor
=
cpi
->
rc
.
gf_rate_correction_factor
;
else
rate_correction_factor
=
cpi
->
rc
.
rate_correction_factor
;
}
// Work out how big we would have expected the frame to be at this Q given
// the current correction factor.
// Stay in double to avoid int overflow when values are large
...
...
@@ -499,36 +512,16 @@ void vp9_rc_update_rate_correction_factors(VP9_COMP *cpi, int damp_var) {
rate_correction_factor
=
MIN_BPB_FACTOR
;
}
if
(
cpi
->
common
.
frame_type
==
KEY_FRAME
)
{
cpi
->
rc
.
key_frame_rate_correction_factor
=
rate_correction_factor
;
}
else
{
if
(
cpi
->
refresh_alt_ref_frame
||
cpi
->
refresh_golden_frame
)
cpi
->
rc
.
gf_rate_correction_factor
=
rate_correction_factor
;
else
cpi
->
rc
.
rate_correction_factor
=
rate_correction_factor
;
}
set_rate_correction_factor
(
cpi
,
rate_correction_factor
);
}
int
vp9_rc_regulate_q
(
const
VP9_COMP
*
cpi
,
int
target_bits_per_frame
,
int
active_best_quality
,
int
active_worst_quality
)
{
int
q
=
active_worst_quality
;
int
i
;
int
last_error
=
INT_MAX
;
int
target_bits_per_mb
;
int
bits_per_mb_at_this_q
;
double
correction_factor
;
// Select the appropriate correction factor based upon type of frame.
if
(
cpi
->
common
.
frame_type
==
KEY_FRAME
)
{
correction_factor
=
cpi
->
rc
.
key_frame_rate_correction_factor
;
}
else
{
if
(
cpi
->
refresh_alt_ref_frame
||
cpi
->
refresh_golden_frame
)
correction_factor
=
cpi
->
rc
.
gf_rate_correction_factor
;
else
correction_factor
=
cpi
->
rc
.
rate_correction_factor
;
}
int
i
,
target_bits_per_mb
,
bits_per_mb_at_this_q
;
const
double
correction_factor
=
get_rate_correction_factor
(
cpi
);
// Calculate required scaling factor based on target frame size and size of
// frame produced using previous Q.
...
...
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