Cleanup map_pb_cdf from Av1ColorMapParam structure
Av1ColorMapParam is a common structure to both encoder and
decoder, but map_pb_cdf will be used only in encoder. This
parameter is now excluded from Av1ColorMapParam and passed
as a parameter to the respective encoder functions.
Change-Id: I54d1e96ab1a1038c9e5df2143cb5b9b31229a5ef
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 6048a2c..2aaf0c0 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -1138,7 +1138,6 @@
int plane_height;
uint8_t *color_map;
MapCdf map_cdf;
- MapCdf map_pb_cdf;
ColorCost color_cost;
} Av1ColorMapParam;
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c
index 4c12e68d..ce1a212 100644
--- a/av1/encoder/tokenize.c
+++ b/av1/encoder/tokenize.c
@@ -29,10 +29,9 @@
static int cost_and_tokenize_map(Av1ColorMapParam *param, TOKENEXTRA **t,
int plane, int calc_rate, int allow_update_cdf,
- FRAME_COUNTS *counts) {
+ FRAME_COUNTS *counts, MapCdf map_pb_cdf) {
const uint8_t *const color_map = param->color_map;
MapCdf map_cdf = param->map_cdf;
- MapCdf map_pb_cdf = param->map_pb_cdf;
ColorCost color_cost = param->color_cost;
const int plane_block_width = param->plane_width;
const int rows = param->rows;
@@ -84,8 +83,6 @@
params->color_map = xd->plane[plane].color_index_map;
params->map_cdf = plane ? xd->tile_ctx->palette_uv_color_index_cdf
: xd->tile_ctx->palette_y_color_index_cdf;
- params->map_pb_cdf = plane ? x->tile_pb_ctx->palette_uv_color_index_cdf
- : x->tile_pb_ctx->palette_y_color_index_cdf;
params->color_cost =
plane ? &x->palette_uv_color_cost : &x->palette_y_color_cost;
params->n_colors = pmi->palette_size[plane];
@@ -110,7 +107,10 @@
assert(plane == 0 || plane == 1);
Av1ColorMapParam color_map_params;
get_color_map_params(x, plane, bsize, tx_size, type, &color_map_params);
- return cost_and_tokenize_map(&color_map_params, NULL, plane, 1, 0, NULL);
+ MapCdf map_pb_cdf = plane ? x->tile_pb_ctx->palette_uv_color_index_cdf
+ : x->tile_pb_ctx->palette_y_color_index_cdf;
+ return cost_and_tokenize_map(&color_map_params, NULL, plane, 1, 0, NULL,
+ map_pb_cdf);
}
void av1_tokenize_color_map(const MACROBLOCK *const x, int plane,
@@ -124,8 +124,10 @@
(*t)->token = color_map_params.color_map[0];
(*t)->color_map_cdf = NULL;
++(*t);
+ MapCdf map_pb_cdf = plane ? x->tile_pb_ctx->palette_uv_color_index_cdf
+ : x->tile_pb_ctx->palette_y_color_index_cdf;
cost_and_tokenize_map(&color_map_params, t, plane, 0, allow_update_cdf,
- counts);
+ counts, map_pb_cdf);
}
static void tokenize_vartx(ThreadData *td, TOKENEXTRA **t, RUN_TYPE dry_run,