Commit 5a21de84 authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Replacing 64 / MI_SIZE with MI_BLOCK_SIZE.

Change-Id: I32276552b3ea6dc1dce8e298be114cfe1019b31c
parent 904070ca
......@@ -11,6 +11,7 @@
#include "./vpx_config.h"
#include "vpx_mem/vpx_mem.h"
#include "vp9/common/vp9_blockd.h"
#include "vp9/common/vp9_entropymode.h"
#include "vp9/common/vp9_entropymv.h"
......@@ -62,9 +63,9 @@ void vp9_free_frame_buffers(VP9_COMMON *oci) {
vpx_free(oci->above_context[0]);
for (i = 0; i < MAX_MB_PLANE; i++)
oci->above_context[i] = 0;
oci->mip = 0;
oci->prev_mip = 0;
oci->above_seg_context = 0;
oci->mip = NULL;
oci->prev_mip = NULL;
oci->above_seg_context = NULL;
}
static void set_mb_mi(VP9_COMMON *cm, int aligned_width, int aligned_height) {
......@@ -74,7 +75,7 @@ static void set_mb_mi(VP9_COMMON *cm, int aligned_width, int aligned_height) {
cm->mi_cols = aligned_width >> LOG2_MI_SIZE;
cm->mi_rows = aligned_height >> LOG2_MI_SIZE;
cm->mode_info_stride = cm->mi_cols + 64 / MI_SIZE;
cm->mode_info_stride = cm->mi_cols + MI_BLOCK_SIZE;
}
static void setup_mi(VP9_COMMON *cm) {
......@@ -99,6 +100,7 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
const int aligned_height = multiple8(height);
const int ss_x = oci->subsampling_x;
const int ss_y = oci->subsampling_y;
int mi_size;
vp9_free_frame_buffers(oci);
......@@ -131,14 +133,13 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
set_mb_mi(oci, aligned_width, aligned_height);
// Allocation
oci->mip = vpx_calloc(oci->mode_info_stride * (oci->mi_rows + 64 / MI_SIZE),
sizeof(MODE_INFO));
mi_size = oci->mode_info_stride * (oci->mi_rows + MI_BLOCK_SIZE);
oci->mip = vpx_calloc(mi_size, sizeof(MODE_INFO));
if (!oci->mip)
goto fail;
oci->prev_mip = vpx_calloc(oci->mode_info_stride *
(oci->mi_rows + 64 / MI_SIZE),
sizeof(MODE_INFO));
oci->prev_mip = vpx_calloc(mi_size, sizeof(MODE_INFO));
if (!oci->prev_mip)
goto fail;
......
......@@ -17,6 +17,7 @@
#define MI_SIZE (1 << LOG2_MI_SIZE)
#define MI_MASK ((64 >> LOG2_MI_SIZE) - 1)
#define MI_BLOCK_SIZE (64 / MI_SIZE)
typedef enum BLOCK_SIZE_TYPE {
BLOCK_SIZE_AB4X4,
......
......@@ -268,23 +268,23 @@ static void filter_block_plane(VP9_COMMON *cm, MACROBLOCKD *xd,
const int col_step = 1 << xd->plane[plane].subsampling_x;
struct buf_2d * const dst = &xd->plane[plane].dst;
uint8_t* const dst0 = dst->buf;
unsigned int mask_16x16[64 / MI_SIZE] = {0};
unsigned int mask_8x8[64 / MI_SIZE] = {0};
unsigned int mask_4x4[64 / MI_SIZE] = {0};
unsigned int mask_4x4_int[64 / MI_SIZE] = {0};
struct loop_filter_info lfi[64 / MI_SIZE][64 / MI_SIZE];
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};
struct loop_filter_info lfi[MI_BLOCK_SIZE][MI_BLOCK_SIZE];
int r, c;
MODE_INFO *mi = xd->mode_info_context;
int row_step_stride = cm->mode_info_stride * row_step;
for (r = 0; r < 64 / MI_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
for (r = 0; r < MI_BLOCK_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 < 64 / MI_SIZE && mi_col + c < cm->mi_cols; c += col_step) {
for (c = 0; c < MI_BLOCK_SIZE && mi_col + c < cm->mi_cols; c += col_step) {
const int skip_this = mi[c].mbmi.mb_skip_coeff
&& mi[c].mbmi.ref_frame[0] != INTRA_FRAME;
// left edge of current unit is block/partition edge -> no skip
......@@ -366,7 +366,7 @@ static void filter_block_plane(VP9_COMMON *cm, MACROBLOCKD *xd,
// Now do horizontal pass
dst->buf = dst0;
for (r = 0; r < 64 / MI_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
for (r = 0; r < MI_BLOCK_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];
......@@ -379,19 +379,17 @@ static void filter_block_plane(VP9_COMMON *cm, MACROBLOCKD *xd,
}
}
void vp9_loop_filter_frame(VP9_COMMON *cm,
MACROBLOCKD *xd,
int frame_filter_level,
int y_only) {
void vp9_loop_filter_frame(VP9_COMMON *cm, MACROBLOCKD *xd,
int frame_filter_level, int y_only) {
int mi_row, mi_col;
// Initialize the loop filter for this frame.
vp9_loop_filter_frame_init(cm, xd, frame_filter_level);
for (mi_row = 0; mi_row < cm->mi_rows; mi_row += 64 / MI_SIZE) {
for (mi_row = 0; mi_row < cm->mi_rows; mi_row += MI_BLOCK_SIZE) {
MODE_INFO* const mi = cm->mi + mi_row * cm->mode_info_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += 64 / MI_SIZE) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) {
int plane;
setup_dst_planes(xd, cm->frame_to_show, mi_row, mi_col);
......
......@@ -657,13 +657,13 @@ static void decode_tile(VP9D_COMP *pbi, vp9_reader *r) {
VP9_COMMON *const pc = &pbi->common;
int mi_row, mi_col;
for (mi_row = pc->cur_tile_mi_row_start;
mi_row < pc->cur_tile_mi_row_end; mi_row += 64 / MI_SIZE) {
for (mi_row = pc->cur_tile_mi_row_start; mi_row < pc->cur_tile_mi_row_end;
mi_row += MI_BLOCK_SIZE) {
// For a SB there are 2 left contexts, each pertaining to a MB row within
vpx_memset(&pc->left_context, 0, sizeof(pc->left_context));
vpx_memset(pc->left_seg_context, 0, sizeof(pc->left_seg_context));
for (mi_col = pc->cur_tile_mi_col_start;
mi_col < pc->cur_tile_mi_col_end; mi_col += 64 / MI_SIZE)
for (mi_col = pc->cur_tile_mi_col_start; mi_col < pc->cur_tile_mi_col_end;
mi_col += MI_BLOCK_SIZE)
decode_modes_sb(pbi, mi_row, mi_col, r, BLOCK_SIZE_SB64X64);
}
}
......
......@@ -724,14 +724,12 @@ static void write_modes(VP9_COMP *cpi, vp9_writer* const bc,
m_ptr += c->cur_tile_mi_col_start + c->cur_tile_mi_row_start * mis;
for (mi_row = c->cur_tile_mi_row_start;
mi_row < c->cur_tile_mi_row_end;
for (mi_row = c->cur_tile_mi_row_start; mi_row < c->cur_tile_mi_row_end;
mi_row += 8, m_ptr += 8 * mis) {
m = m_ptr;
vpx_memset(c->left_seg_context, 0, sizeof(c->left_seg_context));
for (mi_col = c->cur_tile_mi_col_start;
mi_col < c->cur_tile_mi_col_end;
mi_col += 64 / MI_SIZE, m += 64 / MI_SIZE)
for (mi_col = c->cur_tile_mi_col_start; mi_col < c->cur_tile_mi_col_end;
mi_col += MI_BLOCK_SIZE, m += MI_BLOCK_SIZE)
write_modes_sb(cpi, m, bc, tok, tok_end, mi_row, mi_col,
BLOCK_SIZE_SB64X64);
}
......
......@@ -1583,7 +1583,7 @@ static void encode_sb_row(VP9_COMP *cpi, int mi_row, TOKENEXTRA **tp,
// Code each SB in the row
for (mi_col = cm->cur_tile_mi_col_start; mi_col < cm->cur_tile_mi_col_end;
mi_col += 64 / MI_SIZE) {
mi_col += MI_BLOCK_SIZE) {
int dummy_rate;
int64_t dummy_dist;
if (cpi->sf.partition_by_variance || cpi->sf.use_lastframe_partitioning ||
......
......@@ -853,8 +853,8 @@ static void alloc_raw_frame_buffers(VP9_COMP *cpi) {
static int alloc_partition_data(VP9_COMP *cpi) {
vpx_free(cpi->mb.pip);
cpi->mb.pip = vpx_calloc((cpi->common.mode_info_stride) *
(cpi->common.mi_rows + 64 / MI_SIZE),
cpi->mb.pip = vpx_calloc(cpi->common.mode_info_stride *
(cpi->common.mi_rows + MI_BLOCK_SIZE),
sizeof(PARTITION_INFO));
if (!cpi->mb.pip)
return 1;
......@@ -3432,11 +3432,11 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
if (cm->show_frame) {
vpx_memcpy(cm->prev_mip, cm->mip,
cm->mode_info_stride * (cm->mi_rows + 64 / MI_SIZE) *
cm->mode_info_stride * (cm->mi_rows + MI_BLOCK_SIZE) *
sizeof(MODE_INFO));
} else {
vpx_memset(cm->prev_mip, 0,
cm->mode_info_stride * (cm->mi_rows + 64 / MI_SIZE) *
cm->mode_info_stride * (cm->mi_rows + MI_BLOCK_SIZE) *
sizeof(MODE_INFO));
}
// restore prev_mi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment