Replace vp9_get_bit_depth with vp9_ceil_log2.
The current name is confusing with regard to high bit depth buffers. Change-Id: Ieacd55ec22c81bd2f013f2e3d73a095affc93689
This commit is contained in:
parent
96213ac5e7
commit
98d4f09a7a
@ -131,7 +131,7 @@ int vp9_palette_color_lookup(uint8_t *dic, int n, uint8_t val, int bits) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int vp9_get_bit_depth(int n) {
|
||||
int vp9_ceil_log2(int n) {
|
||||
int i = 1, p = 2;
|
||||
while (p < n) {
|
||||
i++;
|
||||
|
@ -20,7 +20,7 @@ void vp9_insertion_sort(double *data, int n);
|
||||
void vp9_palette_color_insertion(uint8_t *old_colors, int *m, int *count,
|
||||
MB_MODE_INFO *mbmi);
|
||||
int vp9_palette_color_lookup(uint8_t *dic, int n, uint8_t val, int bits);
|
||||
int vp9_get_bit_depth(int n);
|
||||
int vp9_ceil_log2(int n);
|
||||
int vp9_k_means(double *data, double *centroids, int *indices,
|
||||
int n, int k, int dim, int max_itr);
|
||||
void vp9_calc_indices(double *data, double *centroids, int *indices,
|
||||
|
@ -311,7 +311,7 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm,
|
||||
if (m1 > 0) {
|
||||
for (i = 0; i < m1; i++)
|
||||
mbmi->palette_indexed_colors[i] =
|
||||
vp9_read_literal(r, vp9_get_bit_depth(cm->current_palette_size));
|
||||
vp9_read_literal(r, vp9_ceil_log2(cm->current_palette_size));
|
||||
if (mbmi->palette_delta_bitdepth > 0) {
|
||||
int s;
|
||||
for (i = 0; i < m1; i++) {
|
||||
@ -343,7 +343,7 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm,
|
||||
cm->current_palette_count, mbmi);
|
||||
|
||||
color_map[0] = vp9_read_literal(r,
|
||||
vp9_get_bit_depth(mbmi->palette_size[0]));
|
||||
vp9_ceil_log2(mbmi->palette_size[0]));
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = (i == 0 ? 1 : 0); j < cols; j++) {
|
||||
color_ctx = vp9_get_palette_color_context(color_map, cols, i, j, n,
|
||||
@ -387,7 +387,7 @@ static void read_intra_frame_mode_info(VP9_COMMON *const cm,
|
||||
int color_order[PALETTE_MAX_SIZE];
|
||||
uint8_t *color_map = xd->plane[1].color_index_map;
|
||||
|
||||
color_map[0] = vp9_read_literal(r, vp9_get_bit_depth(n));
|
||||
color_map[0] = vp9_read_literal(r, vp9_ceil_log2(n));
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = (i == 0 ? 1 : 0); j < cols; j++) {
|
||||
color_ctx = vp9_get_palette_color_context(color_map, cols, i, j, n,
|
||||
@ -1386,7 +1386,7 @@ static void read_inter_frame_mode_info(VP9_COMMON *const cm,
|
||||
mbmi->palette_colors[i] = vp9_read_literal(r, 8);
|
||||
|
||||
color_map[0] = vp9_read_literal(r,
|
||||
vp9_get_bit_depth(mbmi->palette_size[0]));
|
||||
vp9_ceil_log2(mbmi->palette_size[0]));
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = (i == 0 ? 1 : 0); j < cols; j++) {
|
||||
color_ctx = vp9_get_palette_color_context(color_map, cols, i, j, n,
|
||||
@ -1435,7 +1435,7 @@ static void read_inter_frame_mode_info(VP9_COMMON *const cm,
|
||||
int color_order[PALETTE_MAX_SIZE];
|
||||
uint8_t *color_map = xd->plane[1].color_index_map;
|
||||
|
||||
color_map[0] = vp9_read_literal(r, vp9_get_bit_depth(n));
|
||||
color_map[0] = vp9_read_literal(r, vp9_ceil_log2(n));
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = (i == 0 ? 1 : 0); j < cols; j++) {
|
||||
color_ctx = vp9_get_palette_color_context(color_map, cols, i, j, n,
|
||||
|
@ -494,7 +494,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
|
||||
|
||||
memcpy(buffer, mbmi->palette_color_map,
|
||||
rows * cols * sizeof(buffer[0]));
|
||||
vp9_write_literal(w, buffer[0], vp9_get_bit_depth(n));
|
||||
vp9_write_literal(w, buffer[0], vp9_ceil_log2(n));
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = (i == 0 ? 1 : 0); j < cols; j++) {
|
||||
color_ctx = vp9_get_palette_color_context(buffer, cols, i, j, n,
|
||||
@ -532,7 +532,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
|
||||
if (xd->plane[1].subsampling_x && xd->plane[1].subsampling_y) {
|
||||
memcpy(buffer, mbmi->palette_uv_color_map,
|
||||
rows * cols * sizeof(buffer[0]));
|
||||
vp9_write_literal(w, buffer[0], vp9_get_bit_depth(n));
|
||||
vp9_write_literal(w, buffer[0], vp9_ceil_log2(n));
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = (i == 0 ? 1 : 0); j < cols; j++) {
|
||||
color_ctx = vp9_get_palette_color_context(buffer, cols, i, j, n,
|
||||
@ -916,7 +916,7 @@ static void write_mb_modes_kf(const VP9_COMMON *cm,
|
||||
if (m1 > 0) {
|
||||
for (i = 0; i < m1; i++)
|
||||
vp9_write_literal(w, mbmi->palette_indexed_colors[i],
|
||||
vp9_get_bit_depth(mbmi->current_palette_size));
|
||||
vp9_ceil_log2(mbmi->current_palette_size));
|
||||
if (mbmi->palette_delta_bitdepth > 0) {
|
||||
for (i = 0; i < m1; i++) {
|
||||
vp9_write_bit(w, mbmi->palette_color_delta[i] < 0);
|
||||
@ -932,7 +932,7 @@ static void write_mb_modes_kf(const VP9_COMMON *cm,
|
||||
|
||||
memcpy(buffer, mbmi->palette_color_map,
|
||||
rows * cols * sizeof(buffer[0]));
|
||||
vp9_write_literal(w, buffer[0], vp9_get_bit_depth(n));
|
||||
vp9_write_literal(w, buffer[0], vp9_ceil_log2(n));
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = (i == 0 ? 1 : 0); j < cols; j++) {
|
||||
color_ctx = vp9_get_palette_color_context(buffer, cols, i, j, n,
|
||||
@ -970,7 +970,7 @@ static void write_mb_modes_kf(const VP9_COMMON *cm,
|
||||
if (xd->plane[1].subsampling_x && xd->plane[1].subsampling_y) {
|
||||
memcpy(buffer, mbmi->palette_uv_color_map,
|
||||
rows * cols * sizeof(buffer[0]));
|
||||
vp9_write_literal(w, buffer[0], vp9_get_bit_depth(n));
|
||||
vp9_write_literal(w, buffer[0], vp9_ceil_log2(n));
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = (i == 0 ? 1 : 0); j < cols; j++) {
|
||||
color_ctx = vp9_get_palette_color_context(buffer, cols, i, j, n,
|
||||
|
@ -1932,7 +1932,7 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
m2++;
|
||||
}
|
||||
}
|
||||
total_bits = m1 * vp9_get_bit_depth(cpi->common.current_palette_size) +
|
||||
total_bits = m1 * vp9_ceil_log2(cpi->common.current_palette_size) +
|
||||
m1 * (bits == 0 ? 0 : bits + 1) + m2 * 8;
|
||||
if (total_bits <= best_total_bits) {
|
||||
best_total_bits = total_bits;
|
||||
@ -2020,11 +2020,11 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
|
||||
this_rate = this_rate_tokenonly +
|
||||
(1 + vp9_encode_uniform_cost(MIN(k + 1, 8), m1) + PALETTE_DELTA_BIT
|
||||
+ vp9_get_bit_depth(mic->mbmi.current_palette_size) * m1 +
|
||||
+ vp9_ceil_log2(mic->mbmi.current_palette_size) * m1 +
|
||||
best_bits * m1 + 8 * m2) * vp9_cost_bit(128, 0) +
|
||||
palette_size_cost[k - 2];
|
||||
color_map = xd->plane[0].color_index_map;
|
||||
this_rate += vp9_get_bit_depth(k) * vp9_cost_bit(128, 0);
|
||||
this_rate += vp9_ceil_log2(k) * vp9_cost_bit(128, 0);
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = (i == 0 ? 1 : 0); j < cols; j++) {
|
||||
color_ctx = vp9_get_palette_color_context(color_map, cols, i, j, n,
|
||||
@ -2539,7 +2539,7 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
this_rate = this_rate_tokenonly +
|
||||
(1 + 2 * 8 * n) * vp9_cost_bit(128, 0) +
|
||||
palette_size_cost[n - 2];
|
||||
this_rate += vp9_get_bit_depth(n) * vp9_cost_bit(128, 0);
|
||||
this_rate += vp9_ceil_log2(n) * vp9_cost_bit(128, 0);
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = (i == 0 ? 1 : 0); j < cols; j++) {
|
||||
color_ctx = vp9_get_palette_color_context(color_map, cols, i, j, n,
|
||||
@ -5571,7 +5571,7 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
(1 + PALETTE_DELTA_BIT + n * m2) * vp9_cost_bit(128, 0) +
|
||||
palette_size_cost[n - 2];
|
||||
color_map = xd->plane[0].color_index_map;
|
||||
rate_y += vp9_get_bit_depth(n) * vp9_cost_bit(128, 0);
|
||||
rate_y += vp9_ceil_log2(n) * vp9_cost_bit(128, 0);
|
||||
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = (i == 0 ? 1 : 0); j < cols; j++) {
|
||||
@ -7110,7 +7110,7 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
vp9_cost_bit(cm->fc.palette_enabled_prob
|
||||
[bsize - BLOCK_8X8][palette_ctx], 1);
|
||||
color_map = xd->plane[0].color_index_map;
|
||||
total_rate_y += vp9_get_bit_depth(k) * vp9_cost_bit(128, 0);
|
||||
total_rate_y += vp9_ceil_log2(k) * vp9_cost_bit(128, 0);
|
||||
for (i = 0; i < rows; i++) {
|
||||
for (j = (i == 0 ? 1 : 0); j < cols; j++) {
|
||||
color_ctx = vp9_get_palette_color_context(color_map, cols, i, j, n,
|
||||
|
Loading…
x
Reference in New Issue
Block a user