Commit 1acc96fb authored by Dmitry Kovalev's avatar Dmitry Kovalev

Removing vp9_rescale().

Now everything is int64_t, so we don't need that function.

Change-Id: I7dd2023677b4943ecd968d68cc06f9d4862c3c3f
parent dc35b40a
......@@ -489,14 +489,6 @@ void vp9_new_framerate(VP9_COMP *cpi, double framerate) {
vp9_rc_update_framerate(cpi);
}
int64_t vp9_rescale(int64_t val, int64_t num, int denom) {
int64_t llnum = num;
int64_t llden = denom;
int64_t llval = val;
return (llval * llnum / llden);
}
static void set_tile_limits(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
......@@ -591,21 +583,21 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
cpi->oxcf.maximum_buffer_size_ms = 240000;
}
rc->starting_buffer_level = vp9_rescale(cpi->oxcf.starting_buffer_level_ms,
cpi->oxcf.target_bandwidth, 1000);
rc->starting_buffer_level = cpi->oxcf.starting_buffer_level_ms *
cpi->oxcf.target_bandwidth / 1000;
// Set or reset optimal and maximum buffer levels.
if (cpi->oxcf.optimal_buffer_level_ms == 0)
rc->optimal_buffer_level = cpi->oxcf.target_bandwidth / 8;
else
rc->optimal_buffer_level = vp9_rescale(cpi->oxcf.optimal_buffer_level_ms,
cpi->oxcf.target_bandwidth, 1000);
rc->optimal_buffer_level = cpi->oxcf.optimal_buffer_level_ms *
cpi->oxcf.target_bandwidth / 1000;
if (cpi->oxcf.maximum_buffer_size_ms == 0)
rc->maximum_buffer_size = cpi->oxcf.target_bandwidth / 8;
else
rc->maximum_buffer_size = vp9_rescale(cpi->oxcf.maximum_buffer_size_ms,
cpi->oxcf.target_bandwidth, 1000);
rc->maximum_buffer_size = cpi->oxcf.maximum_buffer_size_ms *
cpi->oxcf.target_bandwidth / 1000;
// Under a configuration change, where maximum_buffer_size may change,
// keep buffer level clipped to the maximum allowed buffer size.
rc->bits_off_target = MIN(rc->bits_off_target, rc->maximum_buffer_size);
......
......@@ -520,8 +520,6 @@ void vp9_scale_references(VP9_COMP *cpi);
void vp9_update_reference_frames(VP9_COMP *cpi);
int64_t vp9_rescale(int64_t val, int64_t num, int denom);
void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv);
YV12_BUFFER_CONFIG *vp9_scale_if_required(VP9_COMMON *cm,
......
......@@ -69,8 +69,8 @@ void vp9_init_layer_context(VP9_COMP *const cpi) {
lc->gold_ref_idx = -1;
}
lrc->buffer_level = vp9_rescale((int)(oxcf->starting_buffer_level_ms),
lc->target_bandwidth, 1000);
lrc->buffer_level = oxcf->starting_buffer_level_ms *
lc->target_bandwidth / 1000;
lrc->bits_off_target = lrc->buffer_level;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment