summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott LaVarnway <slavarnway@google.com>2011-02-01 11:26:04 -0500
committerScott LaVarnway <slavarnway@google.com>2011-02-01 11:26:04 -0500
commitb18df82e1d40ac30f97e6ab22b63efe28bbfca2a (patch)
tree06d485abeec74171d7f44adf4ddb0763b35dc767
parent4e7e79f770536bb350e5c66e26590d861bca4a38 (diff)
downloadlibvpx-b18df82e1d40ac30f97e6ab22b63efe28bbfca2a.tar
libvpx-b18df82e1d40ac30f97e6ab22b63efe28bbfca2a.tar.gz
libvpx-b18df82e1d40ac30f97e6ab22b63efe28bbfca2a.tar.bz2
libvpx-b18df82e1d40ac30f97e6ab22b63efe28bbfca2a.zip
Moved rd calculation into vp8_pick_intra4x4mby_modes
Then removed unnecessary code. Change-Id: I142658815d843c9396b07881dbdd8d387c43c90e
-rw-r--r--vp8/encoder/encodeframe.c7
-rw-r--r--vp8/encoder/pickinter.c29
2 files changed, 11 insertions, 25 deletions
diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c
index 4c23a5f09..08fb6e5a0 100644
--- a/vp8/encoder/encodeframe.c
+++ b/vp8/encoder/encodeframe.c
@@ -1197,12 +1197,7 @@ int vp8cx_encode_intra_macro_block(VP8_COMP *cpi, MACROBLOCK *x, TOKENEXTRA **t)
}
x->e_mbd.mode_info_context->mbmi.mode = best_mode;
- vp8_pick_intra4x4mby_modes(IF_RTCD(&cpi->rtcd), x, &rate2, &best_distortion);
-
- if (best_distortion == INT_MAX)
- Error4x4 = INT_MAX;
- else
- Error4x4 = RD_ESTIMATE(x->rdmult, x->rddiv, rate2, best_distortion);
+ Error4x4 = vp8_pick_intra4x4mby_modes(IF_RTCD(&cpi->rtcd), x, &rate2, &best_distortion);
}
if (Error4x4 < Error16x16)
diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c
index 2b0f57508..cfaf49775 100644
--- a/vp8/encoder/pickinter.c
+++ b/vp8/encoder/pickinter.c
@@ -168,8 +168,6 @@ static int pick_intra4x4block(
B_PREDICTION_MODE *best_mode,
B_PREDICTION_MODE above,
B_PREDICTION_MODE left,
- ENTROPY_CONTEXT *a,
- ENTROPY_CONTEXT *l,
int *bestrate,
int *bestdistortion)
@@ -179,8 +177,6 @@ static int pick_intra4x4block(
int rate;
int distortion;
unsigned int *mode_costs;
- (void) l;
- (void) a;
if (x->e_mbd.frame_type == KEY_FRAME)
{
@@ -211,6 +207,7 @@ static int pick_intra4x4block(
b->bmi.mode = (B_PREDICTION_MODE)(*best_mode);
vp8_encode_intra4x4block(rtcd, x, be, b, b->bmi.mode);
+
return best_rd;
}
@@ -220,17 +217,8 @@ int vp8_pick_intra4x4mby_modes(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *mb, int
MACROBLOCKD *const xd = &mb->e_mbd;
int i;
int cost = mb->mbmode_cost [xd->frame_type] [B_PRED];
- int error = RD_ESTIMATE(mb->rdmult, mb->rddiv, cost, 0); // Rd estimate for the cost of the block prediction mode
+ int error;
int distortion = 0;
- ENTROPY_CONTEXT_PLANES t_above, t_left;
- ENTROPY_CONTEXT *ta;
- ENTROPY_CONTEXT *tl;
-
- vpx_memcpy(&t_above, mb->e_mbd.above_context, sizeof(ENTROPY_CONTEXT_PLANES));
- vpx_memcpy(&t_left, mb->e_mbd.left_context, sizeof(ENTROPY_CONTEXT_PLANES));
-
- ta = (ENTROPY_CONTEXT *)&t_above;
- tl = (ENTROPY_CONTEXT *)&t_left;
vp8_intra_prediction_down_copy(xd);
@@ -243,10 +231,8 @@ int vp8_pick_intra4x4mby_modes(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *mb, int
B_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode);
int UNINITIALIZED_IS_SAFE(r), UNINITIALIZED_IS_SAFE(d);
- error += pick_intra4x4block(rtcd,
- mb, mb->block + i, xd->block + i, &best_mode, A, L,
- ta + vp8_block2above[i],
- tl + vp8_block2left[i], &r, &d);
+ pick_intra4x4block(rtcd, mb, mb->block + i, xd->block + i,
+ &best_mode, A, L, &r, &d);
cost += r;
distortion += d;
@@ -264,10 +250,15 @@ int vp8_pick_intra4x4mby_modes(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *mb, int
*Rate = cost;
if (i == 16)
+ {
*best_dist = distortion;
+ error = RD_ESTIMATE(mb->rdmult, mb->rddiv, cost, distortion);
+ }
else
+ {
*best_dist = INT_MAX;
-
+ error = INT_MAX;
+ }
return error;
}