Palette code: simpler and faster duplicate removal
Change-Id: I0c1baa5ca73c1f067d69239d3e31d1050b4706d2
This commit is contained in:
@@ -1921,21 +1921,13 @@ static int rd_pick_palette_intra_sby(VP10_COMP *cpi, MACROBLOCK *x,
|
|||||||
centroids[i] = roundf(centroids[i]);
|
centroids[i] = roundf(centroids[i]);
|
||||||
// remove duplicates
|
// remove duplicates
|
||||||
i = 1;
|
i = 1;
|
||||||
k = n;
|
for (j = 1; j < n; ++j) {
|
||||||
while (i < k) {
|
if (centroids[j] != centroids[j - 1]) { // found a new unique centroid
|
||||||
if (centroids[i] == centroids[i - 1]) {
|
centroids[i] = centroids[j];
|
||||||
j = i;
|
|
||||||
while (j < k - 1) {
|
|
||||||
assert((j + 1) < PALETTE_MAX_SIZE);
|
|
||||||
assert(j > 0);
|
|
||||||
centroids[j] = centroids[j + 1];
|
|
||||||
++j;
|
|
||||||
}
|
|
||||||
--k;
|
|
||||||
} else {
|
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
k = i; // number of unique centroids
|
||||||
|
|
||||||
#if CONFIG_VP9_HIGHBITDEPTH
|
#if CONFIG_VP9_HIGHBITDEPTH
|
||||||
if (cpi->common.use_highbitdepth)
|
if (cpi->common.use_highbitdepth)
|
||||||
|
Reference in New Issue
Block a user