summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2014-04-15 23:00:16 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2014-04-15 23:00:16 -0700
commit92ebef119ac27babc547e9b86470b435d96b1e94 (patch)
tree25556150f5b29a87b428db5c6a808e0075a7b695
parent617a367c54826718ed055cdc3f789660c08b55f9 (diff)
parent4e9529cb24fb8fc4edabb32868afcb288feb1f59 (diff)
downloadlibvpx-92ebef119ac27babc547e9b86470b435d96b1e94.tar
libvpx-92ebef119ac27babc547e9b86470b435d96b1e94.tar.gz
libvpx-92ebef119ac27babc547e9b86470b435d96b1e94.tar.bz2
libvpx-92ebef119ac27babc547e9b86470b435d96b1e94.zip
Merge "Renaming av_per_frame_bandwidth to avg_frame_bandwidth."
-rw-r--r--vp9/encoder/vp9_aq_cyclicrefresh.c4
-rw-r--r--vp9/encoder/vp9_firstpass.c2
-rw-r--r--vp9/encoder/vp9_ratectrl.c43
-rw-r--r--vp9/encoder/vp9_ratectrl.h6
-rw-r--r--vp9/encoder/vp9_svc_layercontext.c12
5 files changed, 33 insertions, 34 deletions
diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.c b/vp9/encoder/vp9_aq_cyclicrefresh.c
index e55881ffc..323c10350 100644
--- a/vp9/encoder/vp9_aq_cyclicrefresh.c
+++ b/vp9/encoder/vp9_aq_cyclicrefresh.c
@@ -72,7 +72,7 @@ static int apply_cyclic_refresh_bitrate(const VP9_COMMON *cm,
// Turn off cyclic refresh if bits available per frame is not sufficiently
// larger than bit cost of segmentation. Segment map bit cost should scale
// with number of seg blocks, so compare available bits to number of blocks.
- // Average bits available per frame = av_per_frame_bandwidth
+ // Average bits available per frame = avg_frame_bandwidth
// Number of (8x8) blocks in frame = mi_rows * mi_cols;
const float factor = 0.5;
const int number_blocks = cm->mi_rows * cm->mi_cols;
@@ -80,7 +80,7 @@ static int apply_cyclic_refresh_bitrate(const VP9_COMMON *cm,
// ~24kbps for CIF, 72kbps for VGA (at 30fps).
// Also turn off at very small frame sizes, to avoid too large fraction of
// superblocks to be refreshed per frame. Threshold below is less than QCIF.
- if (rc->av_per_frame_bandwidth < factor * number_blocks ||
+ if (rc->avg_frame_bandwidth < factor * number_blocks ||
number_blocks / 64 < 5)
return 0;
else
diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c
index fc0a4e492..37f9cc679 100644
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -337,7 +337,7 @@ static double simple_weight(const YV12_BUFFER_CONFIG *buf) {
// This function returns the maximum target rate per frame.
static int frame_max_bits(const RATE_CONTROL *rc, const VP9_CONFIG *oxcf) {
- int64_t max_bits = ((int64_t)rc->av_per_frame_bandwidth *
+ int64_t max_bits = ((int64_t)rc->avg_frame_bandwidth *
(int64_t)oxcf->two_pass_vbrmax_section) / 100;
if (max_bits < 0)
max_bits = 0;
diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c
index f2afc4645..aa8c4b18f 100644
--- a/vp9/encoder/vp9_ratectrl.c
+++ b/vp9/encoder/vp9_ratectrl.c
@@ -116,7 +116,7 @@ static int estimate_bits_at_q(FRAME_TYPE frame_type, int q, int mbs,
int vp9_rc_clamp_pframe_target_size(const VP9_COMP *const cpi, int target) {
const RATE_CONTROL *rc = &cpi->rc;
const int min_frame_target = MAX(rc->min_frame_bandwidth,
- rc->av_per_frame_bandwidth >> 5);
+ rc->avg_frame_bandwidth >> 5);
if (target < min_frame_target)
target = min_frame_target;
if (cpi->refresh_golden_frame && rc->is_src_frame_alt_ref) {
@@ -136,8 +136,8 @@ int vp9_rc_clamp_iframe_target_size(const VP9_COMP *const cpi, int target) {
const RATE_CONTROL *rc = &cpi->rc;
const VP9_CONFIG *oxcf = &cpi->oxcf;
if (oxcf->rc_max_intra_bitrate_pct) {
- const int max_rate = rc->av_per_frame_bandwidth *
- oxcf->rc_max_intra_bitrate_pct / 100;
+ const int max_rate = rc->avg_frame_bandwidth *
+ oxcf->rc_max_intra_bitrate_pct / 100;
target = MIN(target, max_rate);
}
if (target > rc->max_frame_bandwidth)
@@ -174,7 +174,7 @@ static void update_buffer_level(VP9_COMP *cpi, int encoded_frame_size) {
if (!cm->show_frame) {
rc->bits_off_target -= encoded_frame_size;
} else {
- rc->bits_off_target += rc->av_per_frame_bandwidth - encoded_frame_size;
+ rc->bits_off_target += rc->avg_frame_bandwidth - encoded_frame_size;
}
// Clip the buffer level to the maximum specified buffer size.
@@ -207,10 +207,10 @@ void vp9_rc_init(const VP9_CONFIG *oxcf, int pass, RATE_CONTROL *rc) {
rc->buffer_level = oxcf->starting_buffer_level;
rc->bits_off_target = oxcf->starting_buffer_level;
- rc->rolling_target_bits = rc->av_per_frame_bandwidth;
- rc->rolling_actual_bits = rc->av_per_frame_bandwidth;
- rc->long_rolling_target_bits = rc->av_per_frame_bandwidth;
- rc->long_rolling_actual_bits = rc->av_per_frame_bandwidth;
+ rc->rolling_target_bits = rc->avg_frame_bandwidth;
+ rc->rolling_actual_bits = rc->avg_frame_bandwidth;
+ rc->long_rolling_target_bits = rc->avg_frame_bandwidth;
+ rc->long_rolling_actual_bits = rc->avg_frame_bandwidth;
rc->total_actual_bits = 0;
rc->total_target_vs_actual = 0;
@@ -1149,7 +1149,7 @@ void vp9_rc_postencode_update(VP9_COMP *cpi, uint64_t bytes_used) {
// Actual bits spent
rc->total_actual_bits += rc->projected_frame_size;
- rc->total_target_bits += (cm->show_frame ? rc->av_per_frame_bandwidth : 0);
+ rc->total_target_bits += cm->show_frame ? rc->avg_frame_bandwidth : 0;
rc->total_target_vs_actual = rc->total_actual_bits - rc->total_target_bits;
@@ -1191,12 +1191,12 @@ static int calc_pframe_target_size_one_pass_vbr(const VP9_COMP *const cpi) {
#if USE_ALTREF_FOR_ONE_PASS
target = (!rc->is_src_frame_alt_ref &&
(cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) ?
- (rc->av_per_frame_bandwidth * rc->baseline_gf_interval * af_ratio) /
+ (rc->avg_frame_bandwidth * rc->baseline_gf_interval * af_ratio) /
(rc->baseline_gf_interval + af_ratio - 1) :
- (rc->av_per_frame_bandwidth * rc->baseline_gf_interval) /
+ (rc->avg_frame_bandwidth * rc->baseline_gf_interval) /
(rc->baseline_gf_interval + af_ratio - 1);
#else
- target = rc->av_per_frame_bandwidth;
+ target = rc->avg_frame_bandwidth;
#endif
return vp9_rc_clamp_pframe_target_size(cpi, target);
}
@@ -1204,7 +1204,7 @@ static int calc_pframe_target_size_one_pass_vbr(const VP9_COMP *const cpi) {
static int calc_iframe_target_size_one_pass_vbr(const VP9_COMP *const cpi) {
static const int kf_ratio = 25;
const RATE_CONTROL *rc = &cpi->rc;
- int target = rc->av_per_frame_bandwidth * kf_ratio;
+ const int target = rc->avg_frame_bandwidth * kf_ratio;
return vp9_rc_clamp_iframe_target_size(cpi, target);
}
@@ -1249,12 +1249,11 @@ static int calc_pframe_target_size_one_pass_cbr(const VP9_COMP *cpi) {
const SVC *const svc = &cpi->svc;
const int64_t diff = oxcf->optimal_buffer_level - rc->buffer_level;
const int64_t one_pct_bits = 1 + oxcf->optimal_buffer_level / 100;
- int min_frame_target = MAX(rc->av_per_frame_bandwidth >> 4,
- FRAME_OVERHEAD_BITS);
- int target = rc->av_per_frame_bandwidth;
+ int min_frame_target = MAX(rc->avg_frame_bandwidth >> 4, FRAME_OVERHEAD_BITS);
+ int target = rc->avg_frame_bandwidth;
if (svc->number_temporal_layers > 1 &&
oxcf->end_usage == USAGE_STREAM_FROM_SERVER) {
- // Note that for layers, av_per_frame_bandwidth is the cumulative
+ // Note that for layers, avg_frame_bandwidth is the cumulative
// per-frame-bandwidth. For the target size of this frame, use the
// layer average frame size (i.e., non-cumulative per-frame-bw).
int current_temporal_layer = svc->temporal_layer_id;
@@ -1296,7 +1295,7 @@ static int calc_iframe_target_size_one_pass_cbr(const VP9_COMP *cpi) {
kf_boost = (int)(kf_boost * rc->frames_since_key /
(framerate / 2));
}
- target = ((16 + kf_boost) * rc->av_per_frame_bandwidth) >> 4;
+ target = ((16 + kf_boost) * rc->avg_frame_bandwidth) >> 4;
}
return vp9_rc_clamp_iframe_target_size(cpi, target);
}
@@ -1304,7 +1303,7 @@ static int calc_iframe_target_size_one_pass_cbr(const VP9_COMP *cpi) {
void vp9_rc_get_svc_params(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
RATE_CONTROL *const rc = &cpi->rc;
- int target = rc->av_per_frame_bandwidth;
+ int target = rc->avg_frame_bandwidth;
if ((cm->current_video_frame == 0) ||
(cpi->frame_flags & FRAMEFLAGS_KEY) ||
(cpi->oxcf.auto_key && (rc->frames_since_key %
@@ -1399,8 +1398,8 @@ void vp9_rc_update_framerate(VP9_COMP *cpi) {
RATE_CONTROL *const rc = &cpi->rc;
int vbr_max_bits;
- rc->av_per_frame_bandwidth = (int)(oxcf->target_bandwidth / oxcf->framerate);
- rc->min_frame_bandwidth = (int)(rc->av_per_frame_bandwidth *
+ rc->avg_frame_bandwidth = (int)(oxcf->target_bandwidth / oxcf->framerate);
+ rc->min_frame_bandwidth = (int)(rc->avg_frame_bandwidth *
oxcf->two_pass_vbrmin_section / 100);
rc->min_frame_bandwidth = MAX(rc->min_frame_bandwidth, FRAME_OVERHEAD_BITS);
@@ -1412,7 +1411,7 @@ void vp9_rc_update_framerate(VP9_COMP *cpi) {
// a very high rate is given on the command line or the the rate cannnot
// be acheived because of a user specificed max q (e.g. when the user
// specifies lossless encode.
- vbr_max_bits = (int)(((int64_t)rc->av_per_frame_bandwidth *
+ vbr_max_bits = (int)(((int64_t)rc->avg_frame_bandwidth *
oxcf->two_pass_vbrmax_section) / 100);
rc->max_frame_bandwidth = MAX(MAX((cm->MBs * MAX_MB_RATE), MAXRATE_1080P),
vbr_max_bits);
diff --git a/vp9/encoder/vp9_ratectrl.h b/vp9/encoder/vp9_ratectrl.h
index cf6526b8b..036470001 100644
--- a/vp9/encoder/vp9_ratectrl.h
+++ b/vp9/encoder/vp9_ratectrl.h
@@ -54,9 +54,9 @@ typedef struct {
int source_alt_ref_active;
int is_src_frame_alt_ref;
- int av_per_frame_bandwidth; // Average frame size target for clip
- int min_frame_bandwidth; // Minimum allocation used for any frame
- int max_frame_bandwidth; // Maximum burst rate allowed for a frame.
+ int avg_frame_bandwidth; // Average frame size target for clip
+ int min_frame_bandwidth; // Minimum allocation used for any frame
+ int max_frame_bandwidth; // Maximum burst rate allowed for a frame.
int ni_av_qi;
int ni_tot_qi;
diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c
index 9b3fc6eab..3c4e3e064 100644
--- a/vp9/encoder/vp9_svc_layercontext.c
+++ b/vp9/encoder/vp9_svc_layercontext.c
@@ -102,7 +102,7 @@ void vp9_update_layer_context_change_config(VP9_COMP *const cpi,
} else {
lc->framerate = oxcf->framerate;
}
- lrc->av_per_frame_bandwidth = (int)(lc->target_bandwidth / lc->framerate);
+ lrc->avg_frame_bandwidth = (int)(lc->target_bandwidth / lc->framerate);
lrc->max_frame_bandwidth = rc->max_frame_bandwidth;
// Update qp-related quantities.
lrc->worst_quality = rc->worst_quality;
@@ -124,11 +124,11 @@ void vp9_update_temporal_layer_framerate(VP9_COMP *const cpi) {
const int layer = svc->temporal_layer_id;
lc->framerate = oxcf->framerate / oxcf->ts_rate_decimator[layer];
- lrc->av_per_frame_bandwidth = (int)(lc->target_bandwidth / lc->framerate);
+ lrc->avg_frame_bandwidth = (int)(lc->target_bandwidth / lc->framerate);
lrc->max_frame_bandwidth = cpi->rc.max_frame_bandwidth;
// Update the average layer frame size (non-cumulative per-frame-bw).
if (layer == 0) {
- lc->avg_frame_size = lrc->av_per_frame_bandwidth;
+ lc->avg_frame_size = lrc->avg_frame_bandwidth;
} else {
const double prev_layer_framerate =
oxcf->framerate / oxcf->ts_rate_decimator[layer - 1];
@@ -146,10 +146,10 @@ void vp9_update_spatial_layer_framerate(VP9_COMP *const cpi, double framerate) {
RATE_CONTROL *const lrc = &lc->rc;
lc->framerate = framerate;
- lrc->av_per_frame_bandwidth = (int)(lc->target_bandwidth / lc->framerate);
- lrc->min_frame_bandwidth = (int)(lrc->av_per_frame_bandwidth *
+ lrc->avg_frame_bandwidth = (int)(lc->target_bandwidth / lc->framerate);
+ lrc->min_frame_bandwidth = (int)(lrc->avg_frame_bandwidth *
oxcf->two_pass_vbrmin_section / 100);
- lrc->max_frame_bandwidth = (int)(((int64_t)lrc->av_per_frame_bandwidth *
+ lrc->max_frame_bandwidth = (int)(((int64_t)lrc->avg_frame_bandwidth *
oxcf->two_pass_vbrmax_section) / 100);
lrc->max_gf_interval = 16;