Commit 4d51bedc authored by Hui Su's avatar Hui Su

palette: add one more method for base color selection

In addition to k-means, consider using the dominant colors directly.

Improve keyframe by about 1% on the screen_content testset.

Change-Id: I08a932c322cfe36fb8def778d14f96d71c1017db
parent 0ead613b
......@@ -3790,13 +3790,15 @@ static int is_screen_content(const uint8_t *src,
const int limit = 4;
for (int r = 0; r + blk_h <= height; r += blk_h) {
for (int c = 0; c + blk_w <= width; c += blk_w) {
int count_buf[1 << 12]; // Maximum (1 << 12) color levels.
const int n_colors =
#if CONFIG_HIGHBITDEPTH
use_hbd ? av1_count_colors_highbd(src + r * stride + c, stride, blk_w,
blk_h, bd)
blk_h, bd, count_buf)
:
#endif // CONFIG_HIGHBITDEPTH
av1_count_colors(src + r * stride + c, stride, blk_w, blk_h);
av1_count_colors(src + r * stride + c, stride, blk_w, blk_h,
count_buf);
if (n_colors > 1 && n_colors <= limit) counts++;
}
}
......
This diff is collapsed.
......@@ -63,11 +63,12 @@ typedef enum OUTPUT_STATUS {
} OUTPUT_STATUS;
// Returns the number of colors in 'src'.
int av1_count_colors(const uint8_t *src, int stride, int rows, int cols);
int av1_count_colors(const uint8_t *src, int stride, int rows, int cols,
int *val_count);
#if CONFIG_HIGHBITDEPTH
// Same as av1_count_colors(), but for high-bitdepth mode.
int av1_count_colors_highbd(const uint8_t *src8, int stride, int rows, int cols,
int bit_depth);
int bit_depth, int *val_count);
#endif // CONFIG_HIGHBITDEPTH
void av1_dist_block(const AV1_COMP *cpi, MACROBLOCK *x, int plane,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment