ref: 60f76593e344dcef468752b49cf79be19b5adb0d
parent: a7b6c4503a201f7f77bb39aee7312bc5d5a41535
parent: 3e52b9675379bdfd4d29052e64a6ea39a67fb0e2
author: Angie Chiang <angiebird@google.com>
date: Tue Mar 19 14:41:46 EDT 2019
Merge "Compute count_ls in vp9_kmeans"
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -5723,8 +5723,8 @@
return group_idx;
}
-void vp9_kmeans(double *ctr_ls, double *boundary_ls, int k, KMEANS_DATA *arr,
- int size) {
+void vp9_kmeans(double *ctr_ls, double *boundary_ls, int *count_ls, int k,
+ KMEANS_DATA *arr, int size) {
double min, max;
double step;
int i, j;
@@ -5774,7 +5774,10 @@
}
}
- // compute group_idx
+ // compute group_idx, boundary_ls and count_ls
+ for (j = 0; j < k; ++j) {
+ count_ls[j] = 0;
+ }
compute_boundary_ls(ctr_ls, k, boundary_ls);
group_idx = 0;
for (i = 0; i < size; ++i) {
@@ -5785,6 +5788,7 @@
}
}
arr[i].group_idx = group_idx;
+ ++count_ls[group_idx];
}
}
@@ -5899,8 +5903,8 @@
wiener_var_segment(cpi, BLOCK_64X64, mi_row, mi_col);
vp9_kmeans(cpi->kmeans_ctr_ls, cpi->kmeans_boundary_ls,
- cpi->kmeans_ctr_num, cpi->kmeans_data_arr,
- cpi->kmeans_data_size);
+ cpi->kmeans_count_ls, cpi->kmeans_ctr_num,
+ cpi->kmeans_data_arr, cpi->kmeans_data_size);
vp9_perceptual_aq_mode_setup(cpi, &cm->seg);
}
--- a/vp9/encoder/vp9_encodeframe.h
+++ b/vp9/encoder/vp9_encodeframe.h
@@ -46,7 +46,7 @@
int content_state);
struct KMEANS_DATA;
-void vp9_kmeans(double *ctr_ls, double *boundary_ls, int k,
+void vp9_kmeans(double *ctr_ls, double *boundary_ls, int *count_ls, int k,
struct KMEANS_DATA *arr, int size);
int vp9_get_group_idx(double value, double *boundary_ls, int k);
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -611,6 +611,7 @@
int kmeans_data_stride;
double kmeans_ctr_ls[MAX_KMEANS_GROUPS];
double kmeans_boundary_ls[MAX_KMEANS_GROUPS];
+ int kmeans_count_ls[MAX_KMEANS_GROUPS];
int kmeans_ctr_num;
#if CONFIG_NON_GREEDY_MV
int tpl_ready;