ref: 90517b5e8596996bf41aec85f80bd5b20e13e140
parent: 5eee2a88f88ff1d475b12e62357c38399b583802
parent: 718feb0f69c471170c2696a6bb0d16e786f5611f
author: Yaowu Xu <[email protected]>
date: Tue Apr 7 12:29:45 EDT 2015
Merge "move ref_frame_cost computations into a function"
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -982,6 +982,24 @@
*rd_cost = best_rdc;
}
+static void init_ref_frame_cost(VP9_COMMON *const cm,
+ MACROBLOCKD *const xd,
+ int ref_frame_cost[MAX_REF_FRAMES]) {
+ vp9_prob intra_inter_p = vp9_get_intra_inter_prob(cm, xd);
+ vp9_prob ref_single_p1 = vp9_get_pred_prob_single_ref_p1(cm, xd);
+ vp9_prob ref_single_p2 = vp9_get_pred_prob_single_ref_p2(cm, xd);
+
+ ref_frame_cost[INTRA_FRAME] = vp9_cost_bit(intra_inter_p, 0);
+ ref_frame_cost[LAST_FRAME] = ref_frame_cost[GOLDEN_FRAME] =
+ ref_frame_cost[ALTREF_FRAME] = vp9_cost_bit(intra_inter_p, 1);
+
+ ref_frame_cost[LAST_FRAME] += vp9_cost_bit(ref_single_p1, 0);
+ ref_frame_cost[GOLDEN_FRAME] += vp9_cost_bit(ref_single_p1, 1);
+ ref_frame_cost[ALTREF_FRAME] += vp9_cost_bit(ref_single_p1, 1);
+ ref_frame_cost[GOLDEN_FRAME] += vp9_cost_bit(ref_single_p2, 0);
+ ref_frame_cost[ALTREF_FRAME] += vp9_cost_bit(ref_single_p2, 1);
+}
+
typedef struct {
MV_REFERENCE_FRAME ref_frame;
PREDICTION_MODE pred_mode;
@@ -1060,19 +1078,8 @@
int best_pred_sad = INT_MAX;
int best_early_term = 0;
int ref_frame_cost[MAX_REF_FRAMES];
- vp9_prob intra_inter_p = vp9_get_intra_inter_prob(cm, xd);
- vp9_prob ref_single_p1 = vp9_get_pred_prob_single_ref_p1(cm, xd);
- vp9_prob ref_single_p2 = vp9_get_pred_prob_single_ref_p2(cm, xd);
- ref_frame_cost[INTRA_FRAME] = vp9_cost_bit(intra_inter_p, 0);
- ref_frame_cost[LAST_FRAME] = ref_frame_cost[GOLDEN_FRAME] =
- ref_frame_cost[ALTREF_FRAME] = vp9_cost_bit(intra_inter_p, 1);
-
- ref_frame_cost[LAST_FRAME] += vp9_cost_bit(ref_single_p1, 0);
- ref_frame_cost[GOLDEN_FRAME] += vp9_cost_bit(ref_single_p1, 1);
- ref_frame_cost[ALTREF_FRAME] += vp9_cost_bit(ref_single_p1, 1);
- ref_frame_cost[GOLDEN_FRAME] += vp9_cost_bit(ref_single_p2, 0);
- ref_frame_cost[ALTREF_FRAME] += vp9_cost_bit(ref_single_p2, 1);
+ init_ref_frame_cost(cm, xd, ref_frame_cost);
if (reuse_inter_pred) {
int i;