From 00e1fb83e8af531a6efdc526a14a1d0ddc4fe6cb Mon Sep 17 00:00:00 2001
From: James Zern <[EMAIL REDACTED]>
Date: Tue, 20 Aug 2024 18:47:38 -0700
Subject: [PATCH] palette.c: make av1_remove_duplicates() static
This function is unused outside of this file.
Bug: aomedia:3416
Change-Id: I9b34615158c6e28516b4e7c7a2193644702a8e8a
---
av1/encoder/palette.c | 16 ++++++++++++++--
av1/encoder/palette.h | 14 --------------
2 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/av1/encoder/palette.c b/av1/encoder/palette.c
index a3e3fbf86..c1ceb8c6d 100644
--- a/av1/encoder/palette.c
+++ b/av1/encoder/palette.c
@@ -35,7 +35,19 @@ static int int16_comparer(const void *a, const void *b) {
return (*(int16_t *)a - *(int16_t *)b);
}
-int av1_remove_duplicates(int16_t *centroids, int num_centroids) {
+/*!\brief Removes duplicated centroid indices.
+ *
+ * \ingroup palette_mode_search
+ * \param[in] centroids A list of centroids index.
+ * \param[in] num_centroids Number of centroids.
+ *
+ * \return Returns the number of unique centroids and saves the unique centroids
+ * in beginning of the centroids array.
+ *
+ * \attention The centroids should be rounded to integers before calling this
+ * method.
+ */
+static int remove_duplicates(int16_t *centroids, int num_centroids) {
int num_unique; // number of unique centroids
int i;
qsort(centroids, num_centroids, sizeof(*centroids), int16_comparer);
@@ -225,7 +237,7 @@ static inline void palette_rd_y(
if (do_header_rd_based_breakout != NULL) *do_header_rd_based_breakout = false;
optimize_palette_colors(color_cache, n_cache, n, 1, centroids,
cpi->common.seq_params->bit_depth);
- const int num_unique_colors = av1_remove_duplicates(centroids, n);
+ const int num_unique_colors = remove_duplicates(centroids, n);
if (num_unique_colors < PALETTE_MIN_SIZE) {
// Too few unique colors to create a palette. And DC_PRED will work
// well for that case anyway. So skip.
diff --git a/av1/encoder/palette.h b/av1/encoder/palette.h
index a0c428b5a..ce109497b 100644
--- a/av1/encoder/palette.h
+++ b/av1/encoder/palette.h
@@ -99,20 +99,6 @@ static inline void av1_k_means(const int16_t *data, int16_t *centroids,
}
}
-/*!\brief Removes duplicated centroid indices.
- *
- * \ingroup palette_mode_search
- * \param[in] centroids A list of centroids index.
- * \param[in] num_centroids Number of centroids.
- *
- * \return Returns the number of unique centroids and saves the unique centroids
- * in beginning of the centroids array.
- *
- * \attention The centroids should be rounded to integers before calling this
- * method.
- */
-int av1_remove_duplicates(int16_t *centroids, int num_centroids);
-
/*!\brief Checks what colors are in the color cache.
*
* \ingroup palette_mode_search