ref: 3e52b9675379bdfd4d29052e64a6ea39a67fb0e2
parent: 34576dab60758e66fd66aa4c78e038efe21e8d69
author: Angie Chiang <angiebird@google.com>
date: Fri Mar 15 14:30:38 EDT 2019
Compute count_ls in vp9_kmeans Change-Id: Id5a83554f2037b03a3a7d86f83e47cac311fbe1d
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -5714,8 +5714,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;
@@ -5765,7 +5765,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) {
@@ -5776,6 +5779,7 @@
}
}
arr[i].group_idx = group_idx;
+ ++count_ls[group_idx];
}
}
@@ -5890,8 +5894,8 @@
wiener_var_rdmult(cpi, BLOCK_64X64, mi_row, mi_col, cpi->rd.RDMULT);
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;