Revert "Revert "Change the evaluation order of luma palette_size in speed 0""
This reverts commit ec1369152abc738b37aca7bb8a859ab268273249.
Reason for revert: GCC -Wstack-usage=100000 warning which was
caused by the original patch is fixed in the following CL:
https://aomedia-review.googlesource.com/c/aom/+/141861
BUG=aomedia:3100
BUG=aomedia:3096
Change-Id: I900ea38ae2dbe4d4ce2f8a6ed1a6491be0cdac07
diff --git a/av1/encoder/palette.c b/av1/encoder/palette.c
index 04d2390..1b0bf62 100644
--- a/av1/encoder/palette.c
+++ b/av1/encoder/palette.c
@@ -600,6 +600,35 @@
distortion, skippable, beat_best_rd, ctx, best_blk_skip,
tx_type_map, color_map, rows * cols);
}
+ } else if (cpi->sf.intra_sf.prune_palette_search_level == 0) {
+ const int max_n = AOMMIN(colors, PALETTE_MAX_SIZE),
+ min_n = PALETTE_MIN_SIZE;
+ // Perform top color palette search in ascending order.
+ perform_top_color_palette_search(
+ cpi, x, mbmi, bsize, dc_mode_cost, data, top_colors, min_n, max_n + 1,
+ 1, /*do_header_rd_based_gating=*/false, &unused, color_cache, n_cache,
+ best_mbmi, best_palette_color_map, best_rd, rate, rate_tokenonly,
+ distortion, skippable, beat_best_rd, ctx, best_blk_skip, tx_type_map);
+ // K-means clustering.
+ if (colors == PALETTE_MIN_SIZE) {
+ // Special case: These colors automatically become the centroids.
+ assert(colors == 2);
+ centroids[0] = lower_bound;
+ centroids[1] = upper_bound;
+ palette_rd_y(cpi, x, mbmi, bsize, dc_mode_cost, data, centroids, colors,
+ color_cache, n_cache, /*do_header_rd_based_gating=*/false,
+ best_mbmi, best_palette_color_map, best_rd, rate,
+ rate_tokenonly, distortion, skippable, beat_best_rd, ctx,
+ best_blk_skip, tx_type_map, NULL, NULL);
+ } else {
+ // Perform k-means palette search in ascending order.
+ perform_k_means_palette_search(
+ cpi, x, mbmi, bsize, dc_mode_cost, data, lower_bound, upper_bound,
+ min_n, max_n + 1, 1, /*do_header_rd_based_gating=*/false, &unused,
+ color_cache, n_cache, best_mbmi, best_palette_color_map, best_rd,
+ rate, rate_tokenonly, distortion, skippable, beat_best_rd, ctx,
+ best_blk_skip, tx_type_map, color_map, rows * cols);
+ }
} else {
const int max_n = AOMMIN(colors, PALETTE_MAX_SIZE),
min_n = PALETTE_MIN_SIZE;