]> granicus.if.org Git - libvpx/commitdiff
palette: don't repeat calc_dist for j = 0
authorAlex Converse <aconverse@google.com>
Wed, 27 May 2015 18:27:26 +0000 (11:27 -0700)
committerAlex Converse <aconverse@google.com>
Wed, 27 May 2015 18:45:00 +0000 (11:45 -0700)
Change-Id: I043c3b9696dbfa76436763ef871600cb54ade212

vp9/common/vp9_palette.c

index 749d344428945b6ec6122fb8effd9cc1d01596c9..6aea522bc7c9b754bd56e3d6d76bca2d480ef3e4 100644 (file)
@@ -159,7 +159,7 @@ void vp9_calc_indices(const double *data, const double *centroids, int *indices,
   for (i = 0; i < n; i++) {
     min_dist = calc_dist(data + i * dim, centroids, dim);
     indices[i] = 0;
-    for (j = 0; j < k; j++) {
+    for (j = 1; j < k; j++) {
       this_dist = calc_dist(data + i * dim, centroids + j * dim, dim);
       if (this_dist < min_dist) {
         min_dist = this_dist;
@@ -197,8 +197,8 @@ static void calc_centroids(const double *data, double *centroids,
   }
 }
 
-double calc_total_dist(const double *data, const double *centroids,
-                       const int *indices, int n, int k, int dim) {
+static double calc_total_dist(const double *data, const double *centroids,
+                              const int *indices, int n, int k, int dim) {
   double dist = 0;
   int i;
   (void) k;