Commit de9089f5 authored by Yaowu Xu's avatar Yaowu Xu

Rename MI_BLOCK_SIZE and MI_MASK macros

Cherry picked from libvpx: 511da8cb

Change-Id: I4f4132235495adcd445690d8f060f607b755cacd
parent 6885324b
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
#include "aom_dsp/aom_dsp_common.h" #include "aom_dsp/aom_dsp_common.h"
int av1_clpf_maxbits(const AV1_COMMON *cm) { int av1_clpf_maxbits(const AV1_COMMON *cm) {
return get_msb(ALIGN_POWER_OF_TWO(cm->mi_cols * MI_BLOCK_SIZE, return get_msb(ALIGN_POWER_OF_TWO(cm->mi_cols * MAX_MIB_SIZE,
cm->clpf_size + 4) * cm->clpf_size + 4) *
ALIGN_POWER_OF_TWO(cm->mi_rows * MI_BLOCK_SIZE, ALIGN_POWER_OF_TWO(cm->mi_rows * MAX_MIB_SIZE,
cm->clpf_size + 4) >> cm->clpf_size + 4) >>
(cm->clpf_size * 2 + 8)) + (cm->clpf_size * 2 + 8)) +
1; 1;
...@@ -63,7 +63,7 @@ int av1_clpf_frame(const YV12_BUFFER_CONFIG *dst, const YV12_BUFFER_CONFIG *rec, ...@@ -63,7 +63,7 @@ int av1_clpf_frame(const YV12_BUFFER_CONFIG *dst, const YV12_BUFFER_CONFIG *rec,
int xpos, ypos; int xpos, ypos;
int stride_y = rec->y_stride; int stride_y = rec->y_stride;
int stride_c = rec->uv_stride; int stride_c = rec->uv_stride;
const int bs = MI_BLOCK_SIZE; const int bs = MAX_MIB_SIZE;
int num_fb_hor = (width + (1 << fb_size_log2) - bs) >> fb_size_log2; int num_fb_hor = (width + (1 << fb_size_log2) - bs) >> fb_size_log2;
int num_fb_ver = (height + (1 << fb_size_log2) - bs) >> fb_size_log2; int num_fb_ver = (height + (1 << fb_size_log2) - bs) >> fb_size_log2;
int block_index = 0; int block_index = 0;
......
...@@ -33,8 +33,8 @@ int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col) { ...@@ -33,8 +33,8 @@ int sb_all_skip(const AV1_COMMON *const cm, int mi_row, int mi_col) {
int skip = 1; int skip = 1;
maxc = cm->mi_cols - mi_col; maxc = cm->mi_cols - mi_col;
maxr = cm->mi_rows - mi_row; maxr = cm->mi_rows - mi_row;
if (maxr > MI_BLOCK_SIZE) maxr = MI_BLOCK_SIZE; if (maxr > MAX_MIB_SIZE) maxr = MAX_MIB_SIZE;
if (maxc > MI_BLOCK_SIZE) maxc = MI_BLOCK_SIZE; if (maxc > MAX_MIB_SIZE) maxc = MAX_MIB_SIZE;
for (r = 0; r < maxr; r++) { for (r = 0; r < maxr; r++) {
for (c = 0; c < maxc; c++) { for (c = 0; c < maxc; c++) {
skip = skip && skip = skip &&
...@@ -58,8 +58,8 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, ...@@ -58,8 +58,8 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
int dec[3]; int dec[3];
int pli; int pli;
int coeff_shift = AOMMAX(cm->bit_depth - 8, 0); int coeff_shift = AOMMAX(cm->bit_depth - 8, 0);
nvsb = (cm->mi_rows + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE; nvsb = (cm->mi_rows + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE;
nhsb = (cm->mi_cols + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE; nhsb = (cm->mi_cols + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE;
bskip = aom_malloc(sizeof(*bskip) * cm->mi_rows * cm->mi_cols); bskip = aom_malloc(sizeof(*bskip) * cm->mi_rows * cm->mi_cols);
av1_setup_dst_planes(xd->plane, frame, 0, 0); av1_setup_dst_planes(xd->plane, frame, 0, 0);
for (pli = 0; pli < 3; pli++) { for (pli = 0; pli < 3; pli++) {
...@@ -96,16 +96,16 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, ...@@ -96,16 +96,16 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
for (sbc = 0; sbc < nhsb; sbc++) { for (sbc = 0; sbc < nhsb; sbc++) {
int level; int level;
int nhb, nvb; int nhb, nvb;
nhb = AOMMIN(MI_BLOCK_SIZE, cm->mi_cols - MI_BLOCK_SIZE * sbc); nhb = AOMMIN(MAX_MIB_SIZE, cm->mi_cols - MAX_MIB_SIZE * sbc);
nvb = AOMMIN(MI_BLOCK_SIZE, cm->mi_rows - MI_BLOCK_SIZE * sbr); nvb = AOMMIN(MAX_MIB_SIZE, cm->mi_rows - MAX_MIB_SIZE * sbr);
for (pli = 0; pli < 3; pli++) { for (pli = 0; pli < 3; pli++) {
int16_t dst[MI_BLOCK_SIZE * MI_BLOCK_SIZE * 8 * 8]; int16_t dst[MAX_MIB_SIZE * MAX_MIB_SIZE * 8 * 8];
int threshold; int threshold;
#if DERING_REFINEMENT #if DERING_REFINEMENT
level = compute_level_from_index( level = compute_level_from_index(
global_level, global_level,
cm->mi_grid_visible[MI_BLOCK_SIZE * sbr * cm->mi_stride + cm->mi_grid_visible[MAX_MIB_SIZE * sbr * cm->mi_stride +
MI_BLOCK_SIZE * sbc] MAX_MIB_SIZE * sbc]
->mbmi.dering_gain); ->mbmi.dering_gain);
#else #else
level = global_level; level = global_level;
...@@ -113,31 +113,30 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, ...@@ -113,31 +113,30 @@ void av1_dering_frame(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
/* FIXME: This is a temporary hack that uses more conservative /* FIXME: This is a temporary hack that uses more conservative
deringing for chroma. */ deringing for chroma. */
if (pli) level = (level * 5 + 4) >> 3; if (pli) level = (level * 5 + 4) >> 3;
if (sb_all_skip(cm, sbr * MI_BLOCK_SIZE, sbc * MI_BLOCK_SIZE)) continue; if (sb_all_skip(cm, sbr * MAX_MIB_SIZE, sbc * MAX_MIB_SIZE)) continue;
threshold = level << coeff_shift; threshold = level << coeff_shift;
od_dering( od_dering(&OD_DERING_VTBL_C, dst, MAX_MIB_SIZE * bsize[pli],
&OD_DERING_VTBL_C, dst, MI_BLOCK_SIZE * bsize[pli], &src[pli][sbr * stride * bsize[pli] * MAX_MIB_SIZE +
&src[pli][sbr * stride * bsize[pli] * MI_BLOCK_SIZE + sbc * bsize[pli] * MAX_MIB_SIZE],
sbc * bsize[pli] * MI_BLOCK_SIZE], stride, nhb, nvb, sbc, sbr, nhsb, nvsb, dec[pli], dir, pli,
stride, nhb, nvb, sbc, sbr, nhsb, nvsb, dec[pli], dir, pli, &bskip[MAX_MIB_SIZE * sbr * cm->mi_cols + MAX_MIB_SIZE * sbc],
&bskip[MI_BLOCK_SIZE * sbr * cm->mi_cols + MI_BLOCK_SIZE * sbc], cm->mi_cols, threshold, OD_DERING_NO_CHECK_OVERLAP,
cm->mi_cols, threshold, OD_DERING_NO_CHECK_OVERLAP, coeff_shift); coeff_shift);
for (r = 0; r < bsize[pli] * nvb; ++r) { for (r = 0; r < bsize[pli] * nvb; ++r) {
for (c = 0; c < bsize[pli] * nhb; ++c) { for (c = 0; c < bsize[pli] * nhb; ++c) {
#if CONFIG_AOM_HIGHBITDEPTH #if CONFIG_AOM_HIGHBITDEPTH
if (cm->use_highbitdepth) { if (cm->use_highbitdepth) {
CONVERT_TO_SHORTPTR(xd->plane[pli].dst.buf) CONVERT_TO_SHORTPTR(xd->plane[pli].dst.buf)
[xd->plane[pli].dst.stride * [xd->plane[pli].dst.stride *
(bsize[pli] * MI_BLOCK_SIZE * sbr + r) + (bsize[pli] * MAX_MIB_SIZE * sbr + r) +
sbc * bsize[pli] * MI_BLOCK_SIZE + c] = sbc * bsize[pli] * MAX_MIB_SIZE + c] =
dst[r * MI_BLOCK_SIZE * bsize[pli] + c]; dst[r * MAX_MIB_SIZE * bsize[pli] + c];
} else { } else {
#endif #endif
xd->plane[pli] xd->plane[pli].dst.buf[xd->plane[pli].dst.stride *
.dst.buf[xd->plane[pli].dst.stride * (bsize[pli] * MAX_MIB_SIZE * sbr + r) +
(bsize[pli] * MI_BLOCK_SIZE * sbr + r) + sbc * bsize[pli] * MAX_MIB_SIZE + c] =
sbc * bsize[pli] * MI_BLOCK_SIZE + c] = dst[r * MAX_MIB_SIZE * bsize[pli] + c];
dst[r * MI_BLOCK_SIZE * bsize[pli] + c];
#if CONFIG_AOM_HIGHBITDEPTH #if CONFIG_AOM_HIGHBITDEPTH
} }
#endif #endif
......
...@@ -20,17 +20,22 @@ extern "C" { ...@@ -20,17 +20,22 @@ extern "C" {
#endif #endif
#undef MAX_SB_SIZE #undef MAX_SB_SIZE
// Pixels per max superblock size
#define MAX_SB_SIZE_LOG2 6 #define MAX_SB_SIZE_LOG2 6
#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 MAX_SB_SQUARE (MAX_SB_SIZE * MAX_SB_SIZE)
// Pixels per Mode Info (MI) unit
#define MI_SIZE_LOG2 3 #define MI_SIZE_LOG2 3
#define MI_BLOCK_SIZE_LOG2 (MAX_SB_SIZE_LOG2 - MI_SIZE_LOG2) // 64 = 2^6 #define MI_SIZE (1 << MI_SIZE_LOG2)
#define MI_SIZE (1 << MI_SIZE_LOG2) // pixels per mi-unit // MI-units per max superblock (MI Block - MIB)
#define MI_BLOCK_SIZE (1 << MI_BLOCK_SIZE_LOG2) // mi-units per max block #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) // Mask to extract MI offset within max MIB
#define MAX_MIB_MASK (MAX_MIB_SIZE - 1)
// Bitstream profiles indicated by 2-3 bits in the uncompressed header. // Bitstream profiles indicated by 2-3 bits in the uncompressed header.
// 00: Profile 0. 8-bit 4:2:0 only. // 00: Profile 0. 8-bit 4:2:0 only.
......
...@@ -854,11 +854,11 @@ void av1_setup_mask(AV1_COMMON *const cm, const int mi_row, const int mi_col, ...@@ -854,11 +854,11 @@ void av1_setup_mask(AV1_COMMON *const cm, const int mi_row, const int mi_col,
const int shift_16_uv[] = { 0, 1, 4, 5 }; const int shift_16_uv[] = { 0, 1, 4, 5 };
int i; int i;
const int max_rows = const int max_rows =
(mi_row + MI_BLOCK_SIZE > cm->mi_rows ? cm->mi_rows - mi_row (mi_row + MAX_MIB_SIZE > cm->mi_rows ? cm->mi_rows - mi_row
: MI_BLOCK_SIZE); : MAX_MIB_SIZE);
const int max_cols = const int max_cols =
(mi_col + MI_BLOCK_SIZE > cm->mi_cols ? cm->mi_cols - mi_col (mi_col + MAX_MIB_SIZE > cm->mi_cols ? cm->mi_cols - mi_col
: MI_BLOCK_SIZE); : MAX_MIB_SIZE);
av1_zero(*lfm); av1_zero(*lfm);
assert(mip[0] != NULL); assert(mip[0] != NULL);
...@@ -982,7 +982,7 @@ void av1_setup_mask(AV1_COMMON *const cm, const int mi_row, const int mi_col, ...@@ -982,7 +982,7 @@ void av1_setup_mask(AV1_COMMON *const cm, const int mi_row, const int mi_col,
lfm->above_uv[TX_4X4] &= ~above_border_uv; lfm->above_uv[TX_4X4] &= ~above_border_uv;
// We do some special edge handling. // 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; const uint64_t rows = cm->mi_rows - mi_row;
// Each pixel inside the border gets a 1, // Each pixel inside the border gets a 1,
...@@ -1015,7 +1015,7 @@ void av1_setup_mask(AV1_COMMON *const cm, const int mi_row, const int mi_col, ...@@ -1015,7 +1015,7 @@ void av1_setup_mask(AV1_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; const uint64_t columns = cm->mi_cols - mi_col;
// Each pixel inside the border gets a 1, the multiply copies the border // Each pixel inside the border gets a 1, the multiply copies the border
...@@ -1165,21 +1165,21 @@ void av1_filter_block_plane_non420_ver(AV1_COMMON *cm, ...@@ -1165,21 +1165,21 @@ void av1_filter_block_plane_non420_ver(AV1_COMMON *cm,
const int row_step_stride = cm->mi_stride * row_step; const int row_step_stride = cm->mi_stride * row_step;
struct buf_2d *const dst = &plane->dst; struct buf_2d *const dst = &plane->dst;
uint8_t *const dst0 = dst->buf; uint8_t *const dst0 = dst->buf;
unsigned int mask_16x16[MI_BLOCK_SIZE] = { 0 }; unsigned int mask_16x16[MAX_MIB_SIZE] = { 0 };
unsigned int mask_8x8[MI_BLOCK_SIZE] = { 0 }; unsigned int mask_8x8[MAX_MIB_SIZE] = { 0 };
unsigned int mask_4x4[MI_BLOCK_SIZE] = { 0 }; unsigned int mask_4x4[MAX_MIB_SIZE] = { 0 };
unsigned int mask_4x4_int[MI_BLOCK_SIZE] = { 0 }; unsigned int mask_4x4_int[MAX_MIB_SIZE] = { 0 };
uint8_t lfl[MI_BLOCK_SIZE * MI_BLOCK_SIZE]; uint8_t lfl[MAX_MIB_SIZE * MAX_MIB_SIZE];
int r, c; 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_16x16_c = 0;
unsigned int mask_8x8_c = 0; unsigned int mask_8x8_c = 0;
unsigned int mask_4x4_c = 0; unsigned int mask_4x4_c = 0;
unsigned int border_mask; unsigned int border_mask;
// Determine the vertical edges that need filtering // 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 MODE_INFO *mi = mi_8x8[c];
const BLOCK_SIZE sb_type = mi[0].mbmi.sb_type; const BLOCK_SIZE sb_type = mi[0].mbmi.sb_type;
const int skip_this = mi[0].mbmi.skip && is_inter_block(&mi[0].mbmi); const int skip_this = mi[0].mbmi.skip && is_inter_block(&mi[0].mbmi);
...@@ -1289,14 +1289,14 @@ void av1_filter_block_plane_non420_hor(AV1_COMMON *cm, ...@@ -1289,14 +1289,14 @@ void av1_filter_block_plane_non420_hor(AV1_COMMON *cm,
const int row_step = 1 << ss_y; const int row_step = 1 << ss_y;
struct buf_2d *const dst = &plane->dst; struct buf_2d *const dst = &plane->dst;
uint8_t *const dst0 = dst->buf; uint8_t *const dst0 = dst->buf;
unsigned int mask_16x16[MI_BLOCK_SIZE] = { 0 }; unsigned int mask_16x16[MAX_MIB_SIZE] = { 0 };
unsigned int mask_8x8[MI_BLOCK_SIZE] = { 0 }; unsigned int mask_8x8[MAX_MIB_SIZE] = { 0 };
unsigned int mask_4x4[MI_BLOCK_SIZE] = { 0 }; unsigned int mask_4x4[MAX_MIB_SIZE] = { 0 };
unsigned int mask_4x4_int[MI_BLOCK_SIZE] = { 0 }; unsigned int mask_4x4_int[MAX_MIB_SIZE] = { 0 };
uint8_t lfl[MI_BLOCK_SIZE * MI_BLOCK_SIZE]; uint8_t lfl[MAX_MIB_SIZE * MAX_MIB_SIZE];
int r; int r;
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 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]; const unsigned int mask_4x4_int_r = skip_border_4x4_r ? 0 : mask_4x4_int[r];
...@@ -1350,7 +1350,7 @@ void av1_filter_block_plane_ss00_ver(AV1_COMMON *const cm, ...@@ -1350,7 +1350,7 @@ void av1_filter_block_plane_ss00_ver(AV1_COMMON *const cm,
assert(plane->subsampling_x == 0 && plane->subsampling_y == 0); assert(plane->subsampling_x == 0 && plane->subsampling_y == 0);
// Vertical pass: do 2 rows at one time // 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_16x16_l = mask_16x16 & 0xffff;
unsigned int mask_8x8_l = mask_8x8 & 0xffff; unsigned int mask_8x8_l = mask_8x8 & 0xffff;
unsigned int mask_4x4_l = mask_4x4 & 0xffff; unsigned int mask_4x4_l = mask_4x4 & 0xffff;
...@@ -1396,7 +1396,7 @@ void av1_filter_block_plane_ss00_hor(AV1_COMMON *const cm, ...@@ -1396,7 +1396,7 @@ void av1_filter_block_plane_ss00_hor(AV1_COMMON *const cm,
assert(plane->subsampling_x == 0 && plane->subsampling_y == 0); assert(plane->subsampling_x == 0 && plane->subsampling_y == 0);
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_16x16_r;
unsigned int mask_8x8_r; unsigned int mask_8x8_r;
unsigned int mask_4x4_r; unsigned int mask_4x4_r;
...@@ -1458,9 +1458,9 @@ void av1_filter_block_plane_ss11_ver(AV1_COMMON *const cm, ...@@ -1458,9 +1458,9 @@ void av1_filter_block_plane_ss11_ver(AV1_COMMON *const cm,
assert(plane->subsampling_x == 1 && plane->subsampling_y == 1); assert(plane->subsampling_x == 1 && plane->subsampling_y == 1);
// Vertical pass: do 2 rows at one time // 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) { 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 << 3) + (c << 1)]; lfm->lfl_uv[(r << 1) + c] = lfm->lfl_y[(r << 3) + (c << 1)];
lfm->lfl_uv[((r + 2) << 1) + c] = lfm->lfl_y[((r + 2) << 3) + (c << 1)]; lfm->lfl_uv[((r + 2) << 1) + c] = lfm->lfl_y[((r + 2) << 3) + (c << 1)];
} }
...@@ -1520,7 +1520,7 @@ void av1_filter_block_plane_ss11_hor(AV1_COMMON *const cm, ...@@ -1520,7 +1520,7 @@ void av1_filter_block_plane_ss11_hor(AV1_COMMON *const cm,
assert(plane->subsampling_x == 1 && plane->subsampling_y == 1); assert(plane->subsampling_x == 1 && plane->subsampling_y == 1);
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 int skip_border_4x4_r = mi_row + r == cm->mi_rows - 1;
const unsigned int mask_4x4_int_r = const unsigned int mask_4x4_int_r =
skip_border_4x4_r ? 0 : (mask_4x4_int & 0xf); skip_border_4x4_r ? 0 : (mask_4x4_int & 0xf);
...@@ -1585,10 +1585,10 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm, ...@@ -1585,10 +1585,10 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
#if CONFIG_PARALLEL_DEBLOCKING #if CONFIG_PARALLEL_DEBLOCKING
// Filter all the vertical edges in the whole frame // Filter all the vertical edges in the whole frame
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; 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; int plane;
av1_setup_dst_planes(planes, frame_buffer, mi_row, mi_col); av1_setup_dst_planes(planes, frame_buffer, mi_row, mi_col);
...@@ -1613,10 +1613,10 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm, ...@@ -1613,10 +1613,10 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
} }
// Filter all the horizontal edges in the whole frame // Filter all the horizontal edges in the whole frame
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; 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; int plane;
av1_setup_dst_planes(planes, frame_buffer, mi_row, mi_col); av1_setup_dst_planes(planes, frame_buffer, mi_row, mi_col);
...@@ -1639,10 +1639,10 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm, ...@@ -1639,10 +1639,10 @@ void av1_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer, AV1_COMMON *cm,
} }
} }
#else // CONFIG_PARALLEL_DEBLOCKING #else // CONFIG_PARALLEL_DEBLOCKING
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; 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; int plane;
av1_setup_dst_planes(planes, frame_buffer, mi_row, mi_col); av1_setup_dst_planes(planes, frame_buffer, mi_row, mi_col);
......
...@@ -399,7 +399,7 @@ static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) { ...@@ -399,7 +399,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) { 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 AV1_COMMON *const cm) { static INLINE int frame_is_intra_only(const AV1_COMMON *const cm) {
...@@ -449,7 +449,7 @@ static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) { ...@@ -449,7 +449,7 @@ static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) {
static INLINE int calc_mi_size(int len) { static INLINE int calc_mi_size(int len) {
// len is in mi units. // len is in mi units.
return len + MI_BLOCK_SIZE; return len + MAX_MIB_SIZE;
} }
static void set_plane_n4(MACROBLOCKD *const xd, int bw, int bh, int bwl, static void set_plane_n4(MACROBLOCKD *const xd, int bw, int bh, int bwl,
...@@ -519,7 +519,8 @@ static INLINE void update_partition_context(MACROBLOCKD *xd, int mi_row, ...@@ -519,7 +519,8 @@ static INLINE void update_partition_context(MACROBLOCKD *xd, int mi_row,
int mi_col, BLOCK_SIZE subsize, int mi_col, BLOCK_SIZE subsize,
BLOCK_SIZE bsize) { BLOCK_SIZE bsize) {
PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col; 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);
// num_4x4_blocks_wide_lookup[bsize] / 2 // num_4x4_blocks_wide_lookup[bsize] / 2
const int bs = num_8x8_blocks_wide_lookup[bsize]; const int bs = num_8x8_blocks_wide_lookup[bsize];
...@@ -534,7 +535,8 @@ static INLINE void update_partition_context(MACROBLOCKD *xd, int mi_row, ...@@ -534,7 +535,8 @@ static INLINE void update_partition_context(MACROBLOCKD *xd, int mi_row,
static INLINE int partition_plane_context(const MACROBLOCKD *xd, int mi_row, static INLINE int partition_plane_context(const MACROBLOCKD *xd, int mi_row,
int mi_col, BLOCK_SIZE bsize) { int mi_col, BLOCK_SIZE bsize) {
const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col; 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]; const int bsl = mi_width_log2_lookup[bsize];
int above = (*above_ctx >> bsl) & 1, left = (*left_ctx >> bsl) & 1; int above = (*above_ctx >> bsl) & 1, left = (*left_ctx >> bsl) & 1;
......
...@@ -148,11 +148,11 @@ static int loop_filter_ver_row_worker(AV1LfSync *const lf_sync, ...@@ -148,11 +148,11 @@ static int loop_filter_ver_row_worker(AV1LfSync *const lf_sync,
enum lf_path path = get_loop_filter_path(lf_data->y_only, lf_data->planes); enum lf_path path = get_loop_filter_path(lf_data->y_only, lf_data->planes);
for (mi_row = lf_data->start; mi_row < lf_data->stop; for (mi_row = lf_data->start; mi_row < lf_data->stop;
mi_row += lf_sync->num_workers * MI_BLOCK_SIZE) { mi_row += lf_sync->num_workers * MAX_MIB_SIZE) {
MODE_INFO **const mi = MODE_INFO **const mi =
lf_data->cm->mi_grid_visible + mi_row * lf_data->cm->mi_stride; lf_data->cm->mi_grid_visible + mi_row * lf_data->cm->mi_stride;
for (mi_col = 0; mi_col < lf_data->cm->mi_cols; mi_col += MI_BLOCK_SIZE) { for (mi_col = 0; mi_col < lf_data->cm->mi_cols; mi_col += MAX_MIB_SIZE) {
LOOP_FILTER_MASK lfm; LOOP_FILTER_MASK lfm;
int plane; int plane;
...@@ -173,18 +173,18 @@ static int loop_filter_hor_row_worker(AV1LfSync *const lf_sync, ...@@ -173,18 +173,18 @@ static int loop_filter_hor_row_worker(AV1LfSync *const lf_sync,
LFWorkerData *const lf_data) { LFWorkerData *const lf_data) {
const int num_planes = lf_data->y_only ? 1 : MAX_MB_PLANE; const int num_planes = lf_data->y_only ? 1 : MAX_MB_PLANE;
const int sb_cols = const int sb_cols =
mi_cols_aligned_to_sb(lf_data->cm->mi_cols) >> MI_BLOCK_SIZE_LOG2; mi_cols_aligned_to_sb(lf_data->cm->mi_cols) >> MAX_MIB_SIZE_LOG2;
int mi_row, mi_col; int mi_row, mi_col;
enum lf_path path = get_loop_filter_path(lf_data->y_only, lf_data->planes); enum lf_path path = get_loop_filter_path(lf_data->y_only, lf_data->planes);
for (mi_row = lf_data->start; mi_row < lf_data->stop; for (mi_row = lf_data->start; mi_row < lf_data->stop;
mi_row += lf_sync->num_workers * MI_BLOCK_SIZE) { mi_row += lf_sync->num_workers * MAX_MIB_SIZE) {
MODE_INFO **const mi = MODE_INFO **const mi =
lf_data->cm->mi_grid_visible + mi_row * lf_data->cm->mi_stride; lf_data->cm->mi_grid_visible + mi_row * lf_data->cm->mi_stride;
for (mi_col = 0; mi_col < lf_data->cm->mi_cols; mi_col += MI_BLOCK_SIZE) { for (mi_col = 0; mi_col < lf_data->cm->mi_cols; mi_col += MAX_MIB_SIZE) {
const int r = mi_row >> MI_BLOCK_SIZE_LOG2; const int r = mi_row >> MAX_MIB_SIZE_LOG2;
const int c = mi_col >> MI_BLOCK_SIZE_LOG2; const int c = mi_col >> MAX_MIB_SIZE_LOG2;
LOOP_FILTER_MASK lfm; LOOP_FILTER_MASK lfm;
int plane; int plane;
...@@ -211,18 +211,18 @@ static int loop_filter_row_worker(AV1LfSync *const lf_sync, ...@@ -211,18 +211,18 @@ static int loop_filter_row_worker(AV1LfSync *const lf_sync,
LFWorkerData *const lf_data) { LFWorkerData *const lf_data) {
const int num_planes = lf_data->y_only ? 1 : MAX_MB_PLANE; const int num_planes = lf_data->y_only ? 1 : MAX_MB_PLANE;
const int sb_cols = const int sb_cols =
mi_cols_aligned_to_sb(lf_data->cm->mi_cols) >> MI_BLOCK_SIZE_LOG2; mi_cols_aligned_to_sb(lf_data->cm->mi_cols) >> MAX_MIB_SIZE_LOG2;
int mi_row, mi_col; int mi_row, mi_col;
enum lf_path path = get_loop_filter_path(lf_data->y_only, lf_data->planes); enum lf_path path = get_loop_filter_path(lf_data->y_only, lf_data->planes);
for (mi_row = lf_data->start; mi_row < lf_data->stop; for (mi_row = lf_data->start; mi_row < lf_data->stop;
mi_row += lf_sync->num_workers * MI_BLOCK_SIZE) { mi_row += lf_sync->num_workers * MAX_MIB_SIZE) {
MODE_INFO **const mi = MODE_INFO **const mi =
lf_data->cm->mi_grid_visible + mi_row * lf_data->cm->mi_stride; lf_data->cm->mi_grid_visible + mi_row * lf_data->cm->mi_stride;
for (mi_col = 0; mi_col < lf_data->cm->mi_cols; mi_col += MI_BLOCK_SIZE) { for (mi_col = 0; mi_col < lf_data->cm->mi_cols; mi_col += MAX_MIB_SIZE) {
const int r = mi_row >> MI_BLOCK_SIZE_LOG2; const int r = mi_row >> MAX_MIB_SIZE_LOG2;
const int c = mi_col >> MI_BLOCK_SIZE_LOG2; const int c = mi_col >> MAX_MIB_SIZE_LOG2;
LOOP_FILTER_MASK lfm; LOOP_FILTER_MASK lfm;
int plane; int plane;
...@@ -254,7 +254,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, ...@@ -254,7 +254,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
AV1LfSync *lf_sync) { AV1LfSync *lf_sync) {
const AVxWorkerInterface *const winterface = aom_get_worker_interface(); const AVxWorkerInterface *const winterface = aom_get_worker_interface();
// Number of superblock rows and cols // 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 // Decoder may allocate more threads than number of tiles based on user's
// input. // input.
const int tile_cols = 1 << cm->log2_tile_cols; const int tile_cols = 1 << cm->log2_tile_cols;
...@@ -291,7 +291,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, ...@@ -291,7 +291,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
// Loopfilter data // Loopfilter data
av1_loop_filter_data_reset(lf_data, frame, cm, planes); av1_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->stop = stop;
lf_data->y_only = y_only; lf_data->y_only = y_only;
...@@ -320,7 +320,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, ...@@ -320,7 +320,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
// Loopfilter data // Loopfilter data
av1_loop_filter_data_reset(lf_data, frame, cm, planes); av1_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->stop = stop;
lf_data->y_only = y_only; lf_data->y_only = y_only;
...@@ -350,7 +350,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm, ...@@ -350,7 +350,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame, AV1_COMMON *cm,
// Loopfilter data // Loopfilter data
av1_loop_filter_data_reset(lf_data, frame, cm, planes); av1_loop_filter_data_reset(lf_data, frame, cm, planes);
lf_data->start = start + i * MI_BLOCK_SIZE;