Common configuration for MACROBLOCKD struct.
Change-Id: Ie2ea9dd8bd338cc9fe12ca9033df64f7644c68b3
This commit is contained in:
parent
a860f0f6d5
commit
d42976c515
@ -244,13 +244,6 @@ typedef struct macroblockd {
|
|||||||
PARTITION_CONTEXT left_seg_context[8];
|
PARTITION_CONTEXT left_seg_context[8];
|
||||||
} MACROBLOCKD;
|
} MACROBLOCKD;
|
||||||
|
|
||||||
static INLINE void init_macroblockd(MACROBLOCKD *xd) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_MB_PLANE; ++i)
|
|
||||||
xd->plane[i].dqcoeff = xd->dqcoeff[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize,
|
static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize,
|
||||||
PARTITION_TYPE partition) {
|
PARTITION_TYPE partition) {
|
||||||
const BLOCK_SIZE subsize = subsize_lookup[partition][bsize];
|
const BLOCK_SIZE subsize = subsize_lookup[partition][bsize];
|
||||||
|
@ -237,24 +237,33 @@ static INLINE int mi_cols_aligned_to_sb(int n_mis) {
|
|||||||
return ALIGN_POWER_OF_TWO(n_mis, MI_BLOCK_SIZE_LOG2);
|
return ALIGN_POWER_OF_TWO(n_mis, MI_BLOCK_SIZE_LOG2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static INLINE void init_macroblockd(VP9_COMMON *cm, MACROBLOCKD *xd) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_MB_PLANE; ++i) {
|
||||||
|
xd->plane[i].dqcoeff = xd->dqcoeff[i];
|
||||||
|
xd->above_context[i] = cm->above_context +
|
||||||
|
i * sizeof(*cm->above_context) * 2 * mi_cols_aligned_to_sb(cm->mi_cols);
|
||||||
|
}
|
||||||
|
|
||||||
|
xd->above_seg_context = cm->above_seg_context;
|
||||||
|
xd->mode_info_stride = cm->mode_info_stride;
|
||||||
|
}
|
||||||
|
|
||||||
static INLINE const vp9_prob* get_partition_probs(const VP9_COMMON *cm,
|
static INLINE const vp9_prob* get_partition_probs(const VP9_COMMON *cm,
|
||||||
int ctx) {
|
int ctx) {
|
||||||
return cm->frame_type == KEY_FRAME ? vp9_kf_partition_probs[ctx]
|
return cm->frame_type == KEY_FRAME ? vp9_kf_partition_probs[ctx]
|
||||||
: cm->fc.partition_prob[ctx];
|
: cm->fc.partition_prob[ctx];
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void set_skip_context(
|
static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) {
|
||||||
MACROBLOCKD *xd,
|
|
||||||
ENTROPY_CONTEXT *above_context[MAX_MB_PLANE],
|
|
||||||
ENTROPY_CONTEXT left_context[MAX_MB_PLANE][16],
|
|
||||||
int mi_row, int mi_col) {
|
|
||||||
const int above_idx = mi_col * 2;
|
const int above_idx = mi_col * 2;
|
||||||
const int left_idx = (mi_row * 2) & 15;
|
const int left_idx = (mi_row * 2) & 15;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < MAX_MB_PLANE; i++) {
|
for (i = 0; i < MAX_MB_PLANE; ++i) {
|
||||||
struct macroblockd_plane *const pd = &xd->plane[i];
|
struct macroblockd_plane *const pd = &xd->plane[i];
|
||||||
pd->above_context = above_context[i] + (above_idx >> pd->subsampling_x);
|
pd->above_context = &xd->above_context[i][above_idx >> pd->subsampling_x];
|
||||||
pd->left_context = left_context[i] + (left_idx >> pd->subsampling_y);
|
pd->left_context = &xd->left_context[i][left_idx >> pd->subsampling_y];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +308,7 @@ static void set_offsets(VP9_COMMON *const cm, MACROBLOCKD *const xd,
|
|||||||
for (x = !y; x < x_mis; ++x)
|
for (x = !y; x < x_mis; ++x)
|
||||||
xd->mi_8x8[y * cm->mode_info_stride + x] = xd->mi_8x8[0];
|
xd->mi_8x8[y * cm->mode_info_stride + x] = xd->mi_8x8[0];
|
||||||
|
|
||||||
set_skip_context(xd, xd->above_context, xd->left_context, mi_row, mi_col);
|
set_skip_context(xd, mi_row, mi_col);
|
||||||
|
|
||||||
// Distance of Mb to the various image edges. These are specified to 8th pel
|
// Distance of Mb to the various image edges. These are specified to 8th pel
|
||||||
// as they are always compared to values that are in 1/8th pel units
|
// as they are always compared to values that are in 1/8th pel units
|
||||||
@ -677,17 +677,6 @@ static void setup_frame_size_with_refs(VP9_COMMON *cm,
|
|||||||
setup_display_size(cm, rb);
|
setup_display_size(cm, rb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_tile_context(VP9_COMMON *cm, MACROBLOCKD *const xd,
|
|
||||||
int tile_row, int tile_col) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_MB_PLANE; ++i)
|
|
||||||
xd->above_context[i] = cm->above_context +
|
|
||||||
i * sizeof(*cm->above_context) * 2 * mi_cols_aligned_to_sb(cm->mi_cols);
|
|
||||||
|
|
||||||
xd->above_seg_context = cm->above_seg_context;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void decode_tile(VP9D_COMP *pbi, const TileInfo *const tile,
|
static void decode_tile(VP9D_COMP *pbi, const TileInfo *const tile,
|
||||||
vp9_reader *r) {
|
vp9_reader *r) {
|
||||||
const int num_threads = pbi->oxcf.max_threads;
|
const int num_threads = pbi->oxcf.max_threads;
|
||||||
@ -797,7 +786,6 @@ static const uint8_t *decode_tiles(VP9D_COMP *pbi,
|
|||||||
const uint8_t *data,
|
const uint8_t *data,
|
||||||
const uint8_t *data_end) {
|
const uint8_t *data_end) {
|
||||||
VP9_COMMON *const cm = &pbi->common;
|
VP9_COMMON *const cm = &pbi->common;
|
||||||
MACROBLOCKD *const xd = &pbi->mb;
|
|
||||||
const int aligned_cols = mi_cols_aligned_to_sb(cm->mi_cols);
|
const int aligned_cols = mi_cols_aligned_to_sb(cm->mi_cols);
|
||||||
const int tile_cols = 1 << cm->log2_tile_cols;
|
const int tile_cols = 1 << cm->log2_tile_cols;
|
||||||
const int tile_rows = 1 << cm->log2_tile_rows;
|
const int tile_rows = 1 << cm->log2_tile_rows;
|
||||||
@ -842,7 +830,6 @@ static const uint8_t *decode_tiles(VP9D_COMP *pbi,
|
|||||||
|
|
||||||
vp9_tile_init(&tile, cm, tile_row, col);
|
vp9_tile_init(&tile, cm, tile_row, col);
|
||||||
setup_token_decoder(buf->data, data_end, buf->size, &cm->error, &r);
|
setup_token_decoder(buf->data, data_end, buf->size, &cm->error, &r);
|
||||||
setup_tile_context(cm, xd, tile_row, col);
|
|
||||||
decode_tile(pbi, &tile, &r);
|
decode_tile(pbi, &tile, &r);
|
||||||
|
|
||||||
if (last_tile)
|
if (last_tile)
|
||||||
@ -976,12 +963,9 @@ static const uint8_t *decode_tiles_mt(VP9D_COMP *pbi,
|
|||||||
tile_data->xd = pbi->mb;
|
tile_data->xd = pbi->mb;
|
||||||
tile_data->xd.corrupted = 0;
|
tile_data->xd.corrupted = 0;
|
||||||
vp9_tile_init(tile, tile_data->cm, 0, buf->col);
|
vp9_tile_init(tile, tile_data->cm, 0, buf->col);
|
||||||
|
|
||||||
setup_token_decoder(buf->data, data_end, buf->size, &cm->error,
|
setup_token_decoder(buf->data, data_end, buf->size, &cm->error,
|
||||||
&tile_data->bit_reader);
|
&tile_data->bit_reader);
|
||||||
|
init_macroblockd(cm, &tile_data->xd);
|
||||||
setup_tile_context(cm, &tile_data->xd, 0, buf->col);
|
|
||||||
init_macroblockd(&tile_data->xd);
|
|
||||||
vp9_zero(tile_data->xd.dqcoeff);
|
vp9_zero(tile_data->xd.dqcoeff);
|
||||||
|
|
||||||
worker->had_error = 0;
|
worker->had_error = 0;
|
||||||
@ -1309,7 +1293,8 @@ int vp9_decode_frame(VP9D_COMP *pbi,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
xd->mode_info_stride = cm->mode_info_stride;
|
init_macroblockd(cm, &pbi->mb);
|
||||||
|
|
||||||
if (cm->coding_use_prev_mi)
|
if (cm->coding_use_prev_mi)
|
||||||
set_prev_mi(cm);
|
set_prev_mi(cm);
|
||||||
else
|
else
|
||||||
|
@ -147,8 +147,6 @@ VP9D_COMP *vp9_create_decompressor(const VP9D_CONFIG *oxcf) {
|
|||||||
cm->error.setjmp = 0;
|
cm->error.setjmp = 0;
|
||||||
pbi->decoded_key_frame = 0;
|
pbi->decoded_key_frame = 0;
|
||||||
|
|
||||||
init_macroblockd(&pbi->mb);
|
|
||||||
|
|
||||||
vp9_worker_init(&pbi->lf_worker);
|
vp9_worker_init(&pbi->lf_worker);
|
||||||
|
|
||||||
return pbi;
|
return pbi;
|
||||||
|
@ -207,7 +207,7 @@ static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile,
|
|||||||
const int idx_map = mb_row * cm->mb_cols + mb_col;
|
const int idx_map = mb_row * cm->mb_cols + mb_col;
|
||||||
const struct segmentation *const seg = &cm->seg;
|
const struct segmentation *const seg = &cm->seg;
|
||||||
|
|
||||||
set_skip_context(xd, xd->above_context, xd->left_context, mi_row, mi_col);
|
set_skip_context(xd, mi_row, mi_col);
|
||||||
|
|
||||||
// Activity map pointer
|
// Activity map pointer
|
||||||
x->mb_activity_ptr = &cpi->mb_activity_map[idx_map];
|
x->mb_activity_ptr = &cpi->mb_activity_map[idx_map];
|
||||||
@ -2396,8 +2396,6 @@ static void init_encode_frame_mb_context(VP9_COMP *cpi) {
|
|||||||
x->act_zbin_adj = 0;
|
x->act_zbin_adj = 0;
|
||||||
cpi->seg0_idx = 0;
|
cpi->seg0_idx = 0;
|
||||||
|
|
||||||
xd->mode_info_stride = cm->mode_info_stride;
|
|
||||||
|
|
||||||
// Copy data over into macro block data structures.
|
// Copy data over into macro block data structures.
|
||||||
vp9_setup_src_planes(x, cpi->Source, 0, 0);
|
vp9_setup_src_planes(x, cpi->Source, 0, 0);
|
||||||
|
|
||||||
|
@ -646,15 +646,7 @@ static void update_frame_size(VP9_COMP *cpi) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
init_macroblockd(cm, xd);
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_MB_PLANE; ++i)
|
|
||||||
xd->above_context[i] = cm->above_context +
|
|
||||||
i * sizeof(*cm->above_context) * 2 * mi_cols_aligned_to_sb(cm->mi_cols);
|
|
||||||
}
|
|
||||||
|
|
||||||
xd->above_seg_context = cpi->common.above_seg_context;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Table that converts 0-63 Q range values passed in outside to the Qindex
|
// Table that converts 0-63 Q range values passed in outside to the Qindex
|
||||||
|
Loading…
x
Reference in New Issue
Block a user