]> granicus.if.org Git - libvpx/commitdiff
Removing vp9_rescale().
authorDmitry Kovalev <dkovalev@google.com>
Sat, 16 Aug 2014 00:02:10 +0000 (17:02 -0700)
committerDmitry Kovalev <dkovalev@google.com>
Sat, 16 Aug 2014 00:02:10 +0000 (17:02 -0700)
Now everything is int64_t, so we don't need that function.

Change-Id: I7dd2023677b4943ecd968d68cc06f9d4862c3c3f

vp9/encoder/vp9_encoder.c
vp9/encoder/vp9_encoder.h
vp9/encoder/vp9_svc_layercontext.c

index 1405bf329f768ed71c5321a42714858a1c754363..58059f85d20c4c24676c3696da71784161a11b92 100644 (file)
@@ -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);
index 33e9adbaea4824a2fe40c108f2c789006fb2160a..284ae9dc96f02bae128d67659c52eb1c9113c675 100644 (file)
@@ -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,
index 52f6cda5369de6d49a59a4e1cab5d57f9c2dc486..fb52d1ab70517e24c97910ec324aa6091e71fcbc 100644 (file)
@@ -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;
   }