summaryrefslogtreecommitdiff
path: root/vp9
diff options
context:
space:
mode:
Diffstat (limited to 'vp9')
-rw-r--r--vp9/common/vp9_blockd.h2
-rw-r--r--vp9/common/vp9_findnearmv.c2
-rw-r--r--vp9/common/vp9_findnearmv.h2
-rw-r--r--vp9/common/vp9_mvref_common.c52
-rw-r--r--vp9/decoder/vp9_decodemv.c133
-rw-r--r--vp9/decoder/vp9_decodframe.c29
-rw-r--r--vp9/encoder/vp9_encodeframe.c3
-rw-r--r--vp9/encoder/vp9_onyx_if.c44
-rw-r--r--vp9/encoder/vp9_onyx_int.h6
-rw-r--r--vp9/encoder/vp9_rdopt.c20
-rw-r--r--vp9/encoder/vp9_segmentation.c44
-rw-r--r--vp9/encoder/vp9_segmentation.h2
12 files changed, 90 insertions, 249 deletions
diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h
index be48ab31b..aa48958b0 100644
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -41,7 +41,7 @@
#define SEGMENT_DELTADATA 0
#define SEGMENT_ABSDATA 1
#define MAX_MV_REFS 9
-#define MAX_MV_REF_CANDIDATES 4
+#define MAX_MV_REF_CANDIDATES 2
typedef enum {
PLANE_TYPE_Y_WITH_DC,
diff --git a/vp9/common/vp9_findnearmv.c b/vp9/common/vp9_findnearmv.c
index 832e8ddf1..b5a32d9b3 100644
--- a/vp9/common/vp9_findnearmv.c
+++ b/vp9/common/vp9_findnearmv.c
@@ -39,8 +39,6 @@ vp9_prob *vp9_mv_ref_probs(VP9_COMMON *pc, vp9_prob p[4], int context) {
}
void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
- uint8_t *ref_y_buffer,
- int ref_y_stride,
int_mv *mvlist,
int_mv *nearest,
int_mv *near) {
diff --git a/vp9/common/vp9_findnearmv.h b/vp9/common/vp9_findnearmv.h
index c360c20eb..085454512 100644
--- a/vp9/common/vp9_findnearmv.h
+++ b/vp9/common/vp9_findnearmv.h
@@ -24,8 +24,6 @@
// above and a number cols of pixels in the left to select the one with best
// score to use as ref motion vector
void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
- uint8_t *ref_y_buffer,
- int ref_y_stride,
int_mv *mvlist,
int_mv *nearest,
int_mv *near);
diff --git a/vp9/common/vp9_mvref_common.c b/vp9/common/vp9_mvref_common.c
index d8ac68829..fa4158f84 100644
--- a/vp9/common/vp9_mvref_common.c
+++ b/vp9/common/vp9_mvref_common.c
@@ -17,28 +17,16 @@ static int mb_mv_ref_search[MVREF_NEIGHBOURS][2] = {
{-2, 0}, {-1, -2}, {-2, -1}, {-2, -2}
};
-static int mb_ref_distance_weight[MVREF_NEIGHBOURS] =
- { 3, 3, 2, 1, 1, 1, 1, 1 };
-
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 sb_ref_distance_weight[MVREF_NEIGHBOURS] =
- { 3, 3, 2, 2, 2, 1, 1, 1 };
-
-
-
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}
};
-static int sb64_ref_distance_weight[MVREF_NEIGHBOURS] =
- { 1, 1, 1, 1, 1, 1, 1, 1 };
-
-
// clamp_mv_ref
#define MV_BORDER (16 << 3) // Allow 16 pels in 1/8th pel units
@@ -164,7 +152,6 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
int i;
MODE_INFO *candidate_mi;
MB_MODE_INFO * mbmi = &xd->mode_info_context->mbmi;
- int_mv candidate_mvs[MAX_MV_REF_CANDIDATES];
int_mv c_refmv;
int_mv c2_refmv;
MV_REFERENCE_FRAME c_ref_frame;
@@ -173,23 +160,17 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
int refmv_count = 0;
int split_count = 0;
int (*mv_ref_search)[2];
- int *ref_distance_weight;
const int mb_col = (-xd->mb_to_left_edge) >> 7;
-
// Blank the reference vector lists and other local structures.
vpx_memset(mv_ref_list, 0, sizeof(int_mv) * MAX_MV_REF_CANDIDATES);
- vpx_memset(candidate_mvs, 0, sizeof(int_mv) * MAX_MV_REF_CANDIDATES);
vpx_memset(candidate_scores, 0, sizeof(candidate_scores));
if (mbmi->sb_type == BLOCK_SIZE_SB64X64) {
mv_ref_search = sb64_mv_ref_search;
- ref_distance_weight = sb64_ref_distance_weight;
} else if (mbmi->sb_type >= BLOCK_SIZE_SB32X32) {
mv_ref_search = sb_mv_ref_search;
- ref_distance_weight = sb_ref_distance_weight;
} else {
mv_ref_search = mb_mv_ref_search;
- ref_distance_weight = mb_ref_distance_weight;
}
// We first scan for candidate vectors that match the current reference frame
@@ -205,8 +186,8 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
(mv_ref_search[i][1] * xd->mode_info_stride);
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
- add_candidate_mv(candidate_mvs, candidate_scores,
- &refmv_count, c_refmv, ref_distance_weight[i] + 16);
+ add_candidate_mv(mv_ref_list, candidate_scores,
+ &refmv_count, c_refmv, 16);
}
split_count += (candidate_mi->mbmi.mode == SPLITMV);
}
@@ -224,8 +205,8 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
(mv_ref_search[i][1] * xd->mode_info_stride);
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
- add_candidate_mv(candidate_mvs, candidate_scores,
- &refmv_count, c_refmv, ref_distance_weight[i] + 16);
+ add_candidate_mv(mv_ref_list, candidate_scores,
+ &refmv_count, c_refmv, 16);
}
}
}
@@ -234,8 +215,8 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
if (lf_here && (refmv_count < MAX_MV_REF_CANDIDATES)) {
candidate_mi = lf_here;
if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
- add_candidate_mv(candidate_mvs, candidate_scores,
- &refmv_count, c_refmv, 17);
+ add_candidate_mv(mv_ref_list, candidate_scores,
+ &refmv_count, c_refmv, 16);
}
}
@@ -259,14 +240,14 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
if (c_ref_frame != INTRA_FRAME) {
scale_mv(xd, ref_frame, c_ref_frame, &c_refmv, ref_sign_bias);
- add_candidate_mv(candidate_mvs, candidate_scores,
- &refmv_count, c_refmv, ref_distance_weight[i]);
+ add_candidate_mv(mv_ref_list, candidate_scores,
+ &refmv_count, c_refmv, 1);
}
if (c2_ref_frame != INTRA_FRAME) {
scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias);
- add_candidate_mv(candidate_mvs, candidate_scores,
- &refmv_count, c2_refmv, ref_distance_weight[i]);
+ add_candidate_mv(mv_ref_list, candidate_scores,
+ &refmv_count, c2_refmv, 1);
}
}
}
@@ -280,20 +261,20 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
if (c_ref_frame != INTRA_FRAME) {
scale_mv(xd, ref_frame, c_ref_frame, &c_refmv, ref_sign_bias);
- add_candidate_mv(candidate_mvs, candidate_scores,
+ add_candidate_mv(mv_ref_list, candidate_scores,
&refmv_count, c_refmv, 1);
}
if (c2_ref_frame != INTRA_FRAME) {
scale_mv(xd, ref_frame, c2_ref_frame, &c2_refmv, ref_sign_bias);
- add_candidate_mv(candidate_mvs, candidate_scores,
+ add_candidate_mv(mv_ref_list, candidate_scores,
&refmv_count, c2_refmv, 1);
}
}
// Define inter mode coding context.
// 0,0 was best
- if (candidate_mvs[0].as_int == 0) {
+ if (mv_ref_list[0].as_int == 0) {
// 0,0 is only candidate
if (refmv_count <= 1) {
mbmi->mb_mode_context[ref_frame] = 0;
@@ -311,11 +292,8 @@ void vp9_find_mv_refs(VP9_COMMON *cm, MACROBLOCKD *xd, MODE_INFO *here,
mbmi->mb_mode_context[ref_frame] = candidate_scores[0] >= 16 ? 5 : 6;
}
- // Scan for 0,0 case and clamp non zero choices
+ // Clamp vectors
for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
- clamp_mv_ref(xd, &candidate_mvs[i]);
+ clamp_mv_ref(xd, &mv_ref_list[i]);
}
-
- // Copy over the candidate list.
- vpx_memcpy(mv_ref_list, candidate_mvs, sizeof(candidate_mvs));
}
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index 9b3cc03aa..0c2bebfbc 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -73,14 +73,10 @@ static MB_PREDICTION_MODE read_uv_mode(vp9_reader *r, const vp9_prob *p) {
return (MB_PREDICTION_MODE)treed_read(r, vp9_uv_mode_tree, p);
}
-// This function reads the current macro block's segnent id from the bitstream
-// It should only be called if a segment map update is indicated.
-static void read_mb_segid(vp9_reader *r, MB_MODE_INFO *mi, MACROBLOCKD *xd) {
- if (xd->segmentation_enabled && xd->update_mb_segmentation_map) {
- const vp9_prob *const p = xd->mb_segment_tree_probs;
- mi->segment_id = vp9_read(r, p[0]) ? 2 + vp9_read(r, p[2])
- : vp9_read(r, p[1]);
- }
+static int read_mb_segid(vp9_reader *r, MACROBLOCKD *xd) {
+ const vp9_prob *const p = xd->mb_segment_tree_probs;
+ return vp9_read(r, p[0]) ? 2 + vp9_read(r, p[2])
+ : vp9_read(r, p[1]);
}
// This function reads the current macro block's segnent id from the bitstream
@@ -98,6 +94,52 @@ static int read_mb_segid_except(vp9_reader *r,
: (pred_seg_id >= 2 ? vp9_read(r, p[1]) : (pred_seg_id == 0));
}
+static void set_segment_id(VP9_COMMON *cm, MB_MODE_INFO *mbmi,
+ int mb_row, int mb_col, int segment_id) {
+ const int mb_index = mb_row * cm->mb_cols + mb_col;
+ const BLOCK_SIZE_TYPE sb_type = mbmi->sb_type;
+ if (sb_type) {
+ const int bw = 1 << mb_width_log2(sb_type);
+ const int bh = 1 << mb_height_log2(sb_type);
+ const int ymbs = MIN(cm->mb_rows - mb_row, bh);
+ const int xmbs = MIN(cm->mb_cols - mb_col, bw);
+ int x, y;
+
+ for (y = 0; y < ymbs; y++) {
+ for (x = 0; x < xmbs; x++) {
+ const int index = mb_index + (y * cm->mb_cols + x);
+ cm->last_frame_seg_map[index] = segment_id;
+ }
+ }
+ } else {
+ cm->last_frame_seg_map[mb_index] = segment_id;
+ }
+}
+
+static int get_segment_id(VP9_COMMON *cm, MB_MODE_INFO *mbmi,
+ int mb_row, int mb_col) {
+ const int mb_index = mb_row * cm->mb_cols + mb_col;
+ const BLOCK_SIZE_TYPE sb_type = mbmi->sb_type;
+ if (sb_type) {
+ const int bw = 1 << mb_width_log2(sb_type);
+ const int bh = 1 << mb_height_log2(sb_type);
+ const int ymbs = MIN(cm->mb_rows - mb_row, bh);
+ const int xmbs = MIN(cm->mb_cols - mb_col, bw);
+ int segment_id = INT_MAX;
+ int x, y;
+
+ for (y = 0; y < ymbs; y++) {
+ for (x = 0; x < xmbs; x++) {
+ const int index = mb_index + (y * cm->mb_cols + x);
+ segment_id = MIN(segment_id, cm->last_frame_seg_map[index]);
+ }
+ }
+ return segment_id;
+ } else {
+ return cm->last_frame_seg_map[mb_index];
+ }
+}
+
extern const int vp9_i8x8_block[4];
static void kfread_modes(VP9D_COMP *pbi, MODE_INFO *m,
int mb_row, int mb_col,
@@ -105,30 +147,14 @@ static void kfread_modes(VP9D_COMP *pbi, MODE_INFO *m,
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
const int mis = cm->mode_info_stride;
- const int map_index = mb_row * cm->mb_cols + mb_col;
m->mbmi.ref_frame = INTRA_FRAME;
// Read the Macroblock segmentation map if it is being updated explicitly
// this frame (reset to 0 by default).
m->mbmi.segment_id = 0;
- if (xd->update_mb_segmentation_map) {
- read_mb_segid(r, &m->mbmi, xd);
- if (m->mbmi.sb_type) {
- const int bw = 1 << mb_width_log2(m->mbmi.sb_type);
- const int bh = 1 << mb_height_log2(m->mbmi.sb_type);
- const int ymbs = MIN(cm->mb_rows - mb_row, bh);
- const int xmbs = MIN(cm->mb_cols - mb_col, bw);
- int x, y;
-
- for (y = 0; y < ymbs; y++) {
- for (x = 0; x < xmbs; x++) {
- const int index = y * cm->mb_cols + x;
- cm->last_frame_seg_map[map_index + index] = m->mbmi.segment_id;
- }
- }
- } else {
- cm->last_frame_seg_map[map_index] = m->mbmi.segment_id;
- }
+ if (xd->segmentation_enabled && xd->update_mb_segmentation_map) {
+ m->mbmi.segment_id = read_mb_segid(r, xd);
+ set_segment_id(cm, &m->mbmi, mb_row, mb_col, m->mbmi.segment_id);
}
m->mbmi.mb_skip_coeff = vp9_segfeature_active(&pbi->mb, m->mbmi.segment_id,
@@ -545,44 +571,12 @@ static void read_mb_segment_id(VP9D_COMP *pbi,
read_mb_segid_except(r, cm, xd, mb_row, mb_col);
} else {
// Normal unpredicted coding mode
- read_mb_segid(r, mbmi, xd);
+ mbmi->segment_id = read_mb_segid(r, xd);
}
- if (mbmi->sb_type) {
- const int bw = 1 << mb_width_log2(mbmi->sb_type);
- const int bh = 1 << mb_height_log2(mbmi->sb_type);
- const int ymbs = MIN(cm->mb_rows - mb_row, bh);
- const int xmbs = MIN(cm->mb_cols - mb_col, bw);
- int x, y;
-
- for (y = 0; y < ymbs; y++) {
- for (x = 0; x < xmbs; x++) {
- const int index = y * cm->mb_cols + x;
- cm->last_frame_seg_map[mb_index + index] = mbmi->segment_id;
- }
- }
- } else {
- cm->last_frame_seg_map[mb_index] = mbmi->segment_id;
- }
+ set_segment_id(cm, mbmi, mb_row, mb_col, mbmi->segment_id);
} else {
- if (mbmi->sb_type) {
- const int bw = 1 << mb_width_log2(mbmi->sb_type);
- const int bh = 1 << mb_height_log2(mbmi->sb_type);
- const int ymbs = MIN(cm->mb_rows - mb_row, bh);
- const int xmbs = MIN(cm->mb_cols - mb_col, bw);
- unsigned segment_id = -1;
- int x, y;
-
- for (y = 0; y < ymbs; y++) {
- for (x = 0; x < xmbs; x++) {
- segment_id = MIN(segment_id,
- cm->last_frame_seg_map[mb_index + x + y * cm->mb_cols]);
- }
- }
- mbmi->segment_id = segment_id;
- } else {
- mbmi->segment_id = cm->last_frame_seg_map[mb_index];
- }
+ mbmi->segment_id = get_segment_id(cm, mbmi, mb_row, mb_col);
}
} else {
// The encoder explicitly sets the segment_id to 0
@@ -684,11 +678,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
*sf0 = cm->active_ref_scale[mbmi->ref_frame - 1];
{
- const int use_prev_in_find_best_ref = sf0->x_num == sf0->x_den &&
- sf0->y_num == sf0->y_den &&
- !cm->error_resilient_mode &&
- !cm->frame_parallel_decoding_mode;
-
// Select the appropriate reference frame for this MB
const int ref_fb_idx = cm->active_ref_idx[ref_frame - 1];
@@ -717,9 +706,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
if (mbmi->mode != ZEROMV) {
vp9_find_best_ref_mvs(xd,
- use_prev_in_find_best_ref ? xd->pre.y_buffer
- : NULL,
- xd->pre.y_stride,
mbmi->ref_mvs[ref_frame],
&nearest, &nearby);
@@ -757,10 +743,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
const MV_REFERENCE_FRAME second_ref_frame = mbmi->second_ref_frame;
struct scale_factors *sf1 = &xd->scale_factor[1];
struct scale_factors *sf_uv1 = &xd->scale_factor_uv[1];
- const int use_prev_in_find_best_ref = sf1->x_num == sf1->x_den &&
- sf1->y_num == sf1->y_den &&
- !cm->error_resilient_mode &&
- !cm->frame_parallel_decoding_mode;
const int second_ref_fb_idx = cm->active_ref_idx[second_ref_frame - 1];
*sf1 = cm->active_ref_scale[second_ref_frame - 1];
@@ -774,9 +756,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
if (mbmi->mode != ZEROMV) {
vp9_find_best_ref_mvs(xd,
- use_prev_in_find_best_ref ?
- xd->second_pre.y_buffer : NULL,
- xd->second_pre.y_stride,
mbmi->ref_mvs[second_ref_frame],
&nearest_second,
&nearby_second);
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index 98378cfdb..4a136cf88 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -1158,42 +1158,43 @@ static void update_frame_size(VP9D_COMP *pbi) {
static void setup_segmentation(VP9_COMMON *pc, MACROBLOCKD *xd, vp9_reader *r) {
int i, j;
+ xd->update_mb_segmentation_map = 0;
+ xd->update_mb_segmentation_data = 0;
+
xd->segmentation_enabled = vp9_read_bit(r);
if (xd->segmentation_enabled) {
- // Read whether or not the segmentation map is being explicitly updated
- // this frame.
+ // Segmentation map update
xd->update_mb_segmentation_map = vp9_read_bit(r);
-
if (xd->update_mb_segmentation_map) {
- // Which macro block level features are enabled. Read the probs used to
- // decode the segment id for each macro block.
for (i = 0; i < MB_FEATURE_TREE_PROBS; i++)
- xd->mb_segment_tree_probs[i] = vp9_read_bit(r) ? vp9_read_prob(r) : 255;
+ xd->mb_segment_tree_probs[i] = vp9_read_bit(r) ? vp9_read_prob(r)
+ : MAX_PROB;
- // Read the prediction probs needed to decode the segment id
pc->temporal_update = vp9_read_bit(r);
if (pc->temporal_update) {
const vp9_prob *p = xd->mb_segment_tree_probs;
- vp9_prob *p_mod = xd->mb_segment_mispred_tree_probs;
+ vp9_prob *mispred_p = xd->mb_segment_mispred_tree_probs;
const int c0 = p[0] * p[1];
const int c1 = p[0] * (256 - p[1]);
const int c2 = (256 - p[0]) * p[2];
const int c3 = (256 - p[0]) * (256 - p[2]);
- p_mod[0] = get_binary_prob(c1, c2 + c3);
- p_mod[1] = get_binary_prob(c0, c2 + c3);
- p_mod[2] = get_binary_prob(c0 + c1, c3);
- p_mod[3] = get_binary_prob(c0 + c1, c2);
+ mispred_p[0] = get_binary_prob(c1, c2 + c3);
+ mispred_p[1] = get_binary_prob(c0, c2 + c3);
+ mispred_p[2] = get_binary_prob(c0 + c1, c3);
+ mispred_p[3] = get_binary_prob(c0 + c1, c2);
for (i = 0; i < PREDICTION_PROBS; i++)
- pc->segment_pred_probs[i] = vp9_read_bit(r) ? vp9_read_prob(r) : 255;
+ pc->segment_pred_probs[i] = vp9_read_bit(r) ? vp9_read_prob(r)
+ : MAX_PROB;
} else {
for (i = 0; i < PREDICTION_PROBS; i++)
- pc->segment_pred_probs[i] = 255;
+ pc->segment_pred_probs[i] = MAX_PROB;
}
}
+ // Segmentation data update
xd->update_mb_segmentation_data = vp9_read_bit(r);
if (xd->update_mb_segmentation_data) {
xd->mb_segment_abs_delta = vp9_read_bit(r);
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c
index c563e8e33..e9612b988 100644
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -551,9 +551,6 @@ static void set_offsets(VP9_COMP *cpi,
xd->above_context = cm->above_context + mb_col;
xd->left_context = cm->left_context + (mb_row & 3);
- // GF active flags data structure
- x->gf_active_ptr = (signed char *)&cpi->gf_active_flags[idx_map];
-
// Activity map pointer
x->mb_activity_ptr = &cpi->mb_activity_map[idx_map];
x->active_ptr = cpi->active_map + idx_map;
diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c
index 85ac5231d..66ed1da72 100644
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -332,10 +332,6 @@ static void dealloc_compressor_data(VP9_COMP *cpi) {
vpx_free(cpi->tok);
cpi->tok = 0;
- // Structure used to monitor GF usage
- vpx_free(cpi->gf_active_flags);
- cpi->gf_active_flags = 0;
-
// Activity mask based per mb zbin adjustments
vpx_free(cpi->mb_activity_map);
cpi->mb_activity_map = 0;
@@ -909,13 +905,6 @@ void vp9_alloc_compressor_data(VP9_COMP *cpi) {
cpi->gf_bad_count = 0;
cpi->gf_update_recommended = 0;
-
- // Structures used to minitor GF usage
- vpx_free(cpi->gf_active_flags);
- CHECK_MEM_ERROR(cpi->gf_active_flags,
- vpx_calloc(1, cm->mb_rows * cm->mb_cols));
- cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
-
vpx_free(cpi->mb_activity_map);
CHECK_MEM_ERROR(cpi->mb_activity_map,
vpx_calloc(sizeof(unsigned int),
@@ -2231,12 +2220,6 @@ static void scale_and_extend_frame(YV12_BUFFER_CONFIG *src_fb,
static void update_alt_ref_frame_stats(VP9_COMP *cpi) {
- VP9_COMMON *cm = &cpi->common;
-
- // Update data structure that monitors level of reference to last GF
- vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
- cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
-
// this frame refreshes means next frames don't unless specified by user
cpi->common.frames_since_golden = 0;
@@ -2248,18 +2231,10 @@ static void update_alt_ref_frame_stats(VP9_COMP *cpi) {
// Set the alternate reference frame active flag
cpi->source_alt_ref_active = 1;
-
-
}
static void update_golden_frame_stats(VP9_COMP *cpi) {
- VP9_COMMON *cm = &cpi->common;
-
// Update the Golden frame usage counts.
if (cpi->refresh_golden_frame) {
- // Update data structure that monitors level of reference to last GF
- vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
- cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
-
// this frame refreshes means next frames don't unless specified by user
cpi->refresh_golden_frame = 0;
cpi->common.frames_since_golden = 0;
@@ -3293,28 +3268,9 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
}
}
- // Update the GF usage maps.
- // This is done after completing the compression of a frame when all modes
- // etc. are finalized but before loop filter
- vp9_update_gf_useage_maps(cpi, cm, &cpi->mb);
-
if (cm->frame_type == KEY_FRAME)
cpi->refresh_last_frame = 1;
-#if 0
- {
- FILE *f = fopen("gfactive.stt", "a");
- fprintf(f, "%8d %8d %8d %8d %8d\n",
- cm->current_video_frame,
- (100 * cpi->gf_active_count)
- / (cpi->common.mb_rows * cpi->common.mb_cols),
- cpi->this_iiratio,
- cpi->next_iiratio,
- cpi->refresh_golden_frame);
- fclose(f);
- }
-#endif
-
cm->frame_to_show = &cm->yv12_fb[cm->new_fb_idx];
#if WRITE_RECON_BUFFER
diff --git a/vp9/encoder/vp9_onyx_int.h b/vp9/encoder/vp9_onyx_int.h
index ba7505ee5..6d309c84d 100644
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -658,12 +658,6 @@ typedef struct VP9_COMP {
unsigned int activity_avg;
unsigned int *mb_activity_map;
int *mb_norm_activity_map;
-
- // Record of which MBs still refer to last golden frame either
- // directly or through 0,0
- unsigned char *gf_active_flags;
- int gf_active_count;
-
int output_partition;
// Store last frame's MV info for next frame MV prediction
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index b940e9849..0f6d7132f 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2690,7 +2690,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
YV12_BUFFER_CONFIG *yv12 = &cm->yv12_fb[cpi->common.ref_frame_map[idx]];
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
- int use_prev_in_find_mv_refs, use_prev_in_find_best_ref;
+ int use_prev_in_find_mv_refs;
// set up scaling factors
scale[frame_type] = cpi->common.active_ref_scale[frame_type - 1];
@@ -2715,15 +2715,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
cpi->common.ref_frame_sign_bias);
// Candidate refinement carried out at encoder and decoder
- use_prev_in_find_best_ref =
- scale[frame_type].x_num == scale[frame_type].x_den &&
- scale[frame_type].y_num == scale[frame_type].y_den &&
- !cm->error_resilient_mode &&
- !cm->frame_parallel_decoding_mode;
vp9_find_best_ref_mvs(xd,
- use_prev_in_find_best_ref ?
- yv12_mb[frame_type].y_buffer : NULL,
- yv12->y_stride,
mbmi->ref_mvs[frame_type],
&frame_nearest_mv[frame_type],
&frame_near_mv[frame_type]);
@@ -2820,7 +2812,6 @@ static enum BlockSize y_bsizet_to_block_size(BLOCK_SIZE_TYPE bs) {
static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
BLOCK_SIZE_TYPE bsize,
- int *saddone, int near_sadidx[],
int mdcounts[4], int64_t txfm_cache[],
int *rate2, int *distortion, int *skippable,
int *compmode_cost,
@@ -3355,9 +3346,6 @@ static void rd_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
int distortion_uv = INT_MAX;
int64_t best_yrd = INT64_MAX;
- int near_sadidx[8] = {0, 1, 2, 3, 4, 5, 6, 7};
- int saddone = 0;
-
int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES];
int frame_mdcounts[4][4];
YV12_BUFFER_CONFIG yv12_mb[4];
@@ -3812,7 +3800,7 @@ static void rd_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
}
#endif
this_rd = handle_inter_mode(cpi, x, BLOCK_SIZE_MB16X16,
- &saddone, near_sadidx, mdcounts, txfm_cache,
+ mdcounts, txfm_cache,
&rate2, &distortion2, &skippable,
&compmode_cost,
#if CONFIG_COMP_INTERINTRA_PRED
@@ -4324,8 +4312,6 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
cpi->gld_fb_idx,
cpi->alt_fb_idx};
int mdcounts[4];
- int near_sadidx[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
- int saddone = 0;
int64_t best_rd = INT64_MAX;
int64_t best_txfm_rd[NB_TXFM_MODES];
int64_t best_txfm_diff[NB_TXFM_MODES];
@@ -4583,7 +4569,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
}
#endif
this_rd = handle_inter_mode(cpi, x, bsize,
- &saddone, near_sadidx, mdcounts, txfm_cache,
+ mdcounts, txfm_cache,
&rate2, &distortion2, &skippable,
&compmode_cost,
#if CONFIG_COMP_INTERINTRA_PRED
diff --git a/vp9/encoder/vp9_segmentation.c b/vp9/encoder/vp9_segmentation.c
index aac42f738..e48c11db1 100644
--- a/vp9/encoder/vp9_segmentation.c
+++ b/vp9/encoder/vp9_segmentation.c
@@ -15,50 +15,6 @@
#include "vp9/common/vp9_pred_common.h"
#include "vp9/common/vp9_tile_common.h"
-void vp9_update_gf_useage_maps(VP9_COMP *cpi, VP9_COMMON *cm, MACROBLOCK *x) {
- int mb_row, mb_col;
-
- MODE_INFO *this_mb_mode_info = cm->mi;
-
- x->gf_active_ptr = (signed char *)cpi->gf_active_flags;
-
- if ((cm->frame_type == KEY_FRAME) || (cpi->refresh_golden_frame)) {
- // Reset Gf useage monitors
- vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
- cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
- } else {
- // for each macroblock row in image
- for (mb_row = 0; mb_row < cm->mb_rows; mb_row++) {
- // for each macroblock col in image
- for (mb_col = 0; mb_col < cm->mb_cols; mb_col++) {
-
- // If using golden then set GF active flag if not already set.
- // If using last frame 0,0 mode then leave flag as it is
- // else if using non 0,0 motion or intra modes then clear
- // flag if it is currently set
- if ((this_mb_mode_info->mbmi.ref_frame == GOLDEN_FRAME) ||
- (this_mb_mode_info->mbmi.ref_frame == ALTREF_FRAME)) {
- if (*(x->gf_active_ptr) == 0) {
- *(x->gf_active_ptr) = 1;
- cpi->gf_active_count++;
- }
- } else if ((this_mb_mode_info->mbmi.mode != ZEROMV) &&
- *(x->gf_active_ptr)) {
- *(x->gf_active_ptr) = 0;
- cpi->gf_active_count--;
- }
-
- x->gf_active_ptr++; // Step onto next entry
- this_mb_mode_info++; // skip to next mb
-
- }
-
- // this is to account for the border
- this_mb_mode_info++;
- }
- }
-}
-
void vp9_enable_segmentation(VP9_PTR ptr) {
VP9_COMP *cpi = (VP9_COMP *)(ptr);
diff --git a/vp9/encoder/vp9_segmentation.h b/vp9/encoder/vp9_segmentation.h
index 1c90c2f2d..2183771c4 100644
--- a/vp9/encoder/vp9_segmentation.h
+++ b/vp9/encoder/vp9_segmentation.h
@@ -15,8 +15,6 @@
#include "vp9/common/vp9_blockd.h"
#include "vp9/encoder/vp9_onyx_int.h"
-void vp9_update_gf_useage_maps(VP9_COMP *cpi, VP9_COMMON *cm, MACROBLOCK *x);
-
void vp9_enable_segmentation(VP9_PTR ptr);
void vp9_disable_segmentation(VP9_PTR ptr);