Commit 1a46b30e authored by Ronald S. Bultje's avatar Ronald S. Bultje

Grow MODE_INFO array to use an 8x8 basis.

Change-Id: I087e08e7909a406b71715b8525c104208daa6889
parent eea1fecd
...@@ -27,7 +27,7 @@ void vp9_update_mode_info_border(VP9_COMMON *cpi, MODE_INFO *mi) { ...@@ -27,7 +27,7 @@ void vp9_update_mode_info_border(VP9_COMMON *cpi, MODE_INFO *mi) {
vpx_memset(mi, 0, sizeof(MODE_INFO) * stride); vpx_memset(mi, 0, sizeof(MODE_INFO) * stride);
// Clear left border column // Clear left border column
for (i = 1; i < cpi->mb_rows + 1; i++) for (i = 1; i < cpi->mi_rows + 1; i++)
vpx_memset(&mi[i * stride], 0, sizeof(MODE_INFO)); vpx_memset(&mi[i * stride], 0, sizeof(MODE_INFO));
} }
...@@ -36,9 +36,9 @@ void vp9_update_mode_info_in_image(VP9_COMMON *cpi, MODE_INFO *mi) { ...@@ -36,9 +36,9 @@ void vp9_update_mode_info_in_image(VP9_COMMON *cpi, MODE_INFO *mi) {
MODE_INFO *ptr; MODE_INFO *ptr;
// For each in image mode_info element set the in image flag to 1 // For each in image mode_info element set the in image flag to 1
for (i = 0; i < cpi->mb_rows; i++) { for (i = 0; i < cpi->mi_rows; i++) {
ptr = mi; ptr = mi;
for (j = 0; j < cpi->mb_cols; j++) { for (j = 0; j < cpi->mi_cols; j++) {
ptr->mbmi.mb_in_image = 1; ptr->mbmi.mb_in_image = 1;
ptr++; // Next element in the row ptr++; // Next element in the row
} }
...@@ -110,10 +110,13 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) { ...@@ -110,10 +110,13 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
} }
oci->mb_rows = aligned_height >> 4; oci->mb_rows = aligned_height >> 4;
oci->mi_rows = aligned_height >> LOG2_MI_SIZE;
oci->mb_cols = aligned_width >> 4; oci->mb_cols = aligned_width >> 4;
oci->mi_cols = aligned_width >> LOG2_MI_SIZE;
oci->MBs = oci->mb_rows * oci->mb_cols; oci->MBs = oci->mb_rows * oci->mb_cols;
oci->mode_info_stride = oci->mb_cols + 1; oci->mode_info_stride = oci->mi_cols + 1;
oci->mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO)); oci->mip = vpx_calloc(oci->mode_info_stride * (oci->mi_rows + 1),
sizeof(MODE_INFO));
if (!oci->mip) { if (!oci->mip) {
vp9_free_frame_buffers(oci); vp9_free_frame_buffers(oci);
...@@ -124,7 +127,8 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) { ...@@ -124,7 +127,8 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
/* allocate memory for last frame MODE_INFO array */ /* allocate memory for last frame MODE_INFO array */
oci->prev_mip = vpx_calloc((oci->mb_cols + 1) * (oci->mb_rows + 1), sizeof(MODE_INFO)); oci->prev_mip = vpx_calloc(oci->mode_info_stride * (oci->mi_rows + 1),
sizeof(MODE_INFO));
if (!oci->prev_mip) { if (!oci->prev_mip) {
vp9_free_frame_buffers(oci); vp9_free_frame_buffers(oci);
......
...@@ -205,39 +205,49 @@ typedef enum { ...@@ -205,39 +205,49 @@ typedef enum {
MAX_REF_FRAMES = 4 MAX_REF_FRAMES = 4
} MV_REFERENCE_FRAME; } MV_REFERENCE_FRAME;
static INLINE int mb_width_log2(BLOCK_SIZE_TYPE sb_type) { static INLINE int mi_width_log2(BLOCK_SIZE_TYPE sb_type) {
switch (sb_type) { switch (sb_type) {
#if CONFIG_SB8X8
case BLOCK_SIZE_SB8X16:
case BLOCK_SIZE_SB8X8: return 0;
case BLOCK_SIZE_SB16X8:
#endif
case BLOCK_SIZE_MB16X16: case BLOCK_SIZE_MB16X16:
case BLOCK_SIZE_SB16X32: return 0; case BLOCK_SIZE_SB16X32: return 0 + CONFIG_SB8X8;
case BLOCK_SIZE_SB32X16: case BLOCK_SIZE_SB32X16:
case BLOCK_SIZE_SB32X64: case BLOCK_SIZE_SB32X64:
case BLOCK_SIZE_SB32X32: return 1; case BLOCK_SIZE_SB32X32: return 1 + CONFIG_SB8X8;
case BLOCK_SIZE_SB64X32: case BLOCK_SIZE_SB64X32:
case BLOCK_SIZE_SB64X64: return 2; case BLOCK_SIZE_SB64X64: return 2 + CONFIG_SB8X8;
default: assert(0); default: assert(0);
} }
} }
static INLINE int mb_height_log2(BLOCK_SIZE_TYPE sb_type) { static INLINE int mi_height_log2(BLOCK_SIZE_TYPE sb_type) {
switch (sb_type) { switch (sb_type) {
#if CONFIG_SB8X8
case BLOCK_SIZE_SB16X8:
case BLOCK_SIZE_SB8X8: return 0;
case BLOCK_SIZE_SB8X16:
#endif
case BLOCK_SIZE_MB16X16: case BLOCK_SIZE_MB16X16:
case BLOCK_SIZE_SB32X16: return 0; case BLOCK_SIZE_SB32X16: return 0 + CONFIG_SB8X8;
case BLOCK_SIZE_SB16X32: case BLOCK_SIZE_SB16X32:
case BLOCK_SIZE_SB64X32: case BLOCK_SIZE_SB64X32:
case BLOCK_SIZE_SB32X32: return 1; case BLOCK_SIZE_SB32X32: return 1 + CONFIG_SB8X8;
case BLOCK_SIZE_SB32X64: case BLOCK_SIZE_SB32X64:
case BLOCK_SIZE_SB64X64: return 2; case BLOCK_SIZE_SB64X64: return 2 + CONFIG_SB8X8;
default: assert(0); default: assert(0);
} }
} }
// parse block dimension in the unit of 4x4 blocks // parse block dimension in the unit of 4x4 blocks
static INLINE int b_width_log2(BLOCK_SIZE_TYPE sb_type) { static INLINE int b_width_log2(BLOCK_SIZE_TYPE sb_type) {
return mb_width_log2(sb_type) + 2; return mi_width_log2(sb_type) + 2 - CONFIG_SB8X8;
} }
static INLINE int b_height_log2(BLOCK_SIZE_TYPE sb_type) { static INLINE int b_height_log2(BLOCK_SIZE_TYPE sb_type) {
return mb_height_log2(sb_type) + 2; return mi_height_log2(sb_type) + 2 - CONFIG_SB8X8;
} }
typedef struct { typedef struct {
...@@ -426,10 +436,10 @@ typedef struct macroblockd { ...@@ -426,10 +436,10 @@ typedef struct macroblockd {
static INLINE void update_partition_context(MACROBLOCKD *xd, static INLINE void update_partition_context(MACROBLOCKD *xd,
BLOCK_SIZE_TYPE sb_type, BLOCK_SIZE_TYPE sb_type,
BLOCK_SIZE_TYPE sb_size) { BLOCK_SIZE_TYPE sb_size) {
int bsl = mb_width_log2(sb_size), bs = 1 << bsl; int bsl = mi_width_log2(sb_size) - CONFIG_SB8X8, bs = 1 << bsl;
int bwl = mb_width_log2(sb_type); int bwl = mi_width_log2(sb_type) - CONFIG_SB8X8;
int bhl = mb_height_log2(sb_type); int bhl = mi_height_log2(sb_type) - CONFIG_SB8X8;
int boffset = mb_width_log2(BLOCK_SIZE_SB64X64) - bsl; int boffset = mi_width_log2(BLOCK_SIZE_SB64X64) - CONFIG_SB8X8 - bsl;
int i; int i;
// skip macroblock partition // skip macroblock partition
if (bsl == 0) if (bsl == 0)
...@@ -465,11 +475,11 @@ static INLINE void update_partition_context(MACROBLOCKD *xd, ...@@ -465,11 +475,11 @@ static INLINE void update_partition_context(MACROBLOCKD *xd,
static INLINE int partition_plane_context(MACROBLOCKD *xd, static INLINE int partition_plane_context(MACROBLOCKD *xd,
BLOCK_SIZE_TYPE sb_type) { BLOCK_SIZE_TYPE sb_type) {
int bsl = mb_width_log2(sb_type), bs = 1 << bsl; int bsl = mi_width_log2(sb_type) - CONFIG_SB8X8, bs = 1 << bsl;
int above = 0, left = 0, i; int above = 0, left = 0, i;
int boffset = mb_width_log2(BLOCK_SIZE_SB64X64) - bsl; int boffset = mi_width_log2(BLOCK_SIZE_SB64X64) - bsl - CONFIG_SB8X8;
assert(mb_width_log2(sb_type) == mb_height_log2(sb_type)); assert(mi_width_log2(sb_type) == mi_height_log2(sb_type));
assert(bsl >= 0); assert(bsl >= 0);
assert(boffset >= 0); assert(boffset >= 0);
......
...@@ -119,7 +119,8 @@ void vp9_adapt_coef_probs(struct VP9Common *); ...@@ -119,7 +119,8 @@ void vp9_adapt_coef_probs(struct VP9Common *);
static INLINE void vp9_reset_sb_tokens_context(MACROBLOCKD* const xd, static INLINE void vp9_reset_sb_tokens_context(MACROBLOCKD* const xd,
BLOCK_SIZE_TYPE bsize) { BLOCK_SIZE_TYPE bsize) {
/* Clear entropy contexts */ /* Clear entropy contexts */
const int bw = 1 << mb_width_log2(bsize), bh = 1 << mb_height_log2(bsize); const int bw = 1 << (b_width_log2(bsize) - 2);
const int bh = 1 << (b_height_log2(bsize) - 2);
vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * bw); vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * bw);
vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * bh); vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * bh);
} }
......
...@@ -683,7 +683,7 @@ void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) { ...@@ -683,7 +683,7 @@ void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) {
vp9_clearall_segfeatures(xd); vp9_clearall_segfeatures(xd);
xd->mb_segment_abs_delta = SEGMENT_DELTADATA; xd->mb_segment_abs_delta = SEGMENT_DELTADATA;
if (cm->last_frame_seg_map) if (cm->last_frame_seg_map)
vpx_memset(cm->last_frame_seg_map, 0, (cm->mb_rows * cm->mb_cols)); vpx_memset(cm->last_frame_seg_map, 0, (cm->mi_rows * cm->mi_cols));
// Reset the mode ref deltas for loop filter // Reset the mode ref deltas for loop filter
vpx_memset(xd->last_ref_lf_deltas, 0, sizeof(xd->last_ref_lf_deltas)); vpx_memset(xd->last_ref_lf_deltas, 0, sizeof(xd->last_ref_lf_deltas));
...@@ -705,9 +705,9 @@ void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) { ...@@ -705,9 +705,9 @@ void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) {
vpx_memcpy(&cm->frame_contexts[i], &cm->fc, sizeof(cm->fc)); vpx_memcpy(&cm->frame_contexts[i], &cm->fc, sizeof(cm->fc));
vpx_memset(cm->prev_mip, 0, vpx_memset(cm->prev_mip, 0,
cm->mode_info_stride * (cm->mb_rows + 1)* sizeof(MODE_INFO)); cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO));
vpx_memset(cm->mip, 0, vpx_memset(cm->mip, 0,
cm->mode_info_stride * (cm->mb_rows + 1)* sizeof(MODE_INFO)); cm->mode_info_stride * (cm->mi_rows + 1) * sizeof(MODE_INFO));
vp9_update_mode_info_border(cm, cm->mip); vp9_update_mode_info_border(cm, cm->mip);
vp9_update_mode_info_in_image(cm, cm->mi); vp9_update_mode_info_in_image(cm, cm->mi);
......
...@@ -13,6 +13,15 @@ ...@@ -13,6 +13,15 @@
#include "./vpx_config.h" #include "./vpx_config.h"
#if CONFIG_SB8X8
#define LOG2_MI_SIZE 3
#else
#define LOG2_MI_SIZE 4
#endif
#define MI_SIZE (1 << LOG2_MI_SIZE)
#define MI_UV_SIZE (1 << (LOG2_MI_SIZE - 1))
typedef enum BLOCK_SIZE_TYPE { typedef enum BLOCK_SIZE_TYPE {
#if CONFIG_SB8X8 #if CONFIG_SB8X8
BLOCK_SIZE_SB8X8, BLOCK_SIZE_SB8X8,
......
...@@ -304,7 +304,7 @@ static void lpf_sb32(VP9_COMMON *cm, const MODE_INFO *mode_info_context, ...@@ -304,7 +304,7 @@ static void lpf_sb32(VP9_COMMON *cm, const MODE_INFO *mode_info_context,
y_only? 0 : v_ptr, y_only? 0 : v_ptr,
y_stride, uv_stride, dering); y_stride, uv_stride, dering);
// process 2nd MB top-right // process 2nd MB top-right
mi = mode_info_context + 1; mi = mode_info_context + (1 << CONFIG_SB8X8);
do_left_v = !(wbl >= 3 /* 32x16 or >=32x32 */ && (tx_size >= TX_32X32 || do_left_v = !(wbl >= 3 /* 32x16 or >=32x32 */ && (tx_size >= TX_32X32 ||
sb_mb_lf_skip(mode_info_context, mi))); sb_mb_lf_skip(mode_info_context, mi)));
do_above_h = (mb_row > 0); do_above_h = (mb_row > 0);
...@@ -320,7 +320,7 @@ static void lpf_sb32(VP9_COMMON *cm, const MODE_INFO *mode_info_context, ...@@ -320,7 +320,7 @@ static void lpf_sb32(VP9_COMMON *cm, const MODE_INFO *mode_info_context,
y_stride, uv_stride, dering); y_stride, uv_stride, dering);
// process 3rd MB bottom-left // process 3rd MB bottom-left
mi = mode_info_context + mis; mi = mode_info_context + (mis << CONFIG_SB8X8);
do_left_v = (mb_col > 0); do_left_v = (mb_col > 0);
do_above_h = !(hbl >= 3 /* 16x32 or >=32x32 */ && (tx_size >= TX_32X32 || do_above_h = !(hbl >= 3 /* 16x32 or >=32x32 */ && (tx_size >= TX_32X32 ||
sb_mb_lf_skip(mode_info_context, mi))); sb_mb_lf_skip(mode_info_context, mi)));
...@@ -336,15 +336,15 @@ static void lpf_sb32(VP9_COMMON *cm, const MODE_INFO *mode_info_context, ...@@ -336,15 +336,15 @@ static void lpf_sb32(VP9_COMMON *cm, const MODE_INFO *mode_info_context,
y_stride, uv_stride, dering); y_stride, uv_stride, dering);
// process 4th MB bottom right // process 4th MB bottom right
mi = mode_info_context + mis + 1; mi = mode_info_context + ((mis + 1) << CONFIG_SB8X8);
do_left_v = !(wbl >= 3 /* 32x16 or >=32x32 */ && (tx_size >= TX_32X32 || do_left_v = !(wbl >= 3 /* 32x16 or >=32x32 */ && (tx_size >= TX_32X32 ||
sb_mb_lf_skip(mi - 1, mi))); sb_mb_lf_skip(mi - (1 << CONFIG_SB8X8), mi)));
do_above_h = !(hbl >= 3 /* 16x32 or >=32x32 */ && (tx_size >= TX_32X32 || do_above_h = !(hbl >= 3 /* 16x32 or >=32x32 */ && (tx_size >= TX_32X32 ||
sb_mb_lf_skip(mode_info_context + 1, mi))); sb_mb_lf_skip(mode_info_context + (1 << CONFIG_SB8X8), mi)));
do_left_v_mbuv = (wbl >= 3 /* 32x16 or >=32x32 */ && (tx_size >= TX_16X16 || do_left_v_mbuv = (wbl >= 3 /* 32x16 or >=32x32 */ && (tx_size >= TX_16X16 ||
sb_mb_lf_skip(mi - 1, mi))); sb_mb_lf_skip(mi - (1 << CONFIG_SB8X8), mi)));
do_above_h_mbuv = !(hbl >= 3 /* 16x32 or >=32x32 */ && (tx_size >= TX_16X16 || do_above_h_mbuv = !(hbl >= 3 /* 16x32 or >=32x32 */ && (tx_size >= TX_16X16 ||
sb_mb_lf_skip(mode_info_context + 1, mi))); sb_mb_lf_skip(mode_info_context + (1 << CONFIG_SB8X8), mi)));
lpf_mb(cm, mi, do_left_v, do_above_h, lpf_mb(cm, mi, do_left_v, do_above_h,
do_left_v_mbuv, do_above_h_mbuv, do_left_v_mbuv, do_above_h_mbuv,
y_ptr + 16 * y_stride + 16, y_ptr + 16 * y_stride + 16,
...@@ -361,16 +361,17 @@ static void lpf_sb64(VP9_COMMON *cm, const MODE_INFO *mode_info_context, ...@@ -361,16 +361,17 @@ static void lpf_sb64(VP9_COMMON *cm, const MODE_INFO *mode_info_context,
lpf_sb32(cm, mode_info_context, mb_row, mb_col, lpf_sb32(cm, mode_info_context, mb_row, mb_col,
y_ptr, u_ptr, v_ptr, y_ptr, u_ptr, v_ptr,
y_stride, uv_stride, y_only, dering); y_stride, uv_stride, y_only, dering);
lpf_sb32(cm, mode_info_context + 2, mb_row, mb_col + 2, lpf_sb32(cm, mode_info_context + (2 << CONFIG_SB8X8), mb_row, mb_col + 2,
y_ptr + 32, u_ptr + 16, v_ptr + 16, y_ptr + 32, u_ptr + 16, v_ptr + 16,
y_stride, uv_stride, y_only, dering); y_stride, uv_stride, y_only, dering);
lpf_sb32(cm, mode_info_context + cm->mode_info_stride * 2, lpf_sb32(cm, mode_info_context + cm->mode_info_stride * (2 << CONFIG_SB8X8),
mb_row + 2, mb_col, mb_row + 2, mb_col,
y_ptr + 32 * y_stride, y_ptr + 32 * y_stride,
u_ptr + 16 * uv_stride, u_ptr + 16 * uv_stride,
v_ptr + 16 * uv_stride, v_ptr + 16 * uv_stride,
y_stride, uv_stride, y_only, dering); y_stride, uv_stride, y_only, dering);
lpf_sb32(cm, mode_info_context + cm->mode_info_stride * 2 + 2, lpf_sb32(cm, mode_info_context + cm->mode_info_stride *
(2 << CONFIG_SB8X8) + (2 << CONFIG_SB8X8),
mb_row + 2, mb_col + 2, mb_row + 2, mb_col + 2,
y_ptr + 32 * y_stride + 32, y_ptr + 32 * y_stride + 32,
u_ptr + 16 * uv_stride + 16, u_ptr + 16 * uv_stride + 16,
...@@ -440,14 +441,14 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -440,14 +441,14 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
y_ptr += 64; y_ptr += 64;
u_ptr = y_only? 0 : u_ptr + 32; u_ptr = y_only? 0 : u_ptr + 32;
v_ptr = y_only? 0 : v_ptr + 32; v_ptr = y_only? 0 : v_ptr + 32;
mode_info_context += 4; // step to next SB64 mode_info_context += 4 << CONFIG_SB8X8; // step to next SB64
} }
if (extra_sb32_col) { if (extra_sb32_col) {
// process 2 SB32s in the extra SB32 col // process 2 SB32s in the extra SB32 col
lpf_sb32(cm, mode_info_context, mb_row, mb_col, lpf_sb32(cm, mode_info_context, mb_row, mb_col,
y_ptr, u_ptr, v_ptr, y_ptr, u_ptr, v_ptr,
y_stride, uv_stride, y_only, dering); y_stride, uv_stride, y_only, dering);
lpf_sb32(cm, mode_info_context + mis * 2, lpf_sb32(cm, mode_info_context + mis * (2 << CONFIG_SB8X8),
mb_row + 2, mb_col, mb_row + 2, mb_col,
y_ptr + 32 * y_stride, y_ptr + 32 * y_stride,
u_ptr + 16 * uv_stride, u_ptr + 16 * uv_stride,
...@@ -456,7 +457,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -456,7 +457,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
y_ptr += 32; y_ptr += 32;
u_ptr = y_only? 0 : u_ptr + 16; u_ptr = y_only? 0 : u_ptr + 16;
v_ptr = y_only? 0 : v_ptr + 16; v_ptr = y_only? 0 : v_ptr + 16;
mode_info_context += 2; // step to next SB32 mode_info_context += 2 << CONFIG_SB8X8; // step to next SB32
mb_col += 2; mb_col += 2;
} }
if (extra_mb_col) { if (extra_mb_col) {
...@@ -474,7 +475,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -474,7 +475,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
y_only? 0 : v_ptr, y_only? 0 : v_ptr,
y_stride, uv_stride, dering); y_stride, uv_stride, dering);
// process 2nd MB // process 2nd MB
mi = mode_info_context + mis; mi = mode_info_context + (mis << CONFIG_SB8X8);
do_left_v = (mb_col > 0); do_left_v = (mb_col > 0);
do_above_h = 1; do_above_h = 1;
do_left_v_mbuv = 1; do_left_v_mbuv = 1;
...@@ -486,7 +487,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -486,7 +487,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
y_only ? 0 : (v_ptr + 8 * uv_stride), y_only ? 0 : (v_ptr + 8 * uv_stride),
y_stride, uv_stride, dering); y_stride, uv_stride, dering);
// process 3nd MB // process 3nd MB
mi = mode_info_context + mis * 2; mi = mode_info_context + (mis << CONFIG_SB8X8) * 2;
do_left_v = (mb_col > 0); do_left_v = (mb_col > 0);
do_above_h = 1; do_above_h = 1;
do_left_v_mbuv = 1; do_left_v_mbuv = 1;
...@@ -498,7 +499,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -498,7 +499,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
y_only ? 0 : (v_ptr + 16 * uv_stride), y_only ? 0 : (v_ptr + 16 * uv_stride),
y_stride, uv_stride, dering); y_stride, uv_stride, dering);
// process 4th MB // process 4th MB
mi = mode_info_context + mis * 3; mi = mode_info_context + (mis << CONFIG_SB8X8) * 3;
do_left_v = (mb_col > 0); do_left_v = (mb_col > 0);
do_above_h = 1; do_above_h = 1;
do_left_v_mbuv = 1; do_left_v_mbuv = 1;
...@@ -512,7 +513,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -512,7 +513,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
y_ptr += 16; y_ptr += 16;
u_ptr = y_only? 0 : u_ptr + 8; u_ptr = y_only? 0 : u_ptr + 8;
v_ptr = y_only? 0 : v_ptr + 8; v_ptr = y_only? 0 : v_ptr + 8;
mode_info_context++; // step to next MB mode_info_context += 1 << CONFIG_SB8X8; // step to next MB
} }
// move pointers to the begining of next sb64 row // move pointers to the begining of next sb64 row
y_ptr += y_stride * 64 - post->y_width; y_ptr += y_stride * 64 - post->y_width;
...@@ -521,7 +522,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -521,7 +522,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
v_ptr += uv_stride * 32 - post->uv_width; v_ptr += uv_stride * 32 - post->uv_width;
} }
/* skip to next SB64 row */ /* skip to next SB64 row */
mode_info_context += mis * 4 - cm->mb_cols; mode_info_context += mis * (4 << CONFIG_SB8X8) - cm->mi_cols;
} }
if (extra_sb32_row) { if (extra_sb32_row) {
const int sb32_cols = sb64_cols * 2 + extra_sb32_col; const int sb32_cols = sb64_cols * 2 + extra_sb32_col;
...@@ -532,7 +533,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -532,7 +533,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
y_ptr += 32; y_ptr += 32;
u_ptr = y_only? 0 : u_ptr + 16; u_ptr = y_only? 0 : u_ptr + 16;
v_ptr = y_only? 0 : v_ptr + 16; v_ptr = y_only? 0 : v_ptr + 16;
mode_info_context += 2; // step to next SB32 mode_info_context += 2 << CONFIG_SB8X8; // step to next SB32
} }
if (extra_mb_col) { if (extra_mb_col) {
// process 1st MB // process 1st MB
...@@ -548,7 +549,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -548,7 +549,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
y_only? NULL : v_ptr, y_only? NULL : v_ptr,
y_stride, uv_stride, dering); y_stride, uv_stride, dering);
// process 2nd MB // process 2nd MB
mi = mode_info_context + mis; mi = mode_info_context + (mis << CONFIG_SB8X8);
do_left_v = (mb_col > 0); do_left_v = (mb_col > 0);
do_above_h = 1; do_above_h = 1;
do_left_v_mbuv = 1; do_left_v_mbuv = 1;
...@@ -562,14 +563,14 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -562,14 +563,14 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
y_ptr += 16; y_ptr += 16;
u_ptr = y_only? 0 : u_ptr + 8; u_ptr = y_only? 0 : u_ptr + 8;
v_ptr = y_only? 0 : v_ptr + 8; v_ptr = y_only? 0 : v_ptr + 8;
mode_info_context++; /* step to next MB */ mode_info_context += 1 << CONFIG_SB8X8; /* step to next MB */
} }
// move pointers to the beginning of next sb64 row // move pointers to the beginning of next sb64 row
y_ptr += y_stride * 32 - post->y_width; y_ptr += y_stride * 32 - post->y_width;
u_ptr += y_only? 0 : uv_stride * 16 - post->uv_width; u_ptr += y_only? 0 : uv_stride * 16 - post->uv_width;
v_ptr += y_only? 0 : uv_stride * 16 - post->uv_width; v_ptr += y_only? 0 : uv_stride * 16 - post->uv_width;
// skip to next MB row if exist // skip to next MB row if exist
mode_info_context += mis * 2 - cm->mb_cols; mode_info_context += mis * (2 << CONFIG_SB8X8) - cm->mi_cols;
mb_row += 2; mb_row += 2;
} }
if (extra_mb_row) { if (extra_mb_row) {
...@@ -588,7 +589,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm, ...@@ -588,7 +589,7 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
y_ptr += 16; y_ptr += 16;
u_ptr = y_only? 0 : u_ptr + 8; u_ptr = y_only? 0 : u_ptr + 8;
v_ptr = y_only? 0 : v_ptr + 8; v_ptr = y_only? 0 : v_ptr + 8;
mode_info_context++; // step to next MB mode_info_context += 1 << CONFIG_SB8X8; // step to next MB
} }
} }
} }
...@@ -12,21 +12,37 @@ ...@@ -12,21 +12,37 @@
#define MVREF_NEIGHBOURS 8 #define MVREF_NEIGHBOURS 8
#if CONFIG_SB8X8
static int mb_mv_ref_search[MVREF_NEIGHBOURS][2] = { static int mb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
{0, -1}, {-1, 0}, {-1, -1}, {0, -2}, {0, -1}, {-1, 0}, {-1, -1}, {0, -3},
{-2, 0}, {-1, -2}, {-2, -1}, {-2, -2} {-3, 0}, {-1, -3}, {-3, -1}, {-3, -3}
}; };
static int sb_mv_ref_search[MVREF_NEIGHBOURS][2] = { static int sb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
{0, -1}, {-1, 0}, {1, -1}, {-1, 1}, {0, -1}, {-1, 0}, {2, -1}, {-1, 2},
{-1, -1}, {0, -2}, {-2, 0}, {-1, -2} {-1, -1}, {0, -3}, {-3, 0}, {-1, -3}
}; };
static int sb64_mv_ref_search[MVREF_NEIGHBOURS][2] = { static int sb64_mv_ref_search[MVREF_NEIGHBOURS][2] = {
{0, -1}, {-1, 0}, {1, -1}, {-1, 1}, {0, -1}, {-1, 0}, {2, -1}, {-1, 2},
{2, -1}, {-1, 2}, {3, -1}, {-1,-1} {4, -1}, {-1, 4}, {6, -1}, {-1, -1}
};
#else
static int mb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
{0, -1}, {-1, 0}, {-1, -1}, {0, -2},
{-2, 0}, {-1, -2}, {-2, -1}, {-2, -2}
}; };
static int sb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
{0, -1}, {-1, 0}, {1, -1}, {-1, 1},
{-1, -1}, {0, -2}, {-2, 0}, {-1, -2}
};
static int sb64_mv_ref_search[MVREF_NEIGHBOURS][2] = {
{0, -1}, {-1, 0}, {1, -1}, {-1, 1},
{2, -1}, {-1, 2}, {3, -1}, {-1, -1}
};
#endif
// clamp_mv_ref // clamp_mv_ref
#define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units #define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units
...@@ -160,7 +176,7 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, ...@@ -160,7 +176,7 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
int refmv_count = 0; int refmv_count = 0;
int split_count = 0; int split_count = 0;
int (*mv_ref_search)[2]; int (*mv_ref_search)[2];
const int mb_col = (-xd->mb_to_left_edge) >> 7; const int mi_col = get_mi_col(xd);
// Blank the reference vector lists and other local structures. // Blank the reference vector lists and other local structures.
vpx_memset(mv_ref_list, 0, sizeof(int_mv) * MAX_MV_REF_CANDIDATES); vpx_memset(mv_ref_list, 0, sizeof(int_mv) * MAX_MV_REF_CANDIDATES);
vpx_memset(candidate_scores, 0, sizeof(candidate_scores)); vpx_memset(candidate_scores, 0, sizeof(candidate_scores));
...@@ -176,11 +192,11 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, ...@@ -176,11 +192,11 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
// We first scan for candidate vectors that match the current reference frame // We first scan for candidate vectors that match the current reference frame
// Look at nearest neigbours // Look at nearest neigbours
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
const int mb_search_col = mb_col + mv_ref_search[i][0]; const int mi_search_col = mi_col + mv_ref_search[i][0];
if ((mb_search_col >= cm->cur_tile_mb_col_start) && if ((mi_search_col >= cm->cur_tile_mi_col_start) &&
(mb_search_col < cm->cur_tile_mb_col_end) && (mi_search_col < cm->cur_tile_mi_col_end) &&
((mv_ref_search[i][1] << 7) >= xd->mb_to_top_edge)) { ((mv_ref_search[i][1] << (7 - CONFIG_SB8X8)) >= xd->mb_to_top_edge)) {
candidate_mi = here + mv_ref_search[i][0] + candidate_mi = here + mv_ref_search[i][0] +
(mv_ref_search[i][1] * xd->mode_info_stride); (mv_ref_search[i][1] * xd->mode_info_stride);
...@@ -196,11 +212,11 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here, ...@@ -196,11 +212,11 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,