ref: 27bec1c761704484e5649d0a504e8f5e53450841
parent: c5f4a315a0190aa78bc3fe6fd3ffe44ee47b37e7
author: Jingning Han <jingning@google.com>
date: Thu Mar 21 11:15:31 EDT 2019
Add wiener variance log function Factor common mapping function from wiener variance to its log form. Change-Id: I25c955c8a3e25b9af1d65a0f0c3f695547c13453
--- 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;