shithub: libvpx

Download patch

ref: 46c96ee9c730ab8f265a0c10a6c860ece7793ae6
parent: e9ad53cd84bf5ae40e5211073290d84afb35477c
parent: 27bec1c761704484e5649d0a504e8f5e53450841
author: Jingning Han <jingning@google.com>
date: Fri Mar 22 01:01:51 EDT 2019

Merge "Add wiener variance log function"

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -3588,6 +3588,10 @@
 }
 #undef FEATURES
 
+static double log_wiener_var(int64_t wiener_variance) {
+  return log(1.0 + wiener_variance) / log(2.0);
+}
+
 static void build_kmeans_segmentation(VP9_COMP *cpi) {
   VP9_COMMON *cm = &cpi->common;
   BLOCK_SIZE bsize = BLOCK_64X64;
@@ -3622,7 +3626,7 @@
 #endif  // CONFIG_MULTITHREAD
 
         kmeans_data = &cpi->kmeans_data_arr[cpi->kmeans_data_size++];
-        kmeans_data->value = log(1.0 + wiener_variance) / log(2.0);
+        kmeans_data->value = log_wiener_var(wiener_variance);
         kmeans_data->pos = mi_row * cpi->kmeans_data_stride + mi_col;
 #if CONFIG_MULTITHREAD
         pthread_mutex_unlock(&cpi->kmeans_mutex);
@@ -3661,7 +3665,7 @@
 
   wiener_variance /= (mb_row_end - mb_row_start) * (mb_col_end - mb_col_start);
 
-  segment_id = vp9_get_group_idx(log(1.0 + wiener_variance) / log(2.0),
+  segment_id = vp9_get_group_idx(log_wiener_var(wiener_variance),
                                  cpi->kmeans_boundary_ls, cpi->kmeans_ctr_num);
 
   return segment_id;