Make palette code faster: replace nested for loops by a single memcpy().
Change-Id: Ia14df45a35c98d680822454fbb8d1763884c1852
This commit is contained in:
@@ -1949,9 +1949,7 @@ static int rd_pick_palette_intra_sby(VP10_COMP *cpi, MACROBLOCK *x,
|
|||||||
pmi->palette_size[0] = k;
|
pmi->palette_size[0] = k;
|
||||||
|
|
||||||
vp10_calc_indices(data, centroids, indices, rows * cols, k, 1);
|
vp10_calc_indices(data, centroids, indices, rows * cols, k, 1);
|
||||||
for (r = 0; r < rows; ++r)
|
memcpy(color_map, indices, rows * cols * sizeof(*color_map));
|
||||||
for (c = 0; c < cols; ++c)
|
|
||||||
color_map[r * cols + c] = indices[r * cols + c];
|
|
||||||
|
|
||||||
super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion,
|
super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion,
|
||||||
&s, NULL, bsize, *best_rd);
|
&s, NULL, bsize, *best_rd);
|
||||||
@@ -3825,9 +3823,7 @@ static void rd_pick_palette_intra_sbuv(VP10_COMP *cpi, MACROBLOCK *x,
|
|||||||
clip_pixel((int)lroundf(centroids[j * 2 + i - 1]));
|
clip_pixel((int)lroundf(centroids[j * 2 + i - 1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (r = 0; r < rows; ++r)
|
memcpy(color_map, indices, rows * cols * sizeof(*color_map));
|
||||||
for (c = 0; c < cols; ++c)
|
|
||||||
color_map[r * cols + c] = indices[r * cols + c];
|
|
||||||
|
|
||||||
super_block_uvrd(cpi, x, &this_rate_tokenonly,
|
super_block_uvrd(cpi, x, &this_rate_tokenonly,
|
||||||
&this_distortion, &s, &this_sse, bsize, *best_rd);
|
&this_distortion, &s, &this_sse, bsize, *best_rd);
|
||||||
@@ -8343,10 +8339,7 @@ static void restore_uv_color_map(VP10_COMP *cpi, MACROBLOCK *x) {
|
|||||||
|
|
||||||
vp10_calc_indices(data, centroids, indices, rows * cols,
|
vp10_calc_indices(data, centroids, indices, rows * cols,
|
||||||
pmi->palette_size[1], 2);
|
pmi->palette_size[1], 2);
|
||||||
|
memcpy(color_map, indices, rows * cols * sizeof(*color_map));
|
||||||
for (r = 0; r < rows; ++r)
|
|
||||||
for (c = 0; c < cols; ++c)
|
|
||||||
color_map[r * cols + c] = indices[r * cols + c];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_EXT_INTRA
|
#if CONFIG_EXT_INTRA
|
||||||
|
Reference in New Issue
Block a user