From 511da8cbe585957d1662db39f2b4c4ef00040a75 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Thu, 24 Mar 2016 11:20:25 +0000 Subject: [PATCH 1/2] Rename MI_BLOCK_SIZE and MI_MASK macros. Rename MI_BLOCK_SIZE.* -> MAX_MIB_SIZE.* (MIB is for MI Block). Rename MI_MASK.* -> MAX_MIB_MASK.* There are no functional changes. This is in preparation for coding the superblock size at the frame level, which will require some of these constants to become variables. The new names better reflect future semantics, and hence make the code clearer. Change-Id: Iee08d97554cf4cc16a5dc166a3ffd1ab91529992 --- vp10/common/blockd.h | 8 +-- vp10/common/enums.h | 19 +++++--- vp10/common/loopfilter.c | 86 ++++++++++++++++----------------- vp10/common/loopfilter.h | 4 +- vp10/common/mfqe.c | 4 +- vp10/common/mvref_common.c | 2 +- vp10/common/onyxc_int.h | 14 +++--- vp10/common/reconintra.c | 24 +++++---- vp10/common/thread_common.c | 14 +++--- vp10/common/tile_common.c | 2 +- vp10/decoder/decodeframe.c | 27 ++++++----- vp10/decoder/decodemv.c | 9 ++-- vp10/encoder/aq_cyclicrefresh.c | 8 +-- vp10/encoder/bitstream.c | 11 +++-- vp10/encoder/block.h | 6 +-- vp10/encoder/encodeframe.c | 67 +++++++++++++------------ vp10/encoder/encodemb.c | 4 +- vp10/encoder/encoder.c | 4 +- vp10/encoder/rd.c | 4 +- vp10/encoder/rd.h | 4 +- vp10/encoder/rdopt.c | 30 ++++++------ vp10/encoder/segmentation.c | 4 +- 22 files changed, 184 insertions(+), 171 deletions(-) diff --git a/vp10/common/blockd.h b/vp10/common/blockd.h index 821d67c95..1698ae296 100644 --- a/vp10/common/blockd.h +++ b/vp10/common/blockd.h @@ -166,7 +166,7 @@ typedef struct { #if CONFIG_VAR_TX // TODO(jingning): This effectively assigned a separate entry for each // 8x8 block. Apparently it takes much more space than needed. - TX_SIZE inter_tx_size[MI_BLOCK_SIZE][MI_BLOCK_SIZE]; + TX_SIZE inter_tx_size[MAX_MIB_SIZE][MAX_MIB_SIZE]; #endif int8_t skip; int8_t has_no_coeffs; @@ -315,15 +315,15 @@ typedef struct macroblockd { const YV12_BUFFER_CONFIG *cur_buf; ENTROPY_CONTEXT *above_context[MAX_MB_PLANE]; - ENTROPY_CONTEXT left_context[MAX_MB_PLANE][2 * MI_BLOCK_SIZE]; + ENTROPY_CONTEXT left_context[MAX_MB_PLANE][2 * MAX_MIB_SIZE]; PARTITION_CONTEXT *above_seg_context; - PARTITION_CONTEXT left_seg_context[MI_BLOCK_SIZE]; + PARTITION_CONTEXT left_seg_context[MAX_MIB_SIZE]; #if CONFIG_VAR_TX TXFM_CONTEXT *above_txfm_context; TXFM_CONTEXT *left_txfm_context; - TXFM_CONTEXT left_txfm_context_buffer[MI_BLOCK_SIZE]; + TXFM_CONTEXT left_txfm_context_buffer[MAX_MIB_SIZE]; TX_SIZE max_tx_size; #if CONFIG_SUPERTX diff --git a/vp10/common/enums.h b/vp10/common/enums.h index 5615cee93..8f932d971 100644 --- a/vp10/common/enums.h +++ b/vp10/common/enums.h @@ -20,23 +20,26 @@ extern "C" { #undef MAX_SB_SIZE +// Pixels per max superblock size #if CONFIG_EXT_PARTITION # define MAX_SB_SIZE_LOG2 7 #else # define MAX_SB_SIZE_LOG2 6 #endif // CONFIG_EXT_PARTITION - -#define MAX_SB_SIZE (1 << MAX_SB_SIZE_LOG2) +#define MAX_SB_SIZE (1 << MAX_SB_SIZE_LOG2) #define MAX_SB_SQUARE (MAX_SB_SIZE * MAX_SB_SIZE) -#define MI_SIZE_LOG2 3 -#define MI_SIZE (1 << MI_SIZE_LOG2) // pixels per mi-unit +// Pixels per Mode Info (MI) unit +#define MI_SIZE_LOG2 3 +#define MI_SIZE (1 << MI_SIZE_LOG2) -#define MI_BLOCK_SIZE_LOG2 (MAX_SB_SIZE_LOG2 - MI_SIZE_LOG2) -#define MI_BLOCK_SIZE (1 << MI_BLOCK_SIZE_LOG2) // mi-units per max block +// MI-units per max superblock (MI Block - MIB) +#define MAX_MIB_SIZE_LOG2 (MAX_SB_SIZE_LOG2 - MI_SIZE_LOG2) +#define MAX_MIB_SIZE (1 << MAX_MIB_SIZE_LOG2) -#define MI_MASK (MI_BLOCK_SIZE - 1) -#define MI_MASK_2 (MI_BLOCK_SIZE * 2 - 1) +// Mask to extract MI offset within max MIB +#define MAX_MIB_MASK (MAX_MIB_SIZE - 1) +#define MAX_MIB_MASK_2 (MAX_MIB_SIZE * 2 - 1) #if CONFIG_EXT_TILE # define MAX_TILE_ROWS 1024 diff --git a/vp10/common/loopfilter.c b/vp10/common/loopfilter.c index fe9b13cb4..41db54f1c 100644 --- a/vp10/common/loopfilter.c +++ b/vp10/common/loopfilter.c @@ -867,10 +867,10 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col, const int shift_32_uv[] = {0, 2, 8, 10}; const int shift_16_uv[] = {0, 1, 4, 5}; int i; - const int max_rows = (mi_row + MI_BLOCK_SIZE > cm->mi_rows ? - cm->mi_rows - mi_row : MI_BLOCK_SIZE); - const int max_cols = (mi_col + MI_BLOCK_SIZE > cm->mi_cols ? - cm->mi_cols - mi_col : MI_BLOCK_SIZE); + const int max_rows = (mi_row + MAX_MIB_SIZE > cm->mi_rows ? + cm->mi_rows - mi_row : MAX_MIB_SIZE); + const int max_cols = (mi_col + MAX_MIB_SIZE > cm->mi_cols ? + cm->mi_cols - mi_col : MAX_MIB_SIZE); #if CONFIG_EXT_PARTITION assert(0 && "Not yet updated"); #endif // CONFIG_EXT_PARTITION @@ -1044,14 +1044,14 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col, lfm->above_uv[TX_4X4] &= ~above_border_uv; // We do some special edge handling. - if (mi_row + MI_BLOCK_SIZE > cm->mi_rows) { + if (mi_row + MAX_MIB_SIZE > cm->mi_rows) { const uint64_t rows = cm->mi_rows - mi_row; // Each pixel inside the border gets a 1, const uint64_t mask_y = - (((uint64_t) 1 << (rows << MI_BLOCK_SIZE_LOG2)) - 1); + (((uint64_t) 1 << (rows << MAX_MIB_SIZE_LOG2)) - 1); const uint16_t mask_uv = - (((uint16_t) 1 << (((rows + 1) >> 1) << (MI_BLOCK_SIZE_LOG2 - 1))) - 1); + (((uint16_t) 1 << (((rows + 1) >> 1) << (MAX_MIB_SIZE_LOG2 - 1))) - 1); // Remove values completely outside our border. for (i = 0; i < TX_32X32; i++) { @@ -1075,7 +1075,7 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col, } } - if (mi_col + MI_BLOCK_SIZE > cm->mi_cols) { + if (mi_col + MAX_MIB_SIZE > cm->mi_cols) { const uint64_t columns = cm->mi_cols - mi_col; // Each pixel inside the border gets a 1, the multiply copies the border @@ -1219,21 +1219,21 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, const int row_step_stride = cm->mi_stride * row_step; struct buf_2d *const dst = &plane->dst; uint8_t* const dst0 = dst->buf; - unsigned int mask_16x16[MI_BLOCK_SIZE] = {0}; - unsigned int mask_8x8[MI_BLOCK_SIZE] = {0}; - unsigned int mask_4x4[MI_BLOCK_SIZE] = {0}; - unsigned int mask_4x4_int[MI_BLOCK_SIZE] = {0}; - uint8_t lfl[MI_BLOCK_SIZE * MI_BLOCK_SIZE]; + unsigned int mask_16x16[MAX_MIB_SIZE] = {0}; + unsigned int mask_8x8[MAX_MIB_SIZE] = {0}; + unsigned int mask_4x4[MAX_MIB_SIZE] = {0}; + unsigned int mask_4x4_int[MAX_MIB_SIZE] = {0}; + uint8_t lfl[MAX_MIB_SIZE * MAX_MIB_SIZE]; int r, c; - for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += row_step) { + for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r += row_step) { unsigned int mask_16x16_c = 0; unsigned int mask_8x8_c = 0; unsigned int mask_4x4_c = 0; unsigned int border_mask; // Determine the vertical edges that need filtering - for (c = 0; c < MI_BLOCK_SIZE && mi_col + c < cm->mi_cols; c += col_step) { + for (c = 0; c < MAX_MIB_SIZE && mi_col + c < cm->mi_cols; c += col_step) { const MODE_INFO *mi = mi_8x8[c]; const MB_MODE_INFO *mbmi = &mi[0].mbmi; const BLOCK_SIZE sb_type = mbmi->sb_type; @@ -1267,7 +1267,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, int tx_size_mask = 0; // Filter level can vary per MI - if (!(lfl[(r << MI_BLOCK_SIZE_LOG2) + (c >> ss_x)] = + if (!(lfl[(r << MAX_MIB_SIZE_LOG2) + (c >> ss_x)] = get_filter_level(&cm->lf_info, mbmi))) continue; @@ -1288,10 +1288,10 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, tx_size_r = VPXMIN(tx_size, cm->above_txfm_context[mi_col + c]); tx_size_c = VPXMIN(tx_size, - cm->left_txfm_context[(mi_row + r) & MI_MASK]); + cm->left_txfm_context[(mi_row + r) & MAX_MIB_MASK]); cm->above_txfm_context[mi_col + c] = tx_size; - cm->left_txfm_context[(mi_row + r) & MI_MASK] = tx_size; + cm->left_txfm_context[(mi_row + r) & MAX_MIB_MASK] = tx_size; #endif // Build masks based on the transform size of each block @@ -1365,7 +1365,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, mask_8x8_c & border_mask, mask_4x4_c & border_mask, mask_4x4_int[r], - &cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2], + &cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2], (int)cm->bit_depth); } else { filter_selectively_vert(dst->buf, dst->stride, @@ -1373,7 +1373,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, mask_8x8_c & border_mask, mask_4x4_c & border_mask, mask_4x4_int[r], - &cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2]); + &cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2]); } #else filter_selectively_vert(dst->buf, dst->stride, @@ -1381,7 +1381,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, mask_8x8_c & border_mask, mask_4x4_c & border_mask, mask_4x4_int[r], - &cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2]); + &cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2]); #endif // CONFIG_VP9_HIGHBITDEPTH dst->buf += 8 * dst->stride; mi_8x8 += row_step_stride; @@ -1389,7 +1389,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, // Now do horizontal pass dst->buf = dst0; - for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += row_step) { + for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r += row_step) { const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1; const unsigned int mask_4x4_int_r = skip_border_4x4_r ? 0 : mask_4x4_int[r]; @@ -1415,7 +1415,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, mask_8x8_r, mask_4x4_r, mask_4x4_int_r, - &cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2], + &cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2], (int)cm->bit_depth); } else { filter_selectively_horiz(dst->buf, dst->stride, @@ -1423,7 +1423,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, mask_8x8_r, mask_4x4_r, mask_4x4_int_r, - &cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2]); + &cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2]); } #else filter_selectively_horiz(dst->buf, dst->stride, @@ -1431,7 +1431,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, mask_8x8_r, mask_4x4_r, mask_4x4_int_r, - &cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2]); + &cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2]); #endif // CONFIG_VP9_HIGHBITDEPTH dst->buf += 8 * dst->stride; } @@ -1452,7 +1452,7 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm, assert(plane->subsampling_x == 0 && plane->subsampling_y == 0); // Vertical pass: do 2 rows at one time - for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 2) { + for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r += 2) { unsigned int mask_16x16_l = mask_16x16 & 0xffff; unsigned int mask_8x8_l = mask_8x8 & 0xffff; unsigned int mask_4x4_l = mask_4x4 & 0xffff; @@ -1464,18 +1464,18 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm, highbd_filter_selectively_vert_row2( plane->subsampling_x, CONVERT_TO_SHORTPTR(dst->buf), dst->stride, mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info, - &lfm->lfl_y[r << MI_BLOCK_SIZE_LOG2], (int)cm->bit_depth); + &lfm->lfl_y[r << MAX_MIB_SIZE_LOG2], (int)cm->bit_depth); } else { filter_selectively_vert_row2( plane->subsampling_x, dst->buf, dst->stride, mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info, - &lfm->lfl_y[r << MI_BLOCK_SIZE_LOG2]); + &lfm->lfl_y[r << MAX_MIB_SIZE_LOG2]); } #else filter_selectively_vert_row2( plane->subsampling_x, dst->buf, dst->stride, mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info, - &lfm->lfl_y[r << MI_BLOCK_SIZE_LOG2]); + &lfm->lfl_y[r << MAX_MIB_SIZE_LOG2]); #endif // CONFIG_VP9_HIGHBITDEPTH dst->buf += 16 * dst->stride; mask_16x16 >>= 16; @@ -1491,7 +1491,7 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm, mask_4x4 = lfm->above_y[TX_4X4]; mask_4x4_int = lfm->int_4x4_y; - for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r++) { + for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r++) { unsigned int mask_16x16_r; unsigned int mask_8x8_r; unsigned int mask_4x4_r; @@ -1511,17 +1511,17 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm, highbd_filter_selectively_horiz( CONVERT_TO_SHORTPTR(dst->buf), dst->stride, mask_16x16_r, mask_8x8_r, mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info, - &lfm->lfl_y[r << MI_BLOCK_SIZE_LOG2], + &lfm->lfl_y[r << MAX_MIB_SIZE_LOG2], (int)cm->bit_depth); } else { filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r, mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info, - &lfm->lfl_y[r << MI_BLOCK_SIZE_LOG2]); + &lfm->lfl_y[r << MAX_MIB_SIZE_LOG2]); } #else filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r, mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info, - &lfm->lfl_y[r << MI_BLOCK_SIZE_LOG2]); + &lfm->lfl_y[r << MAX_MIB_SIZE_LOG2]); #endif // CONFIG_VP9_HIGHBITDEPTH dst->buf += 8 * dst->stride; @@ -1548,13 +1548,13 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm, assert(plane->subsampling_x == 1 && plane->subsampling_y == 1); // Vertical pass: do 2 rows at one time - for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 4) { + for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r += 4) { if (plane->plane_type == 1) { - for (c = 0; c < (MI_BLOCK_SIZE >> 1); c++) { + for (c = 0; c < (MAX_MIB_SIZE >> 1); c++) { lfm->lfl_uv[(r << 1) + c] = - lfm->lfl_y[(r << MI_BLOCK_SIZE_LOG2) + (c << 1)]; + lfm->lfl_y[(r << MAX_MIB_SIZE_LOG2) + (c << 1)]; lfm->lfl_uv[((r + 2) << 1) + c] = - lfm->lfl_y[((r + 2) << MI_BLOCK_SIZE_LOG2) + (c << 1)]; + lfm->lfl_y[((r + 2) << MAX_MIB_SIZE_LOG2) + (c << 1)]; } } @@ -1599,7 +1599,7 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm, mask_4x4 = lfm->above_uv[TX_4X4]; mask_4x4_int = lfm->above_int_4x4_uv; - for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 2) { + for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r += 2) { const int skip_border_4x4_r = mi_row + r == cm->mi_rows - 1; const unsigned int mask_4x4_int_r = skip_border_4x4_r ? 0 : (mask_4x4_int & 0xf); @@ -1653,12 +1653,12 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, # if CONFIG_VAR_TX memset(cm->above_txfm_context, TX_SIZES, cm->mi_cols); # endif // CONFIG_VAR_TX - for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) { + for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) { MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride; # if CONFIG_VAR_TX - memset(cm->left_txfm_context, TX_SIZES, MI_BLOCK_SIZE); + memset(cm->left_txfm_context, TX_SIZES, MAX_MIB_SIZE); # endif // CONFIG_VAR_TX - for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) { + for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) { int plane; vp10_setup_dst_planes(planes, frame_buffer, mi_row, mi_col); @@ -1683,9 +1683,9 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, else path = LF_PATH_SLOW; - for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) { + for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) { MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride; - for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) { + for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) { int plane; vp10_setup_dst_planes(planes, frame_buffer, mi_row, mi_col); diff --git a/vp10/common/loopfilter.h b/vp10/common/loopfilter.h index 8fa0b8048..706d9f67e 100644 --- a/vp10/common/loopfilter.h +++ b/vp10/common/loopfilter.h @@ -84,8 +84,8 @@ typedef struct { uint16_t above_uv[TX_SIZES]; uint16_t left_int_4x4_uv; uint16_t above_int_4x4_uv; - uint8_t lfl_y[MI_BLOCK_SIZE * MI_BLOCK_SIZE]; - uint8_t lfl_uv[MI_BLOCK_SIZE / 2 * MI_BLOCK_SIZE / 2]; + uint8_t lfl_y[MAX_MIB_SIZE * MAX_MIB_SIZE]; + uint8_t lfl_uv[MAX_MIB_SIZE / 2 * MAX_MIB_SIZE / 2]; } LOOP_FILTER_MASK; /* assorted loopfilter functions which get used elsewhere */ diff --git a/vp10/common/mfqe.c b/vp10/common/mfqe.c index c715ef73e..bd0b25be8 100644 --- a/vp10/common/mfqe.c +++ b/vp10/common/mfqe.c @@ -356,8 +356,8 @@ void vp10_mfqe(VP10_COMMON *cm) { // Last decoded frame and will store the MFQE result. YV12_BUFFER_CONFIG *dest = &cm->post_proc_buffer; // Loop through each super block. - for (mi_row = 0; mi_row < cm->mi_rows; mi_row += MI_BLOCK_SIZE) { - for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) { + for (mi_row = 0; mi_row < cm->mi_rows; mi_row += MAX_MIB_SIZE) { + for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) { MODE_INFO *mi; MODE_INFO *mi_local = cm->mi + (mi_row * cm->mi_stride + mi_col); // Motion Info in last frame. diff --git a/vp10/common/mvref_common.c b/vp10/common/mvref_common.c index aa651a2e2..7c6633f7d 100644 --- a/vp10/common/mvref_common.c +++ b/vp10/common/mvref_common.c @@ -260,7 +260,7 @@ static int has_top_right(const MACROBLOCKD *xd, // For each 4x4 group of blocks, when the bottom right is decoded the blocks // to the right have not been decoded therefore the bottom right does // not have a top right - while (bs < MI_BLOCK_SIZE) { + while (bs < MAX_MIB_SIZE) { if (mi_col & bs) { if ((mi_col & (2 * bs)) && (mi_row & (2 * bs))) { has_tr = 0; diff --git a/vp10/common/onyxc_int.h b/vp10/common/onyxc_int.h index bdd9ffeaf..cc443e7cf 100644 --- a/vp10/common/onyxc_int.h +++ b/vp10/common/onyxc_int.h @@ -332,7 +332,7 @@ typedef struct VP10Common { ENTROPY_CONTEXT *above_context[MAX_MB_PLANE]; #if CONFIG_VAR_TX TXFM_CONTEXT *above_txfm_context; - TXFM_CONTEXT left_txfm_context[MI_BLOCK_SIZE]; + TXFM_CONTEXT left_txfm_context[MAX_MIB_SIZE]; #endif int above_context_alloc_cols; @@ -408,7 +408,7 @@ static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) { } 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, MAX_MIB_SIZE_LOG2); } static INLINE int frame_is_intra_only(const VP10_COMMON *const cm) { @@ -440,7 +440,7 @@ static INLINE void vp10_init_macroblockd(VP10_COMMON *cm, MACROBLOCKD *xd, static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) { const int above_idx = mi_col * 2; - const int left_idx = (mi_row * 2) & MI_MASK_2; + const int left_idx = (mi_row * 2) & MAX_MIB_MASK_2; int i; for (i = 0; i < MAX_MB_PLANE; ++i) { struct macroblockd_plane *const pd = &xd->plane[i]; @@ -451,7 +451,7 @@ static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) { static INLINE int calc_mi_size(int len) { // len is in mi units. - return len + MI_BLOCK_SIZE; + return len + MAX_MIB_SIZE; } static INLINE void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile, @@ -517,7 +517,8 @@ static INLINE void update_partition_context(MACROBLOCKD *xd, BLOCK_SIZE subsize, BLOCK_SIZE bsize) { PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col; - PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK); + PARTITION_CONTEXT *const left_ctx = + xd->left_seg_context + (mi_row & MAX_MIB_MASK); #if CONFIG_EXT_PARTITION_TYPES const int bw = num_8x8_blocks_wide_lookup[bsize]; @@ -581,7 +582,8 @@ static INLINE int partition_plane_context(const MACROBLOCKD *xd, int mi_row, int mi_col, BLOCK_SIZE bsize) { const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col; - const PARTITION_CONTEXT *left_ctx = xd->left_seg_context + (mi_row & MI_MASK); + const PARTITION_CONTEXT *left_ctx = + xd->left_seg_context + (mi_row & MAX_MIB_MASK); const int bsl = mi_width_log2_lookup[bsize]; int above = (*above_ctx >> bsl) & 1 , left = (*left_ctx >> bsl) & 1; diff --git a/vp10/common/reconintra.c b/vp10/common/reconintra.c index 300005f74..bafd0d6e6 100644 --- a/vp10/common/reconintra.c +++ b/vp10/common/reconintra.c @@ -272,21 +272,19 @@ static int vp10_has_right(BLOCK_SIZE bsize, int mi_row, int mi_col, if (x + step < w) return 1; - mi_row = (mi_row & MI_MASK) >> hl; - mi_col = (mi_col & MI_MASK) >> wl; + mi_row = (mi_row & MAX_MIB_MASK) >> hl; + mi_col = (mi_col & MAX_MIB_MASK) >> wl; // If top row of coding unit if (mi_row == 0) return 1; // If rightmost column of coding unit - if (((mi_col + 1) << wl) >= MI_BLOCK_SIZE) + if (((mi_col + 1) << wl) >= MAX_MIB_SIZE) return 0; - my_order = - order[((mi_row + 0) << (MI_BLOCK_SIZE_LOG2 - wl)) + mi_col + 0]; - tr_order = - order[((mi_row - 1) << (MI_BLOCK_SIZE_LOG2 - wl)) + mi_col + 1]; + my_order = order[((mi_row + 0) << (MAX_MIB_SIZE_LOG2 - wl)) + mi_col + 0]; + tr_order = order[((mi_row - 1) << (MAX_MIB_SIZE_LOG2 - wl)) + mi_col + 1]; return my_order > tr_order; } else { @@ -315,17 +313,17 @@ static int vp10_has_bottom(BLOCK_SIZE bsize, int mi_row, int mi_col, if (y + step < h) return 1; - mi_row = (mi_row & MI_MASK) >> hl; - mi_col = (mi_col & MI_MASK) >> wl; + mi_row = (mi_row & MAX_MIB_MASK) >> hl; + mi_col = (mi_col & MAX_MIB_MASK) >> wl; if (mi_col == 0) - return (mi_row << (hl + !ss_y)) + y + step < (MI_BLOCK_SIZE << !ss_y); + return (mi_row << (hl + !ss_y)) + y + step < (MAX_MIB_SIZE << !ss_y); - if (((mi_row + 1) << hl) >= MI_BLOCK_SIZE) + if (((mi_row + 1) << hl) >= MAX_MIB_SIZE) return 0; - my_order = order[((mi_row + 0) << (MI_BLOCK_SIZE_LOG2 - wl)) + mi_col + 0]; - bl_order = order[((mi_row + 1) << (MI_BLOCK_SIZE_LOG2 - wl)) + mi_col - 1]; + my_order = order[((mi_row + 0) << (MAX_MIB_SIZE_LOG2 - wl)) + mi_col + 0]; + bl_order = order[((mi_row + 1) << (MAX_MIB_SIZE_LOG2 - wl)) + mi_col - 1]; return bl_order < my_order; } diff --git a/vp10/common/thread_common.c b/vp10/common/thread_common.c index b2339c686..6014b3acf 100644 --- a/vp10/common/thread_common.c +++ b/vp10/common/thread_common.c @@ -94,7 +94,7 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer, int start, int stop, int y_only, VP9LfSync *const lf_sync) { const int num_planes = y_only ? 1 : MAX_MB_PLANE; - const int sb_cols = mi_cols_aligned_to_sb(cm->mi_cols) >> MI_BLOCK_SIZE_LOG2; + const int sb_cols = mi_cols_aligned_to_sb(cm->mi_cols) >> MAX_MIB_SIZE_LOG2; int mi_row, mi_col; #if !CONFIG_EXT_PARTITION_TYPES enum lf_path path; @@ -116,12 +116,12 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer, #endif // CONFIG_EXT_PARTITION for (mi_row = start; mi_row < stop; - mi_row += lf_sync->num_workers * MI_BLOCK_SIZE) { + mi_row += lf_sync->num_workers * MAX_MIB_SIZE) { MODE_INFO **const mi = cm->mi_grid_visible + mi_row * cm->mi_stride; - for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) { - const int r = mi_row >> MI_BLOCK_SIZE_LOG2; - const int c = mi_col >> MI_BLOCK_SIZE_LOG2; + for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) { + const int r = mi_row >> MAX_MIB_SIZE_LOG2; + const int c = mi_col >> MAX_MIB_SIZE_LOG2; int plane; sync_read(lf_sync, r, c); @@ -175,7 +175,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, VP9LfSync *lf_sync) { const VPxWorkerInterface *const winterface = vpx_get_worker_interface(); // Number of superblock rows and cols - const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2; + const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MAX_MIB_SIZE_LOG2; // Decoder may allocate more threads than number of tiles based on user's // input. const int tile_cols = cm->tile_cols; @@ -215,7 +215,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, // Loopfilter data vp10_loop_filter_data_reset(lf_data, frame, cm, planes); - lf_data->start = start + i * MI_BLOCK_SIZE; + lf_data->start = start + i * MAX_MIB_SIZE; lf_data->stop = stop; lf_data->y_only = y_only; diff --git a/vp10/common/tile_common.c b/vp10/common/tile_common.c index de5f9216d..36ec5d3aa 100644 --- a/vp10/common/tile_common.c +++ b/vp10/common/tile_common.c @@ -50,7 +50,7 @@ static int get_max_log2_tile_cols(const int sb64_cols) { void vp10_get_tile_n_bits(int mi_cols, int *min_log2_tile_cols, int *max_log2_tile_cols) { - const int sb64_cols = mi_cols_aligned_to_sb(mi_cols) >> MI_BLOCK_SIZE_LOG2; + const int sb64_cols = mi_cols_aligned_to_sb(mi_cols) >> MAX_MIB_SIZE_LOG2; *min_log2_tile_cols = get_min_log2_tile_cols(sb64_cols); *max_log2_tile_cols = get_max_log2_tile_cols(sb64_cols); assert(*min_log2_tile_cols <= *max_log2_tile_cols); diff --git a/vp10/decoder/decodeframe.c b/vp10/decoder/decodeframe.c index 2e49b3685..d530341e0 100644 --- a/vp10/decoder/decodeframe.c +++ b/vp10/decoder/decodeframe.c @@ -1094,7 +1094,8 @@ static void set_param_topblock(VP10_COMMON *const cm, MACROBLOCKD *const xd, } #if CONFIG_VAR_TX xd->above_txfm_context = cm->above_txfm_context + mi_col; - xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & MI_MASK); + xd->left_txfm_context = + xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK); set_txfm_ctx(xd->left_txfm_context, xd->mi[0]->mbmi.tx_size, bh); set_txfm_ctx(xd->above_txfm_context, xd->mi[0]->mbmi.tx_size, bw); #endif @@ -2014,7 +2015,8 @@ static INLINE int dec_partition_plane_context(const MACROBLOCKD *xd, int mi_row, int mi_col, int bsl) { const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col; - const PARTITION_CONTEXT *left_ctx = xd->left_seg_context + (mi_row & MI_MASK); + const PARTITION_CONTEXT *left_ctx = + xd->left_seg_context + (mi_row & MAX_MIB_MASK); int above = (*above_ctx >> bsl) & 1 , left = (*left_ctx >> bsl) & 1; // assert(bsl >= 0); @@ -2028,7 +2030,8 @@ static INLINE void dec_update_partition_context(MACROBLOCKD *xd, BLOCK_SIZE subsize, int bw) { PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col; - PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK); + PARTITION_CONTEXT *const left_ctx = + xd->left_seg_context + (mi_row & MAX_MIB_MASK); // update the partition context at the end notes. set partition bits // of block sizes larger than the current one to be one, and partition @@ -2902,8 +2905,8 @@ static void setup_tile_info(VP10Decoder *const pbi, cm->tile_width = vpx_rb_read_literal(rb, 6) + 1; // in [1, 64] cm->tile_height = vpx_rb_read_literal(rb, 6) + 1; // in [1, 64] - cm->tile_width = cm->tile_width << MI_BLOCK_SIZE_LOG2; - cm->tile_height = cm->tile_height << MI_BLOCK_SIZE_LOG2; + cm->tile_width = cm->tile_width << MAX_MIB_SIZE_LOG2; + cm->tile_height = cm->tile_height << MAX_MIB_SIZE_LOG2; cm->tile_width = VPXMIN(cm->tile_width, cm->mi_cols); cm->tile_height = VPXMIN(cm->tile_height, cm->mi_rows); @@ -3265,13 +3268,13 @@ static const uint8_t *decode_tiles(VP10Decoder *pbi, vp10_zero_above_context(cm, tile_info.mi_col_start, tile_info.mi_col_end); for (mi_row = tile_info.mi_row_start; mi_row < tile_info.mi_row_end; - mi_row += MI_BLOCK_SIZE) { + mi_row += MAX_MIB_SIZE) { int mi_col; vp10_zero_left_context(&td->xd); for (mi_col = tile_info.mi_col_start; mi_col < tile_info.mi_col_end; - mi_col += MI_BLOCK_SIZE) { + mi_col += MAX_MIB_SIZE) { decode_partition(pbi, &td->xd, #if CONFIG_SUPERTX 0, @@ -3307,8 +3310,8 @@ static const uint8_t *decode_tiles(VP10Decoder *pbi, // Loopfilter one tile row. if (cm->lf.filter_level && !cm->skip_loop_filter) { LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1; - const int lf_start = VPXMAX(0, tile_info.mi_row_start - MI_BLOCK_SIZE); - const int lf_end = tile_info.mi_row_end - MI_BLOCK_SIZE; + const int lf_start = VPXMAX(0, tile_info.mi_row_start - MAX_MIB_SIZE); + const int lf_end = tile_info.mi_row_end - MAX_MIB_SIZE; // Delay the loopfilter if the first tile row is only // a single superblock high. @@ -3332,7 +3335,7 @@ static const uint8_t *decode_tiles(VP10Decoder *pbi, // After loopfiltering, the last 7 row pixels in each superblock row may // still be changed by the longest loopfilter of the next superblock row. if (cm->frame_parallel_decode) - vp10_frameworker_broadcast(pbi->cur_buf, mi_row << MI_BLOCK_SIZE_LOG2); + vp10_frameworker_broadcast(pbi->cur_buf, mi_row << MAX_MIB_SIZE_LOG2); #endif // !CONFIG_VAR_TX } @@ -3382,11 +3385,11 @@ static int tile_worker_hook(TileWorkerData *const tile_data, vp10_zero_above_context(&pbi->common, tile->mi_col_start, tile->mi_col_end); for (mi_row = tile->mi_row_start; mi_row < tile->mi_row_end; - mi_row += MI_BLOCK_SIZE) { + mi_row += MAX_MIB_SIZE) { vp10_zero_left_context(&tile_data->xd); for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end; - mi_col += MI_BLOCK_SIZE) { + mi_col += MAX_MIB_SIZE) { decode_partition(pbi, &tile_data->xd, #if CONFIG_SUPERTX 0, diff --git a/vp10/decoder/decodemv.c b/vp10/decoder/decodemv.c index 8035e063d..7de3bfef1 100644 --- a/vp10/decoder/decodemv.c +++ b/vp10/decoder/decodemv.c @@ -232,8 +232,8 @@ static void read_tx_size_inter(VP10_COMMON *cm, MACROBLOCKD *xd, int ctx = txfm_partition_context(xd->above_txfm_context + tx_col, xd->left_txfm_context + tx_row, tx_size); - TX_SIZE (*const inter_tx_size)[MI_BLOCK_SIZE] = - (TX_SIZE (*)[MI_BLOCK_SIZE])&mbmi->inter_tx_size[tx_row][tx_col]; + TX_SIZE (*const inter_tx_size)[MAX_MIB_SIZE] = + (TX_SIZE (*)[MAX_MIB_SIZE])&mbmi->inter_tx_size[tx_row][tx_col]; if (xd->mb_to_bottom_edge < 0) max_blocks_high += xd->mb_to_bottom_edge >> 5; @@ -1157,7 +1157,7 @@ static int read_is_inter_block(VP10_COMMON *const cm, MACROBLOCKD *const xd, static void fpm_sync(void *const data, int mi_row) { VP10Decoder *const pbi = (VP10Decoder *)data; vp10_frameworker_wait(pbi->frame_worker_owner, pbi->common.prev_frame, - mi_row << MI_BLOCK_SIZE_LOG2); + mi_row << MAX_MIB_SIZE_LOG2); } static void read_inter_block_mode_info(VP10Decoder *const pbi, @@ -1592,7 +1592,8 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi, #if CONFIG_VAR_TX xd->above_txfm_context = cm->above_txfm_context + mi_col; - xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & MI_MASK); + xd->left_txfm_context = + xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK); if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT && !mbmi->skip && inter_block) { const TX_SIZE max_tx_size = max_txsize_lookup[bsize]; diff --git a/vp10/encoder/aq_cyclicrefresh.c b/vp10/encoder/aq_cyclicrefresh.c index defb97401..dd98f3abd 100644 --- a/vp10/encoder/aq_cyclicrefresh.c +++ b/vp10/encoder/aq_cyclicrefresh.c @@ -388,8 +388,8 @@ static void cyclic_refresh_update_map(VP10_COMP *const cpi) { int i, block_count, bl_index, sb_rows, sb_cols, sbs_in_frame; int xmis, ymis, x, y; memset(seg_map, CR_SEGMENT_ID_BASE, cm->mi_rows * cm->mi_cols); - sb_cols = (cm->mi_cols + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE; - sb_rows = (cm->mi_rows + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE; + sb_cols = (cm->mi_cols + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE; + sb_rows = (cm->mi_rows + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE; sbs_in_frame = sb_cols * sb_rows; // Number of target blocks to get the q delta (segment 1). block_count = cr->percent_refresh * cm->mi_rows * cm->mi_cols / 100; @@ -404,8 +404,8 @@ static void cyclic_refresh_update_map(VP10_COMP *const cpi) { // Get the mi_row/mi_col corresponding to superblock index i. int sb_row_index = (i / sb_cols); int sb_col_index = i - sb_row_index * sb_cols; - int mi_row = sb_row_index * MI_BLOCK_SIZE; - int mi_col = sb_col_index * MI_BLOCK_SIZE; + int mi_row = sb_row_index * MAX_MIB_SIZE; + int mi_col = sb_col_index * MAX_MIB_SIZE; int qindex_thresh = cpi->oxcf.content == VP9E_CONTENT_SCREEN ? vp10_get_qindex(&cm->seg, CR_SEGMENT_ID_BOOST2, cm->base_qindex) diff --git a/vp10/encoder/bitstream.c b/vp10/encoder/bitstream.c index 85a930590..f11240099 100644 --- a/vp10/encoder/bitstream.c +++ b/vp10/encoder/bitstream.c @@ -1514,7 +1514,8 @@ static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile, } else { #if CONFIG_VAR_TX xd->above_txfm_context = cm->above_txfm_context + mi_col; - xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & MI_MASK); + xd->left_txfm_context = + xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK); #endif pack_inter_mode_mvs(cpi, m, #if CONFIG_SUPERTX @@ -1852,10 +1853,10 @@ static void write_modes(VP10_COMP *const cpi, vp10_zero_above_context(cm, mi_col_start, mi_col_end); - for (mi_row = mi_row_start; mi_row < mi_row_end; mi_row += MI_BLOCK_SIZE) { + for (mi_row = mi_row_start; mi_row < mi_row_end; mi_row += MAX_MIB_SIZE) { vp10_zero_left_context(xd); - for (mi_col = mi_col_start; mi_col < mi_col_end; mi_col += MI_BLOCK_SIZE) { + for (mi_col = mi_col_start; mi_col < mi_col_end; mi_col += MAX_MIB_SIZE) { write_modes_sb_wrapper(cpi, tile, w, ans, tok, tok_end, 0, mi_row, mi_col, BLOCK_LARGEST); } @@ -2551,9 +2552,9 @@ static void write_tile_info(VP10_COMMON *const cm, #if CONFIG_EXT_TILE // TODO(geza.lore): Dependent on CU_SIZE const int tile_width = - mi_cols_aligned_to_sb(cm->tile_width) >> MI_BLOCK_SIZE_LOG2; + mi_cols_aligned_to_sb(cm->tile_width) >> MAX_MIB_SIZE_LOG2; const int tile_height = - mi_cols_aligned_to_sb(cm->tile_height) >> MI_BLOCK_SIZE_LOG2; + mi_cols_aligned_to_sb(cm->tile_height) >> MAX_MIB_SIZE_LOG2; assert(tile_width > 0 && tile_width <= 64); assert(tile_height > 0 && tile_height <= 64); diff --git a/vp10/encoder/block.h b/vp10/encoder/block.h index b5e61d99e..d6b156368 100644 --- a/vp10/encoder/block.h +++ b/vp10/encoder/block.h @@ -140,11 +140,11 @@ struct macroblock { // Notes transform blocks where no coefficents are coded. // Set during mode selection. Read during block encoding. - uint8_t zcoeff_blk[TX_SIZES][MI_BLOCK_SIZE * MI_BLOCK_SIZE * 4]; + uint8_t zcoeff_blk[TX_SIZES][MAX_MIB_SIZE * MAX_MIB_SIZE * 4]; #if CONFIG_VAR_TX - uint8_t blk_skip[MAX_MB_PLANE][MI_BLOCK_SIZE * MI_BLOCK_SIZE * 4]; + uint8_t blk_skip[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 4]; #if CONFIG_REF_MV - uint8_t blk_skip_drl[MAX_MB_PLANE][MI_BLOCK_SIZE * MI_BLOCK_SIZE * 4]; + uint8_t blk_skip_drl[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 4]; #endif #endif diff --git a/vp10/encoder/encodeframe.c b/vp10/encoder/encodeframe.c index b73f66cce..7da58eee0 100644 --- a/vp10/encoder/encodeframe.c +++ b/vp10/encoder/encodeframe.c @@ -276,7 +276,8 @@ static void set_offsets(VP10_COMP *cpi, const TileInfo *const tile, #if CONFIG_VAR_TX xd->above_txfm_context = cm->above_txfm_context + mi_col; - xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & MI_MASK); + xd->left_txfm_context = + xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK); xd->max_tx_size = max_txsize_lookup[bsize]; #endif @@ -2146,15 +2147,15 @@ static void update_stats(VP10_COMMON *cm, ThreadData *td } typedef struct { - ENTROPY_CONTEXT a[2 * MI_BLOCK_SIZE * MAX_MB_PLANE]; - ENTROPY_CONTEXT l[2 * MI_BLOCK_SIZE * MAX_MB_PLANE]; - PARTITION_CONTEXT sa[MI_BLOCK_SIZE]; - PARTITION_CONTEXT sl[MI_BLOCK_SIZE]; + ENTROPY_CONTEXT a[2 * MAX_MIB_SIZE * MAX_MB_PLANE]; + ENTROPY_CONTEXT l[2 * MAX_MIB_SIZE * MAX_MB_PLANE]; + PARTITION_CONTEXT sa[MAX_MIB_SIZE]; + PARTITION_CONTEXT sl[MAX_MIB_SIZE]; #if CONFIG_VAR_TX TXFM_CONTEXT *p_ta; TXFM_CONTEXT *p_tl; - TXFM_CONTEXT ta[MI_BLOCK_SIZE]; - TXFM_CONTEXT tl[MI_BLOCK_SIZE]; + TXFM_CONTEXT ta[MAX_MIB_SIZE]; + TXFM_CONTEXT tl[MAX_MIB_SIZE]; #endif } RD_SEARCH_MACROBLOCK_CONTEXT; @@ -2175,14 +2176,14 @@ static void restore_context(MACROBLOCK *x, xd->plane[p].subsampling_x); memcpy( xd->left_context[p] - + ((mi_row & MI_MASK) * 2 >> xd->plane[p].subsampling_y), + + ((mi_row & MAX_MIB_MASK) * 2 >> xd->plane[p].subsampling_y), ctx->l + num_4x4_blocks_high * p, (sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_high) >> xd->plane[p].subsampling_y); } memcpy(xd->above_seg_context + mi_col, ctx->sa, sizeof(*xd->above_seg_context) * mi_width); - memcpy(xd->left_seg_context + (mi_row & MI_MASK), ctx->sl, + memcpy(xd->left_seg_context + (mi_row & MAX_MIB_MASK), ctx->sl, sizeof(xd->left_seg_context[0]) * mi_height); #if CONFIG_VAR_TX xd->above_txfm_context = ctx->p_ta; @@ -2214,13 +2215,13 @@ static void save_context(const MACROBLOCK *x, memcpy( ctx->l + num_4x4_blocks_high * p, xd->left_context[p] - + ((mi_row & MI_MASK) * 2 >> xd->plane[p].subsampling_y), + + ((mi_row & MAX_MIB_MASK) * 2 >> xd->plane[p].subsampling_y), (sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_high) >> xd->plane[p].subsampling_y); } memcpy(ctx->sa, xd->above_seg_context + mi_col, sizeof(*xd->above_seg_context) * mi_width); - memcpy(ctx->sl, xd->left_seg_context + (mi_row & MI_MASK), + memcpy(ctx->sl, xd->left_seg_context + (mi_row & MAX_MIB_MASK), sizeof(xd->left_seg_context[0]) * mi_height); #if CONFIG_VAR_TX memcpy(ctx->ta, xd->above_txfm_context, @@ -2518,9 +2519,9 @@ static void set_partial_b64x64_partition(MODE_INFO *mi, int mis, BLOCK_SIZE bsize, MODE_INFO **mi_8x8) { int bh = bh_in; int r, c; - for (r = 0; r < MI_BLOCK_SIZE; r += bh) { + for (r = 0; r < MAX_MIB_SIZE; r += bh) { int bw = bw_in; - for (c = 0; c < MI_BLOCK_SIZE; c += bw) { + for (c = 0; c < MAX_MIB_SIZE; c += bw) { const int index = r * mis + c; mi_8x8[index] = mi + index; mi_8x8[index]->mbmi.sb_type = find_partition_size(bsize, @@ -2549,10 +2550,10 @@ static void set_fixed_partitioning(VP10_COMP *cpi, const TileInfo *const tile, assert((row8x8_remaining > 0) && (col8x8_remaining > 0)); // Apply the requested partition size to the SB64 if it is all "in image" - if ((col8x8_remaining >= MI_BLOCK_SIZE) && - (row8x8_remaining >= MI_BLOCK_SIZE)) { - for (block_row = 0; block_row < MI_BLOCK_SIZE; block_row += bh) { - for (block_col = 0; block_col < MI_BLOCK_SIZE; block_col += bw) { + if ((col8x8_remaining >= MAX_MIB_SIZE) && + (row8x8_remaining >= MAX_MIB_SIZE)) { + for (block_row = 0; block_row < MAX_MIB_SIZE; block_row += bh) { + for (block_col = 0; block_col < MAX_MIB_SIZE; block_col += bw) { int index = block_row * mis + block_col; mi_8x8[index] = mi_upper_left + index; mi_8x8[index]->mbmi.sb_type = bsize; @@ -2621,7 +2622,8 @@ static void rd_use_partition(VP10_COMP *cpi, #if CONFIG_VAR_TX xd->above_txfm_context = cm->above_txfm_context + mi_col; - xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & MI_MASK); + xd->left_txfm_context = + xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK); #endif save_context(x, &x_ctx, mi_row, mi_col, bsize); @@ -3013,8 +3015,8 @@ static void get_sb_partition_size_range(MACROBLOCKD *xd, MODE_INFO **mi_8x8, BLOCK_SIZE *min_block_size, BLOCK_SIZE *max_block_size, int bs_hist[BLOCK_SIZES]) { - int sb_width_in_blocks = MI_BLOCK_SIZE; - int sb_height_in_blocks = MI_BLOCK_SIZE; + int sb_width_in_blocks = MAX_MIB_SIZE; + int sb_height_in_blocks = MAX_MIB_SIZE; int i, j; int index = 0; @@ -3065,13 +3067,13 @@ static void rd_auto_partition_range(VP10_COMP *cpi, const TileInfo *const tile, } // Find the min and max partition sizes used in the left SB64 if (left_in_image) { - MODE_INFO **left_sb64_mi = &mi[-MI_BLOCK_SIZE]; + MODE_INFO **left_sb64_mi = &mi[-MAX_MIB_SIZE]; get_sb_partition_size_range(xd, left_sb64_mi, &min_size, &max_size, bs_hist); } // Find the min and max partition sizes used in the above SB64. if (above_in_image) { - MODE_INFO **above_sb64_mi = &mi[-xd->mi_stride * MI_BLOCK_SIZE]; + MODE_INFO **above_sb64_mi = &mi[-xd->mi_stride * MAX_MIB_SIZE]; get_sb_partition_size_range(xd, above_sb64_mi, &min_size, &max_size, bs_hist); } @@ -3508,7 +3510,8 @@ static void rd_pick_partition(VP10_COMP *cpi, ThreadData *td, #if CONFIG_VAR_TX xd->above_txfm_context = cm->above_txfm_context + mi_col; - xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & MI_MASK); + xd->left_txfm_context = + xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK); #endif save_context(x, &x_ctx, mi_row, mi_col, bsize); @@ -4239,7 +4242,7 @@ static void encode_rd_sb_row(VP10_COMP *cpi, // Code each SB in the row for (mi_col = tile_info->mi_col_start; mi_col < tile_info->mi_col_end; - mi_col += MI_BLOCK_SIZE) { + mi_col += MAX_MIB_SIZE) { const struct segmentation *const seg = &cm->seg; int dummy_rate; int64_t dummy_dist; @@ -4476,7 +4479,7 @@ void vp10_encode_tile(VP10_COMP *cpi, ThreadData *td, td->mb.ex_search_count_ptr = &td->rd_counts.ex_search_count; for (mi_row = tile_info->mi_row_start; mi_row < tile_info->mi_row_end; - mi_row += MI_BLOCK_SIZE) { + mi_row += MAX_MIB_SIZE) { encode_rd_sb_row(cpi, td, this_tile, mi_row, &tok); } @@ -4848,7 +4851,8 @@ static void tx_partition_count_update(VP10_COMMON *cm, int idx, idy; xd->above_txfm_context = cm->above_txfm_context + mi_col; - xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & MI_MASK); + xd->left_txfm_context = + xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK); for (idy = 0; idy < mi_height; idy += bh) for (idx = 0; idx < mi_width; idx += bh) @@ -4913,7 +4917,8 @@ static void tx_partition_set_contexts(VP10_COMMON *cm, int idx, idy; xd->above_txfm_context = cm->above_txfm_context + mi_col; - xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & MI_MASK); + xd->left_txfm_context = + xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK); for (idy = 0; idy < mi_height; idy += bh) for (idx = 0; idx < mi_width; idx += bh) @@ -6112,8 +6117,8 @@ static void rd_supertx_sb(VP10_COMP *cpi, ThreadData *td, sse_uv = 0; for (plane = 1; plane < MAX_MB_PLANE; ++plane) { #if CONFIG_VAR_TX - ENTROPY_CONTEXT ctxa[2 * MI_BLOCK_SIZE]; - ENTROPY_CONTEXT ctxl[2 * MI_BLOCK_SIZE]; + ENTROPY_CONTEXT ctxa[2 * MAX_MIB_SIZE]; + ENTROPY_CONTEXT ctxl[2 * MAX_MIB_SIZE]; const struct macroblockd_plane *const pd = &xd->plane[plane]; int coeff_ctx = 1; @@ -6157,8 +6162,8 @@ static void rd_supertx_sb(VP10_COMP *cpi, ThreadData *td, #endif // CONFIG_EXT_TX for (tx_type = DCT_DCT; tx_type < TX_TYPES; ++tx_type) { #if CONFIG_VAR_TX - ENTROPY_CONTEXT ctxa[2 * MI_BLOCK_SIZE]; - ENTROPY_CONTEXT ctxl[2 * MI_BLOCK_SIZE]; + ENTROPY_CONTEXT ctxa[2 * MAX_MIB_SIZE]; + ENTROPY_CONTEXT ctxl[2 * MAX_MIB_SIZE]; const struct macroblockd_plane *const pd = &xd->plane[0]; int coeff_ctx = 1; #endif // CONFIG_VAR_TX diff --git a/vp10/encoder/encodemb.c b/vp10/encoder/encodemb.c index 429ac4f5b..10e97cbc3 100644 --- a/vp10/encoder/encodemb.c +++ b/vp10/encoder/encodemb.c @@ -29,8 +29,8 @@ #include "vp10/encoder/tokenize.h" struct optimize_ctx { - ENTROPY_CONTEXT ta[MAX_MB_PLANE][2 * MI_BLOCK_SIZE]; - ENTROPY_CONTEXT tl[MAX_MB_PLANE][2 * MI_BLOCK_SIZE]; + ENTROPY_CONTEXT ta[MAX_MB_PLANE][2 * MAX_MIB_SIZE]; + ENTROPY_CONTEXT tl[MAX_MB_PLANE][2 * MAX_MIB_SIZE]; }; void vp10_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { diff --git a/vp10/encoder/encoder.c b/vp10/encoder/encoder.c index 77af3ddcd..5af0684d9 100644 --- a/vp10/encoder/encoder.c +++ b/vp10/encoder/encoder.c @@ -789,8 +789,8 @@ void vp10_new_framerate(VP10_COMP *cpi, double framerate) { static void set_tile_limits(VP10_COMP *cpi) { VP10_COMMON *const cm = &cpi->common; #if CONFIG_EXT_TILE - cm->tile_width = clamp(cpi->oxcf.tile_columns, 1, 64) << MI_BLOCK_SIZE_LOG2; - cm->tile_height = clamp(cpi->oxcf.tile_rows, 1, 64) << MI_BLOCK_SIZE_LOG2; + cm->tile_width = clamp(cpi->oxcf.tile_columns, 1, 64) << MAX_MIB_SIZE_LOG2; + cm->tile_height = clamp(cpi->oxcf.tile_rows, 1, 64) << MAX_MIB_SIZE_LOG2; cm->tile_width = VPXMIN(cm->tile_width, cm->mi_cols); cm->tile_height = VPXMIN(cm->tile_height, cm->mi_rows); diff --git a/vp10/encoder/rd.c b/vp10/encoder/rd.c index 203ac4213..be3a3e71a 100644 --- a/vp10/encoder/rd.c +++ b/vp10/encoder/rd.c @@ -563,8 +563,8 @@ void vp10_model_rd_from_var_lapndz(unsigned int var, unsigned int n_log2, void vp10_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size, const struct macroblockd_plane *pd, - ENTROPY_CONTEXT t_above[2 * MI_BLOCK_SIZE], - ENTROPY_CONTEXT t_left[2 * MI_BLOCK_SIZE]) { + ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE], + ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]) { const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd); const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize]; const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize]; diff --git a/vp10/encoder/rd.h b/vp10/encoder/rd.h index 533e7751c..10be9dfbe 100644 --- a/vp10/encoder/rd.h +++ b/vp10/encoder/rd.h @@ -330,8 +330,8 @@ void vp10_set_mvcost(MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame); void vp10_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size, const struct macroblockd_plane *pd, - ENTROPY_CONTEXT t_above[2 * MI_BLOCK_SIZE], - ENTROPY_CONTEXT t_left[2 * MI_BLOCK_SIZE]); + ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE], + ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]); void vp10_set_rd_speed_thresholds(struct VP10_COMP *cpi); diff --git a/vp10/encoder/rdopt.c b/vp10/encoder/rdopt.c index ef4389d2e..e5b049130 100644 --- a/vp10/encoder/rdopt.c +++ b/vp10/encoder/rdopt.c @@ -102,8 +102,8 @@ typedef struct { struct rdcost_block_args { const VP10_COMP *cpi; MACROBLOCK *x; - ENTROPY_CONTEXT t_above[2 * MI_BLOCK_SIZE]; - ENTROPY_CONTEXT t_left[2 * MI_BLOCK_SIZE]; + ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE]; + ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]; int this_rate; int64_t this_dist; int64_t this_sse; @@ -2957,8 +2957,8 @@ static void select_tx_block(const VP10_COMP *cpi, MACROBLOCK *x, struct macroblockd_plane *const pd = &xd->plane[plane]; const int tx_row = blk_row >> (1 - pd->subsampling_y); const int tx_col = blk_col >> (1 - pd->subsampling_x); - TX_SIZE (*const inter_tx_size)[MI_BLOCK_SIZE] = - (TX_SIZE (*)[MI_BLOCK_SIZE])&mbmi->inter_tx_size[tx_row][tx_col]; + TX_SIZE (*const inter_tx_size)[MAX_MIB_SIZE] = + (TX_SIZE (*)[MAX_MIB_SIZE])&mbmi->inter_tx_size[tx_row][tx_col]; int max_blocks_high = num_4x4_blocks_high_lookup[plane_bsize]; int max_blocks_wide = num_4x4_blocks_wide_lookup[plane_bsize]; int64_t this_rd = INT64_MAX; @@ -3128,10 +3128,10 @@ static void inter_block_yrd(const VP10_COMP *cpi, MACROBLOCK *x, int idx, idy; int block = 0; int step = 1 << (max_txsize_lookup[plane_bsize] * 2); - ENTROPY_CONTEXT ctxa[2 * MI_BLOCK_SIZE]; - ENTROPY_CONTEXT ctxl[2 * MI_BLOCK_SIZE]; - TXFM_CONTEXT tx_above[MI_BLOCK_SIZE]; - TXFM_CONTEXT tx_left[MI_BLOCK_SIZE]; + ENTROPY_CONTEXT ctxa[2 * MAX_MIB_SIZE]; + ENTROPY_CONTEXT ctxl[2 * MAX_MIB_SIZE]; + TXFM_CONTEXT tx_above[MAX_MIB_SIZE]; + TXFM_CONTEXT tx_left[MAX_MIB_SIZE]; int pnrate = 0, pnskip = 1; int64_t pndist = 0, pnsse = 0; @@ -3243,9 +3243,9 @@ static void select_tx_type_yrd(const VP10_COMP *cpi, MACROBLOCK *x, int64_t best_rd = INT64_MAX; TX_TYPE tx_type, best_tx_type = DCT_DCT; const int is_inter = is_inter_block(mbmi); - TX_SIZE best_tx_size[MI_BLOCK_SIZE][MI_BLOCK_SIZE]; + TX_SIZE best_tx_size[MAX_MIB_SIZE][MAX_MIB_SIZE]; TX_SIZE best_tx = TX_SIZES; - uint8_t best_blk_skip[MI_BLOCK_SIZE * MI_BLOCK_SIZE * 4]; + uint8_t best_blk_skip[MAX_MIB_SIZE * MAX_MIB_SIZE * 4]; const int n4 = 1 << (num_pels_log2_lookup[bsize] - 4); int idx, idy; int prune = 0; @@ -3428,8 +3428,8 @@ static int inter_block_uvrd(const VP10_COMP *cpi, MACROBLOCK *x, int step = 1 << (max_txsize_lookup[plane_bsize] * 2); int pnrate = 0, pnskip = 1; int64_t pndist = 0, pnsse = 0; - ENTROPY_CONTEXT ta[2 * MI_BLOCK_SIZE]; - ENTROPY_CONTEXT tl[2 * MI_BLOCK_SIZE]; + ENTROPY_CONTEXT ta[2 * MAX_MIB_SIZE]; + ENTROPY_CONTEXT tl[2 * MAX_MIB_SIZE]; vp10_get_entropy_contexts(bsize, TX_4X4, pd, ta, tl); @@ -6234,7 +6234,7 @@ static int64_t handle_inter_mode(VP10_COMP *cpi, MACROBLOCK *x, int best_rate_y, best_rate_uv; #endif // CONFIG_SUPERTX #if CONFIG_VAR_TX - uint8_t best_blk_skip[MAX_MB_PLANE][MI_BLOCK_SIZE * MI_BLOCK_SIZE * 4]; + uint8_t best_blk_skip[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 4]; #endif // CONFIG_VAR_TX int64_t best_distortion = INT64_MAX; unsigned int best_pred_var = UINT_MAX; @@ -7445,8 +7445,8 @@ int vp10_active_v_edge(VP10_COMP *cpi, int mi_col, int mi_step) { // bars embedded in the stream. int vp10_active_edge_sb(VP10_COMP *cpi, int mi_row, int mi_col) { - return vp10_active_h_edge(cpi, mi_row, MI_BLOCK_SIZE) || - vp10_active_v_edge(cpi, mi_col, MI_BLOCK_SIZE); + return vp10_active_h_edge(cpi, mi_row, MAX_MIB_SIZE) || + vp10_active_v_edge(cpi, mi_col, MAX_MIB_SIZE); } static void restore_uv_color_map(VP10_COMP *cpi, MACROBLOCK *x) { diff --git a/vp10/encoder/segmentation.c b/vp10/encoder/segmentation.c index f71946785..e7f746f3d 100644 --- a/vp10/encoder/segmentation.c +++ b/vp10/encoder/segmentation.c @@ -328,10 +328,10 @@ void vp10_choose_segmap_coding_method(VP10_COMMON *cm, MACROBLOCKD *xd) { mi_ptr = cm->mi_grid_visible + tile_info.mi_row_start * cm->mi_stride + tile_info.mi_col_start; for (mi_row = tile_info.mi_row_start; mi_row < tile_info.mi_row_end; - mi_row += MI_BLOCK_SIZE, mi_ptr += MI_BLOCK_SIZE * cm->mi_stride) { + mi_row += MAX_MIB_SIZE, mi_ptr += MAX_MIB_SIZE * cm->mi_stride) { MODE_INFO **mi = mi_ptr; for (mi_col = tile_info.mi_col_start; mi_col < tile_info.mi_col_end; - mi_col += MI_BLOCK_SIZE, mi += MI_BLOCK_SIZE) { + mi_col += MAX_MIB_SIZE, mi += MAX_MIB_SIZE) { count_segs_sb(cm, xd, &tile_info, mi, no_pred_segcounts, temporal_predictor_count, t_unpred_seg_counts, mi_row, mi_col, BLOCK_LARGEST); From 10232eda8e9bfb4c4cd9cfc295b1e8ae61721559 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Thu, 31 Mar 2016 15:52:12 +0100 Subject: [PATCH 2/2] Refactor loopfilter level arrays to 2D. Change-Id: Id20526d0b6d1371dc9f45cb8b5f24b6974da7bc4 --- vp10/common/loopfilter.c | 55 ++++++++++++++++++---------------------- vp10/common/loopfilter.h | 4 +-- 2 files changed, 26 insertions(+), 33 deletions(-) diff --git a/vp10/common/loopfilter.c b/vp10/common/loopfilter.c index 41db54f1c..23fd6a60f 100644 --- a/vp10/common/loopfilter.c +++ b/vp10/common/loopfilter.c @@ -731,10 +731,8 @@ static void build_masks(const loop_filter_info_n *const lfi_n, } else { const int w = num_8x8_blocks_wide_lookup[block_size]; const int h = num_8x8_blocks_high_lookup[block_size]; - int index = shift_y; for (i = 0; i < h; i++) { - memset(&lfm->lfl_y[index], filter_level, w); - index += 8; + memset(&lfm->lfl_y[i][shift_y], filter_level, w); } } @@ -813,10 +811,8 @@ static void build_y_mask(const loop_filter_info_n *const lfi_n, } else { const int w = num_8x8_blocks_wide_lookup[block_size]; const int h = num_8x8_blocks_high_lookup[block_size]; - int index = shift_y; for (i = 0; i < h; i++) { - memset(&lfm->lfl_y[index], filter_level, w); - index += 8; + memset(&lfm->lfl_y[i][shift_y], filter_level, w); } } @@ -1223,7 +1219,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, unsigned int mask_8x8[MAX_MIB_SIZE] = {0}; unsigned int mask_4x4[MAX_MIB_SIZE] = {0}; unsigned int mask_4x4_int[MAX_MIB_SIZE] = {0}; - uint8_t lfl[MAX_MIB_SIZE * MAX_MIB_SIZE]; + uint8_t lfl[MAX_MIB_SIZE][MAX_MIB_SIZE]; int r, c; for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r += row_step) { @@ -1267,8 +1263,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, int tx_size_mask = 0; // Filter level can vary per MI - if (!(lfl[(r << MAX_MIB_SIZE_LOG2) + (c >> ss_x)] = - get_filter_level(&cm->lf_info, mbmi))) + if (!(lfl[r][c >> ss_x] = get_filter_level(&cm->lf_info, mbmi))) continue; if (tx_size == TX_32X32) @@ -1365,7 +1360,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, mask_8x8_c & border_mask, mask_4x4_c & border_mask, mask_4x4_int[r], - &cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2], + &cm->lf_info, &lfl[r][0], (int)cm->bit_depth); } else { filter_selectively_vert(dst->buf, dst->stride, @@ -1373,7 +1368,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, mask_8x8_c & border_mask, mask_4x4_c & border_mask, mask_4x4_int[r], - &cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2]); + &cm->lf_info, &lfl[r][0]); } #else filter_selectively_vert(dst->buf, dst->stride, @@ -1381,7 +1376,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, mask_8x8_c & border_mask, mask_4x4_c & border_mask, mask_4x4_int[r], - &cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2]); + &cm->lf_info, &lfl[r][0]); #endif // CONFIG_VP9_HIGHBITDEPTH dst->buf += 8 * dst->stride; mi_8x8 += row_step_stride; @@ -1415,7 +1410,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, mask_8x8_r, mask_4x4_r, mask_4x4_int_r, - &cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2], + &cm->lf_info, &lfl[r][0], (int)cm->bit_depth); } else { filter_selectively_horiz(dst->buf, dst->stride, @@ -1423,7 +1418,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, mask_8x8_r, mask_4x4_r, mask_4x4_int_r, - &cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2]); + &cm->lf_info, &lfl[r][0]); } #else filter_selectively_horiz(dst->buf, dst->stride, @@ -1431,7 +1426,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm, mask_8x8_r, mask_4x4_r, mask_4x4_int_r, - &cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2]); + &cm->lf_info, &lfl[r][0]); #endif // CONFIG_VP9_HIGHBITDEPTH dst->buf += 8 * dst->stride; } @@ -1464,18 +1459,18 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm, highbd_filter_selectively_vert_row2( plane->subsampling_x, CONVERT_TO_SHORTPTR(dst->buf), dst->stride, mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info, - &lfm->lfl_y[r << MAX_MIB_SIZE_LOG2], (int)cm->bit_depth); + &lfm->lfl_y[r][0], (int)cm->bit_depth); } else { filter_selectively_vert_row2( plane->subsampling_x, dst->buf, dst->stride, mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info, - &lfm->lfl_y[r << MAX_MIB_SIZE_LOG2]); + &lfm->lfl_y[r][0]); } #else filter_selectively_vert_row2( plane->subsampling_x, dst->buf, dst->stride, mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info, - &lfm->lfl_y[r << MAX_MIB_SIZE_LOG2]); + &lfm->lfl_y[r][0]); #endif // CONFIG_VP9_HIGHBITDEPTH dst->buf += 16 * dst->stride; mask_16x16 >>= 16; @@ -1511,17 +1506,17 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm, highbd_filter_selectively_horiz( CONVERT_TO_SHORTPTR(dst->buf), dst->stride, mask_16x16_r, mask_8x8_r, mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info, - &lfm->lfl_y[r << MAX_MIB_SIZE_LOG2], + &lfm->lfl_y[r][0], (int)cm->bit_depth); } else { filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r, mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info, - &lfm->lfl_y[r << MAX_MIB_SIZE_LOG2]); + &lfm->lfl_y[r][0]); } #else filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r, mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info, - &lfm->lfl_y[r << MAX_MIB_SIZE_LOG2]); + &lfm->lfl_y[r][0]); #endif // CONFIG_VP9_HIGHBITDEPTH dst->buf += 8 * dst->stride; @@ -1551,10 +1546,8 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm, for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r += 4) { if (plane->plane_type == 1) { for (c = 0; c < (MAX_MIB_SIZE >> 1); c++) { - lfm->lfl_uv[(r << 1) + c] = - lfm->lfl_y[(r << MAX_MIB_SIZE_LOG2) + (c << 1)]; - lfm->lfl_uv[((r + 2) << 1) + c] = - lfm->lfl_y[((r + 2) << MAX_MIB_SIZE_LOG2) + (c << 1)]; + lfm->lfl_uv[r][c] = lfm->lfl_y[r][c << 1]; + lfm->lfl_uv[r + 2][c] = lfm->lfl_y[r + 2][c << 1]; } } @@ -1570,18 +1563,18 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm, highbd_filter_selectively_vert_row2( plane->subsampling_x, CONVERT_TO_SHORTPTR(dst->buf), dst->stride, mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info, - &lfm->lfl_uv[r << 1], (int)cm->bit_depth); + &lfm->lfl_uv[r][0], (int)cm->bit_depth); } else { filter_selectively_vert_row2( plane->subsampling_x, dst->buf, dst->stride, mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info, - &lfm->lfl_uv[r << 1]); + &lfm->lfl_uv[r][0]); } #else filter_selectively_vert_row2( plane->subsampling_x, dst->buf, dst->stride, mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info, - &lfm->lfl_uv[r << 1]); + &lfm->lfl_uv[r][0]); #endif // CONFIG_VP9_HIGHBITDEPTH dst->buf += 16 * dst->stride; @@ -1622,16 +1615,16 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm, highbd_filter_selectively_horiz(CONVERT_TO_SHORTPTR(dst->buf), dst->stride, mask_16x16_r, mask_8x8_r, mask_4x4_r, mask_4x4_int_r, &cm->lf_info, - &lfm->lfl_uv[r << 1], (int)cm->bit_depth); + &lfm->lfl_uv[r][0], (int)cm->bit_depth); } else { filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r, mask_4x4_r, mask_4x4_int_r, &cm->lf_info, - &lfm->lfl_uv[r << 1]); + &lfm->lfl_uv[r][0]); } #else filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r, mask_4x4_r, mask_4x4_int_r, &cm->lf_info, - &lfm->lfl_uv[r << 1]); + &lfm->lfl_uv[r][0]); #endif // CONFIG_VP9_HIGHBITDEPTH dst->buf += 8 * dst->stride; diff --git a/vp10/common/loopfilter.h b/vp10/common/loopfilter.h index 706d9f67e..2a8800327 100644 --- a/vp10/common/loopfilter.h +++ b/vp10/common/loopfilter.h @@ -84,8 +84,8 @@ typedef struct { uint16_t above_uv[TX_SIZES]; uint16_t left_int_4x4_uv; uint16_t above_int_4x4_uv; - uint8_t lfl_y[MAX_MIB_SIZE * MAX_MIB_SIZE]; - uint8_t lfl_uv[MAX_MIB_SIZE / 2 * MAX_MIB_SIZE / 2]; + uint8_t lfl_y[MAX_MIB_SIZE][MAX_MIB_SIZE]; + uint8_t lfl_uv[MAX_MIB_SIZE / 2][MAX_MIB_SIZE / 2]; } LOOP_FILTER_MASK; /* assorted loopfilter functions which get used elsewhere */