From 1acc96fb8044b9c751581ad1a7c541199cb9914b Mon Sep 17 00:00:00 2001 From: Dmitry Kovalev Date: Fri, 15 Aug 2014 17:02:10 -0700 Subject: [PATCH] Removing vp9_rescale(). Now everything is int64_t, so we don't need that function. Change-Id: I7dd2023677b4943ecd968d68cc06f9d4862c3c3f --- vp9/encoder/vp9_encoder.c | 20 ++++++-------------- vp9/encoder/vp9_encoder.h | 2 -- vp9/encoder/vp9_svc_layercontext.c | 4 ++-- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 1405bf329..58059f85d 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -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); diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index 33e9adbae..284ae9dc9 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -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, diff --git a/vp9/encoder/vp9_svc_layercontext.c b/vp9/encoder/vp9_svc_layercontext.c index 52f6cda53..fb52d1ab7 100644 --- a/vp9/encoder/vp9_svc_layercontext.c +++ b/vp9/encoder/vp9_svc_layercontext.c @@ -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; } -- 2.40.0