summaryrefslogtreecommitdiff
path: root/vp9/common
diff options
context:
space:
mode:
Diffstat (limited to 'vp9/common')
-rw-r--r--vp9/common/vp9_alloccommon.c1
-rw-r--r--vp9/common/vp9_entropymode.c70
-rw-r--r--vp9/common/vp9_entropymode.h5
-rw-r--r--vp9/common/vp9_findnearmv.c196
-rw-r--r--vp9/common/vp9_findnearmv.h3
-rw-r--r--vp9/common/vp9_loopfilter.c5
-rw-r--r--vp9/common/vp9_mvref_common.c20
-rw-r--r--vp9/common/vp9_onyx.h6
-rw-r--r--vp9/common/vp9_onyxc_int.h1
-rw-r--r--vp9/common/vp9_reconintra.c171
10 files changed, 218 insertions, 260 deletions
diff --git a/vp9/common/vp9_alloccommon.c b/vp9/common/vp9_alloccommon.c
index f2107d7aa..2b7ab2e98 100644
--- a/vp9/common/vp9_alloccommon.c
+++ b/vp9/common/vp9_alloccommon.c
@@ -146,6 +146,7 @@ int vp9_alloc_frame_buffers(VP9_COMMON *oci, int width, int height) {
return 0;
}
+
void vp9_setup_version(VP9_COMMON *cm) {
if (cm->version & 0x4) {
if (!CONFIG_EXPERIMENTAL)
diff --git a/vp9/common/vp9_entropymode.c b/vp9/common/vp9_entropymode.c
index ecae5e057..30e5336a2 100644
--- a/vp9/common/vp9_entropymode.c
+++ b/vp9/common/vp9_entropymode.c
@@ -11,9 +11,10 @@
#include "vp9/common/vp9_onyxc_int.h"
#include "vp9/common/vp9_modecont.h"
+#include "vp9/common/vp9_seg_common.h"
+#include "vp9/common/vp9_alloccommon.h"
#include "vpx_mem/vpx_mem.h"
-
static const unsigned int kf_y_mode_cts[8][VP9_YMODES] = {
/* DC V H D45 135 117 153 D27 D63 TM i8x8 BPRED */
{12, 6, 5, 5, 5, 5, 5, 5, 5, 2, 22, 200},
@@ -344,6 +345,9 @@ void vp9_init_mbmode_probs(VP9_COMMON *x) {
#if CONFIG_COMP_INTERINTRA_PRED
x->fc.interintra_prob = VP9_DEF_INTERINTRA_PROB;
#endif
+ x->ref_pred_probs[0] = 120;
+ x->ref_pred_probs[1] = 80;
+ x->ref_pred_probs[2] = 40;
}
@@ -480,7 +484,7 @@ void vp9_accum_mv_refs(VP9_COMMON *pc,
#define MVREF_COUNT_SAT 20
#define MVREF_MAX_UPDATE_FACTOR 128
-void vp9_update_mode_context(VP9_COMMON *pc) {
+void vp9_adapt_mode_context(VP9_COMMON *pc) {
int i, j;
unsigned int (*mv_ref_ct)[4][2];
int (*mode_context)[4];
@@ -631,3 +635,65 @@ void vp9_adapt_mode_probs(VP9_COMMON *cm) {
}
#endif
}
+
+static void set_default_lf_deltas(MACROBLOCKD *xd) {
+ xd->mode_ref_lf_delta_enabled = 1;
+ xd->mode_ref_lf_delta_update = 1;
+
+ xd->ref_lf_deltas[INTRA_FRAME] = 2;
+ xd->ref_lf_deltas[LAST_FRAME] = 0;
+ xd->ref_lf_deltas[GOLDEN_FRAME] = -2;
+ xd->ref_lf_deltas[ALTREF_FRAME] = -2;
+
+ xd->mode_lf_deltas[0] = 4; // BPRED
+ xd->mode_lf_deltas[1] = -2; // Zero
+ xd->mode_lf_deltas[2] = 2; // New mv
+ xd->mode_lf_deltas[3] = 4; // Split mv
+}
+
+void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) {
+ // Reset the segment feature data to the default stats:
+ // Features disabled, 0, with delta coding (Default state).
+ int i;
+ vp9_clearall_segfeatures(xd);
+ xd->mb_segment_abs_delta = SEGMENT_DELTADATA;
+ if (cm->last_frame_seg_map)
+ vpx_memset(cm->last_frame_seg_map, 0, (cm->mb_rows * cm->mb_cols));
+
+ /* 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_mode_lf_deltas, 0, sizeof(xd->last_mode_lf_deltas));
+ set_default_lf_deltas(xd);
+
+ vp9_default_coef_probs(cm);
+ vp9_init_mbmode_probs(cm);
+ vp9_default_bmode_probs(cm->fc.bmode_prob);
+ vp9_kf_default_bmode_probs(cm->kf_bmode_prob);
+ vp9_init_mv_probs(cm);
+ // To force update of the sharpness
+ cm->last_sharpness_level = -1;
+
+ vp9_init_mode_contexts(cm);
+
+ for (i = 0; i < NUM_FRAME_CONTEXTS; i++) {
+ vpx_memcpy(&cm->frame_contexts[i], &cm->fc, sizeof(cm->fc));
+ }
+
+ vpx_memset(cm->prev_mip, 0,
+ (cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO));
+ vpx_memset(cm->mip, 0,
+ (cm->mb_cols + 1) * (cm->mb_rows + 1)* sizeof(MODE_INFO));
+
+ vp9_update_mode_info_border(cm, cm->mip);
+ vp9_update_mode_info_in_image(cm, cm->mi);
+
+#if CONFIG_NEW_MVREF
+ // Defaults probabilities for encoding the MV ref id signal
+ vpx_memset(xd->mb_mv_ref_probs, VP9_DEFAULT_MV_REF_PROB,
+ sizeof(xd->mb_mv_ref_probs));
+#endif
+ cm->ref_frame_sign_bias[GOLDEN_FRAME] = 0;
+ cm->ref_frame_sign_bias[ALTREF_FRAME] = 0;
+
+ cm->frame_context_idx = 0;
+}
diff --git a/vp9/common/vp9_entropymode.h b/vp9/common/vp9_entropymode.h
index e03c6fe6d..aa06e49c6 100644
--- a/vp9/common/vp9_entropymode.h
+++ b/vp9/common/vp9_entropymode.h
@@ -76,11 +76,14 @@ void vp9_entropy_mode_init(void);
struct VP9Common;
+/* sets up common features to forget past dependence */
+void vp9_setup_past_independence(struct VP9Common *cm, MACROBLOCKD *xd);
+
void vp9_init_mbmode_probs(struct VP9Common *x);
extern void vp9_init_mode_contexts(struct VP9Common *pc);
-extern void vp9_update_mode_context(struct VP9Common *pc);
+extern void vp9_adapt_mode_context(struct VP9Common *pc);
extern void vp9_accum_mv_refs(struct VP9Common *pc,
MB_PREDICTION_MODE m,
diff --git a/vp9/common/vp9_findnearmv.c b/vp9/common/vp9_findnearmv.c
index 41d18dbfb..88f2ea9c1 100644
--- a/vp9/common/vp9_findnearmv.c
+++ b/vp9/common/vp9_findnearmv.c
@@ -141,130 +141,136 @@ void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
int_mv sorted_mvs[MAX_MV_REF_CANDIDATES];
int zero_seen = FALSE;
- // Default all to 0,0 if nothing else available
- nearest->as_int = near->as_int = 0;
- vpx_memset(sorted_mvs, 0, sizeof(sorted_mvs));
+ if (ref_y_buffer) {
- above_src = xd->dst.y_buffer - xd->dst.y_stride * 2;
- above_ref = ref_y_buffer - ref_y_stride * 2;
+ // Default all to 0,0 if nothing else available
+ nearest->as_int = near->as_int = 0;
+ vpx_memset(sorted_mvs, 0, sizeof(sorted_mvs));
+
+ above_src = xd->dst.y_buffer - xd->dst.y_stride * 2;
+ above_ref = ref_y_buffer - ref_y_stride * 2;
#if CONFIG_ABOVESPREFMV
- above_src -= 4;
- above_ref -= 4;
+ above_src -= 4;
+ above_ref -= 4;
#else
- left_src = xd->dst.y_buffer - 2;
- left_ref = ref_y_buffer - 2;
+ left_src = xd->dst.y_buffer - 2;
+ left_ref = ref_y_buffer - 2;
#endif
- // Limit search to the predicted best few candidates
- for(i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
- int_mv this_mv;
- int offset = 0;
- int row_offset, col_offset;
+ // Limit search to the predicted best few candidates
+ for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
+ int_mv this_mv;
+ int offset = 0;
+ int row_offset, col_offset;
- this_mv.as_int = mvlist[i].as_int;
+ this_mv.as_int = mvlist[i].as_int;
- // If we see a 0,0 vector for a second time we have reached the end of
- // the list of valid candidate vectors.
- if (!this_mv.as_int && zero_seen)
- break;
+ // If we see a 0,0 vector for a second time we have reached the end of
+ // the list of valid candidate vectors.
+ if (!this_mv.as_int && zero_seen)
+ break;
- zero_seen = zero_seen || !this_mv.as_int;
+ zero_seen = zero_seen || !this_mv.as_int;
#if !CONFIG_ABOVESPREFMV
- clamp_mv(&this_mv,
- xd->mb_to_left_edge - LEFT_TOP_MARGIN + 24,
- xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
- xd->mb_to_top_edge - LEFT_TOP_MARGIN + 24,
- xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
+ clamp_mv(&this_mv,
+ xd->mb_to_left_edge - LEFT_TOP_MARGIN + 24,
+ xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
+ xd->mb_to_top_edge - LEFT_TOP_MARGIN + 24,
+ xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
#else
- clamp_mv(&this_mv,
- xd->mb_to_left_edge - LEFT_TOP_MARGIN + 32,
- xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
- xd->mb_to_top_edge - LEFT_TOP_MARGIN + 24,
- xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
+ clamp_mv(&this_mv,
+ xd->mb_to_left_edge - LEFT_TOP_MARGIN + 32,
+ xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN,
+ xd->mb_to_top_edge - LEFT_TOP_MARGIN + 24,
+ xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN);
#endif
- row_offset = this_mv.as_mv.row >> 3;
- col_offset = this_mv.as_mv.col >> 3;
- offset = ref_y_stride * row_offset + col_offset;
- score = 0;
- if (xd->up_available) {
- vp9_sub_pixel_variance16x2(above_ref + offset, ref_y_stride,
- SP(this_mv.as_mv.col),
- SP(this_mv.as_mv.row),
- above_src, xd->dst.y_stride, &sse);
- score += sse;
- if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB32X32) {
- vp9_sub_pixel_variance16x2(above_ref + offset + 16,
- ref_y_stride,
+ row_offset = this_mv.as_mv.row >> 3;
+ col_offset = this_mv.as_mv.col >> 3;
+ offset = ref_y_stride * row_offset + col_offset;
+ score = 0;
+ if (xd->up_available) {
+ vp9_sub_pixel_variance16x2(above_ref + offset, ref_y_stride,
SP(this_mv.as_mv.col),
SP(this_mv.as_mv.row),
- above_src + 16, xd->dst.y_stride, &sse);
+ above_src, xd->dst.y_stride, &sse);
score += sse;
- }
- if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB64X64) {
- vp9_sub_pixel_variance16x2(above_ref + offset + 32,
- ref_y_stride,
- SP(this_mv.as_mv.col),
- SP(this_mv.as_mv.row),
- above_src + 32, xd->dst.y_stride, &sse);
- score += sse;
- vp9_sub_pixel_variance16x2(above_ref + offset + 48,
- ref_y_stride,
- SP(this_mv.as_mv.col),
- SP(this_mv.as_mv.row),
- above_src + 48, xd->dst.y_stride, &sse);
- score += sse;
- }
- }
-#if !CONFIG_ABOVESPREFMV
- if (xd->left_available) {
- vp9_sub_pixel_variance2x16_c(left_ref + offset, ref_y_stride,
- SP(this_mv.as_mv.col),
- SP(this_mv.as_mv.row),
- left_src, xd->dst.y_stride, &sse);
- score += sse;
- if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB32X32) {
- vp9_sub_pixel_variance2x16_c(left_ref + offset + ref_y_stride * 16,
+ if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB32X32) {
+ vp9_sub_pixel_variance16x2(above_ref + offset + 16,
ref_y_stride,
SP(this_mv.as_mv.col),
SP(this_mv.as_mv.row),
- left_src + xd->dst.y_stride * 16,
- xd->dst.y_stride, &sse);
- score += sse;
- }
- if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB64X64) {
- vp9_sub_pixel_variance2x16_c(left_ref + offset + ref_y_stride * 32,
+ above_src + 16, xd->dst.y_stride, &sse);
+ score += sse;
+ }
+ if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB64X64) {
+ vp9_sub_pixel_variance16x2(above_ref + offset + 32,
ref_y_stride,
SP(this_mv.as_mv.col),
SP(this_mv.as_mv.row),
- left_src + xd->dst.y_stride * 32,
- xd->dst.y_stride, &sse);
- score += sse;
- vp9_sub_pixel_variance2x16_c(left_ref + offset + ref_y_stride * 48,
+ above_src + 32, xd->dst.y_stride, &sse);
+ score += sse;
+ vp9_sub_pixel_variance16x2(above_ref + offset + 48,
ref_y_stride,
SP(this_mv.as_mv.col),
SP(this_mv.as_mv.row),
- left_src + xd->dst.y_stride * 48,
- xd->dst.y_stride, &sse);
+ above_src + 48, xd->dst.y_stride, &sse);
+ score += sse;
+ }
+ }
+#if !CONFIG_ABOVESPREFMV
+ if (xd->left_available) {
+ vp9_sub_pixel_variance2x16_c(left_ref + offset, ref_y_stride,
+ SP(this_mv.as_mv.col),
+ SP(this_mv.as_mv.row),
+ left_src, xd->dst.y_stride, &sse);
score += sse;
+ if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB32X32) {
+ vp9_sub_pixel_variance2x16_c(left_ref + offset + ref_y_stride * 16,
+ ref_y_stride,
+ SP(this_mv.as_mv.col),
+ SP(this_mv.as_mv.row),
+ left_src + xd->dst.y_stride * 16,
+ xd->dst.y_stride, &sse);
+ score += sse;
+ }
+ if (xd->mode_info_context->mbmi.sb_type >= BLOCK_SIZE_SB64X64) {
+ vp9_sub_pixel_variance2x16_c(left_ref + offset + ref_y_stride * 32,
+ ref_y_stride,
+ SP(this_mv.as_mv.col),
+ SP(this_mv.as_mv.row),
+ left_src + xd->dst.y_stride * 32,
+ xd->dst.y_stride, &sse);
+ score += sse;
+ vp9_sub_pixel_variance2x16_c(left_ref + offset + ref_y_stride * 48,
+ ref_y_stride,
+ SP(this_mv.as_mv.col),
+ SP(this_mv.as_mv.row),
+ left_src + xd->dst.y_stride * 48,
+ xd->dst.y_stride, &sse);
+ score += sse;
+ }
}
- }
#endif
- // Add the entry to our list and then resort the list on score.
- ref_scores[i] = score;
- sorted_mvs[i].as_int = this_mv.as_int;
- j = i;
- while (j > 0) {
- if (ref_scores[j] < ref_scores[j-1]) {
- ref_scores[j] = ref_scores[j-1];
- sorted_mvs[j].as_int = sorted_mvs[j-1].as_int;
- ref_scores[j-1] = score;
- sorted_mvs[j-1].as_int = this_mv.as_int;
- j--;
- } else
- break;
+ // Add the entry to our list and then resort the list on score.
+ ref_scores[i] = score;
+ sorted_mvs[i].as_int = this_mv.as_int;
+ j = i;
+ while (j > 0) {
+ if (ref_scores[j] < ref_scores[j-1]) {
+ ref_scores[j] = ref_scores[j-1];
+ sorted_mvs[j].as_int = sorted_mvs[j-1].as_int;
+ ref_scores[j-1] = score;
+ sorted_mvs[j-1].as_int = this_mv.as_int;
+ j--;
+ } else {
+ break;
+ }
+ }
}
+ } else {
+ vpx_memcpy(sorted_mvs, mvlist, sizeof(sorted_mvs));
}
// Make sure all the candidates are properly clamped etc
diff --git a/vp9/common/vp9_findnearmv.h b/vp9/common/vp9_findnearmv.h
index a66a7de27..de0648291 100644
--- a/vp9/common/vp9_findnearmv.h
+++ b/vp9/common/vp9_findnearmv.h
@@ -28,7 +28,8 @@ void vp9_find_best_ref_mvs(MACROBLOCKD *xd,
int_mv *nearest,
int_mv *near);
-static void mv_bias(int refmb_ref_frame_sign_bias, int refframe, int_mv *mvp, const int *ref_frame_sign_bias) {
+static void mv_bias(int refmb_ref_frame_sign_bias, int refframe,
+ int_mv *mvp, const int *ref_frame_sign_bias) {
MV xmv;
xmv = mvp->as_mv;
diff --git a/vp9/common/vp9_loopfilter.c b/vp9/common/vp9_loopfilter.c
index 7633887a3..9ce5a6378 100644
--- a/vp9/common/vp9_loopfilter.c
+++ b/vp9/common/vp9_loopfilter.c
@@ -109,6 +109,9 @@ void vp9_loop_filter_frame_init(VP9_COMMON *cm,
loop_filter_info_n *lfi = &cm->lf_info;
/* update limits if sharpness has changed */
+ // printf("vp9_loop_filter_frame_init %d\n", default_filt_lvl);
+ // printf("sharpness level: %d [%d]\n",
+ // cm->sharpness_level, cm->last_sharpness_level);
if (cm->last_sharpness_level != cm->sharpness_level) {
vp9_loop_filter_update_sharpness(lfi, cm->sharpness_level);
cm->last_sharpness_level = cm->sharpness_level;
@@ -202,6 +205,7 @@ static int sb_mb_lf_skip(const MODE_INFO *const mip0,
mbmi1->mv[mbmi1->ref_frame].as_int) &&
mbmi0->ref_frame != INTRA_FRAME;
}
+
void vp9_loop_filter_frame(VP9_COMMON *cm,
MACROBLOCKD *xd,
int frame_filter_level,
@@ -271,7 +275,6 @@ void vp9_loop_filter_frame(VP9_COMMON *cm,
vp9_loop_filter_bv(y_ptr, u_ptr, v_ptr, post->y_stride,
post->uv_stride, &lfi);
}
-
}
/* don't apply across umv border */
if (mb_row > 0 &&
diff --git a/vp9/common/vp9_mvref_common.c b/vp9/common/vp9_mvref_common.c
index 786b02188..8d4980f08 100644
--- a/vp9/common/vp9_mvref_common.c
+++ b/vp9/common/vp9_mvref_common.c
@@ -259,12 +259,14 @@ void vp9_find_mv_refs(
split_count += (candidate_mi->mbmi.mode == SPLITMV);
}
}
- // Look in the last frame
- candidate_mi = lf_here;
- if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
- clamp_mv(xd, &c_refmv);
- addmv_and_shuffle(candidate_mvs, candidate_scores,
- &index, c_refmv, 18);
+ // Look in the last frame if it exists
+ if (lf_here) {
+ candidate_mi = lf_here;
+ if (get_matching_candidate(candidate_mi, ref_frame, &c_refmv)) {
+ clamp_mv(xd, &c_refmv);
+ addmv_and_shuffle(candidate_mvs, candidate_scores,
+ &index, c_refmv, 18);
+ }
}
// More distant neigbours
for (i = 2; (i < MVREF_NEIGHBOURS) &&
@@ -316,8 +318,8 @@ void vp9_find_mv_refs(
}
}
}
- // Look at the last frame
- if (index < (MAX_MV_REF_CANDIDATES - 1)) {
+ // Look at the last frame if it exists
+ if (index < (MAX_MV_REF_CANDIDATES - 1) && lf_here) {
candidate_mi = lf_here;
get_non_matching_candidates(candidate_mi, ref_frame,
&c_ref_frame, &c_refmv,
@@ -366,7 +368,7 @@ void vp9_find_mv_refs(
// 0,0 is always a valid reference.
for (i = 0; i < MAX_MV_REF_CANDIDATES; ++i) {
- if (candidate_mvs[i].as_int == 0)
+ if (candidate_mvs[i].as_int == 0)
break;
}
if (i == MAX_MV_REF_CANDIDATES) {
diff --git a/vp9/common/vp9_onyx.h b/vp9/common/vp9_onyx.h
index e4ad72f21..46ae2f0f4 100644
--- a/vp9/common/vp9_onyx.h
+++ b/vp9/common/vp9_onyx.h
@@ -159,6 +159,12 @@ extern "C"
int encode_breakout; // early breakout encode threshold : for video conf recommend 800
+ /* Bitfield defining the error resiliency features to enable.
+ * Can provide decodable frames after losses in previous
+ * frames and decodable partitions after losses in the same frame.
+ */
+ unsigned int error_resilient_mode;
+
int arnr_max_frames;
int arnr_strength;
int arnr_type;
diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h
index 0f40e9faa..4e2fa3799 100644
--- a/vp9/common/vp9_onyxc_int.h
+++ b/vp9/common/vp9_onyxc_int.h
@@ -276,6 +276,7 @@ typedef struct VP9Common {
int use_interintra;
#endif
+ int error_resilient_mode;
} VP9_COMMON;
static int get_free_fb(VP9_COMMON *cm) {
diff --git a/vp9/common/vp9_reconintra.c b/vp9/common/vp9_reconintra.c
index 9b2fad5b1..2828d0373 100644
--- a/vp9/common/vp9_reconintra.c
+++ b/vp9/common/vp9_reconintra.c
@@ -383,155 +383,27 @@ static void combine_interintra(MB_PREDICTION_MODE mode,
static const int scale_max = 256; // 1 << scale_bits;
static const int scale_round = 127; // (1 << (scale_bits - 1));
// This table is a function A + B*exp(-kx), where x is hor. index
- static const int weights1d[32] = {
- 128, 122, 116, 111, 107, 103, 99, 96,
- 93, 90, 88, 85, 83, 81, 80, 78,
- 77, 76, 75, 74, 73, 72, 71, 70,
- 70, 69, 69, 68, 68, 68, 67, 67,
+ static const int weights1d[64] = {
+ 128, 125, 122, 119, 116, 114, 111, 109,
+ 107, 105, 103, 101, 99, 97, 96, 94,
+ 93, 91, 90, 89, 88, 86, 85, 84,
+ 83, 82, 81, 81, 80, 79, 78, 78,
+ 77, 76, 76, 75, 75, 74, 74, 73,
+ 73, 72, 72, 71, 71, 71, 70, 70,
+ 70, 70, 69, 69, 69, 69, 68, 68,
+ 68, 68, 68, 67, 67, 67, 67, 67,
};
- // This table is a function A + B*exp(-k.sqrt(xy)), where x, y are
- // hor. and vert. indices
- static const int weights2d[1024] = {
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 128, 128, 128, 128, 128, 128, 128,
- 128, 122, 120, 118, 116, 115, 114, 113,
- 112, 111, 111, 110, 109, 109, 108, 107,
- 107, 106, 106, 105, 105, 104, 104, 104,
- 103, 103, 102, 102, 102, 101, 101, 101,
- 128, 120, 116, 114, 112, 111, 109, 108,
- 107, 106, 105, 104, 103, 102, 102, 101,
- 100, 100, 99, 99, 98, 97, 97, 96,
- 96, 96, 95, 95, 94, 94, 93, 93,
- 128, 118, 114, 111, 109, 107, 106, 104,
- 103, 102, 101, 100, 99, 98, 97, 97,
- 96, 95, 95, 94, 93, 93, 92, 92,
- 91, 91, 90, 90, 90, 89, 89, 88,
- 128, 116, 112, 109, 107, 105, 103, 102,
- 100, 99, 98, 97, 96, 95, 94, 93,
- 93, 92, 91, 91, 90, 90, 89, 89,
- 88, 88, 87, 87, 86, 86, 85, 85,
- 128, 115, 111, 107, 105, 103, 101, 99,
- 98, 97, 96, 94, 93, 93, 92, 91,
- 90, 89, 89, 88, 88, 87, 86, 86,
- 85, 85, 84, 84, 84, 83, 83, 82,
- 128, 114, 109, 106, 103, 101, 99, 97,
- 96, 95, 93, 92, 91, 90, 90, 89,
- 88, 87, 87, 86, 85, 85, 84, 84,
- 83, 83, 82, 82, 82, 81, 81, 80,
- 128, 113, 108, 104, 102, 99, 97, 96,
- 94, 93, 92, 91, 90, 89, 88, 87,
- 86, 85, 85, 84, 84, 83, 83, 82,
- 82, 81, 81, 80, 80, 79, 79, 79,
- 128, 112, 107, 103, 100, 98, 96, 94,
- 93, 91, 90, 89, 88, 87, 86, 85,
- 85, 84, 83, 83, 82, 82, 81, 80,
- 80, 80, 79, 79, 78, 78, 78, 77,
- 128, 111, 106, 102, 99, 97, 95, 93,
- 91, 90, 89, 88, 87, 86, 85, 84,
- 83, 83, 82, 81, 81, 80, 80, 79,
- 79, 78, 78, 77, 77, 77, 76, 76,
- 128, 111, 105, 101, 98, 96, 93, 92,
- 90, 89, 88, 86, 85, 84, 84, 83,
- 82, 81, 81, 80, 80, 79, 79, 78,
- 78, 77, 77, 76, 76, 76, 75, 75,
- 128, 110, 104, 100, 97, 94, 92, 91,
- 89, 88, 86, 85, 84, 83, 83, 82,
- 81, 80, 80, 79, 79, 78, 78, 77,
- 77, 76, 76, 75, 75, 75, 74, 74,
- 128, 109, 103, 99, 96, 93, 91, 90,
- 88, 87, 85, 84, 83, 82, 82, 81,
- 80, 79, 79, 78, 78, 77, 77, 76,
- 76, 75, 75, 75, 74, 74, 74, 73,
- 128, 109, 102, 98, 95, 93, 90, 89,
- 87, 86, 84, 83, 82, 81, 81, 80,
- 79, 78, 78, 77, 77, 76, 76, 75,
- 75, 75, 74, 74, 73, 73, 73, 73,
- 128, 108, 102, 97, 94, 92, 90, 88,
- 86, 85, 84, 83, 82, 81, 80, 79,
- 78, 78, 77, 77, 76, 76, 75, 75,
- 74, 74, 73, 73, 73, 73, 72, 72,
- 128, 107, 101, 97, 93, 91, 89, 87,
- 85, 84, 83, 82, 81, 80, 79, 78,
- 78, 77, 76, 76, 75, 75, 74, 74,
- 74, 73, 73, 73, 72, 72, 72, 71,
- 128, 107, 100, 96, 93, 90, 88, 86,
- 85, 83, 82, 81, 80, 79, 78, 78,
- 77, 76, 76, 75, 75, 74, 74, 73,
- 73, 73, 72, 72, 72, 71, 71, 71,
- 128, 106, 100, 95, 92, 89, 87, 85,
- 84, 83, 81, 80, 79, 78, 78, 77,
- 76, 76, 75, 75, 74, 74, 73, 73,
- 72, 72, 72, 72, 71, 71, 71, 70,
- 128, 106, 99, 95, 91, 89, 87, 85,
- 83, 82, 81, 80, 79, 78, 77, 76,
- 76, 75, 75, 74, 74, 73, 73, 72,
- 72, 72, 71, 71, 71, 71, 70, 70,
- 128, 105, 99, 94, 91, 88, 86, 84,
- 83, 81, 80, 79, 78, 77, 77, 76,
- 75, 75, 74, 74, 73, 73, 72, 72,
- 72, 71, 71, 71, 70, 70, 70, 70,
- 128, 105, 98, 93, 90, 88, 85, 84,
- 82, 81, 80, 79, 78, 77, 76, 75,
- 75, 74, 74, 73, 73, 72, 72, 71,
- 71, 71, 71, 70, 70, 70, 70, 69,
- 128, 104, 97, 93, 90, 87, 85, 83,
- 82, 80, 79, 78, 77, 76, 76, 75,
- 74, 74, 73, 73, 72, 72, 71, 71,
- 71, 70, 70, 70, 70, 69, 69, 69,
- 128, 104, 97, 92, 89, 86, 84, 83,
- 81, 80, 79, 78, 77, 76, 75, 74,
- 74, 73, 73, 72, 72, 71, 71, 71,
- 70, 70, 70, 70, 69, 69, 69, 69,
- 128, 104, 96, 92, 89, 86, 84, 82,
- 80, 79, 78, 77, 76, 75, 75, 74,
- 73, 73, 72, 72, 71, 71, 71, 70,
- 70, 70, 70, 69, 69, 69, 69, 68,
- 128, 103, 96, 91, 88, 85, 83, 82,
- 80, 79, 78, 77, 76, 75, 74, 74,
- 73, 72, 72, 72, 71, 71, 70, 70,
- 70, 70, 69, 69, 69, 69, 68, 68,
- 128, 103, 96, 91, 88, 85, 83, 81,
- 80, 78, 77, 76, 75, 75, 74, 73,
- 73, 72, 72, 71, 71, 70, 70, 70,
- 70, 69, 69, 69, 69, 68, 68, 68,
- 128, 102, 95, 90, 87, 84, 82, 81,
- 79, 78, 77, 76, 75, 74, 73, 73,
- 72, 72, 71, 71, 71, 70, 70, 70,
- 69, 69, 69, 69, 68, 68, 68, 68,
- 128, 102, 95, 90, 87, 84, 82, 80,
- 79, 77, 76, 75, 75, 74, 73, 73,
- 72, 72, 71, 71, 70, 70, 70, 69,
- 69, 69, 69, 68, 68, 68, 68, 68,
- 128, 102, 94, 90, 86, 84, 82, 80,
- 78, 77, 76, 75, 74, 73, 73, 72,
- 72, 71, 71, 70, 70, 70, 69, 69,
- 69, 69, 68, 68, 68, 68, 68, 67,
- 128, 101, 94, 89, 86, 83, 81, 79,
- 78, 77, 76, 75, 74, 73, 73, 72,
- 71, 71, 71, 70, 70, 69, 69, 69,
- 69, 68, 68, 68, 68, 68, 67, 67,
- 128, 101, 93, 89, 85, 83, 81, 79,
- 78, 76, 75, 74, 74, 73, 72, 72,
- 71, 71, 70, 70, 70, 69, 69, 69,
- 68, 68, 68, 68, 68, 67, 67, 67,
- 128, 101, 93, 88, 85, 82, 80, 79,
- 77, 76, 75, 74, 73, 73, 72, 71,
- 71, 70, 70, 70, 69, 69, 69, 68,
- 68, 68, 68, 68, 67, 67, 67, 67,
- };
- int size_scale = (size >= 32 ? 1 :
- size == 16 ? 2 :
- size == 8 ? 4 : 8);
- int size_shift = size == 64 ? 1 : 0;
+ int size_scale = (size >= 64 ? 1:
+ size == 32 ? 2 :
+ size == 16 ? 4 :
+ size == 8 ? 8 : 16);
int i, j;
switch (mode) {
case V_PRED:
for (i = 0; i < size; ++i) {
for (j = 0; j < size; ++j) {
int k = i * interstride + j;
- int scale = weights1d[i * size_scale >> size_shift];
+ int scale = weights1d[i * size_scale];
interpred[k] =
((scale_max - scale) * interpred[k] +
scale * intrapred[i * intrastride + j] + scale_round)
@@ -544,7 +416,7 @@ static void combine_interintra(MB_PREDICTION_MODE mode,
for (i = 0; i < size; ++i) {
for (j = 0; j < size; ++j) {
int k = i * interstride + j;
- int scale = weights1d[j * size_scale >> size_shift];
+ int scale = weights1d[j * size_scale];
interpred[k] =
((scale_max - scale) * interpred[k] +
scale * intrapred[i * intrastride + j] + scale_round)
@@ -558,9 +430,8 @@ static void combine_interintra(MB_PREDICTION_MODE mode,
for (i = 0; i < size; ++i) {
for (j = 0; j < size; ++j) {
int k = i * interstride + j;
- int scale = (weights2d[(i * size_scale * 32 +
- j * size_scale) >> size_shift] +
- weights1d[i * size_scale >> size_shift]) >> 1;
+ int scale = (weights1d[i * size_scale] * 3 +
+ weights1d[j * size_scale]) >> 2;
interpred[k] =
((scale_max - scale) * interpred[k] +
scale * intrapred[i * intrastride + j] + scale_round)
@@ -574,9 +445,8 @@ static void combine_interintra(MB_PREDICTION_MODE mode,
for (i = 0; i < size; ++i) {
for (j = 0; j < size; ++j) {
int k = i * interstride + j;
- int scale = (weights2d[(i * size_scale * 32 +
- j * size_scale) >> size_shift] +
- weights1d[j * size_scale >> size_shift]) >> 1;
+ int scale = (weights1d[j * size_scale] * 3 +
+ weights1d[i * size_scale]) >> 2;
interpred[k] =
((scale_max - scale) * interpred[k] +
scale * intrapred[i * intrastride + j] + scale_round)
@@ -589,8 +459,7 @@ static void combine_interintra(MB_PREDICTION_MODE mode,
for (i = 0; i < size; ++i) {
for (j = 0; j < size; ++j) {
int k = i * interstride + j;
- int scale = weights2d[(i * size_scale * 32 +
- j * size_scale) >> size_shift];
+ int scale = weights1d[(i < j ? i : j) * size_scale];
interpred[k] =
((scale_max - scale) * interpred[k] +
scale * intrapred[i * intrastride + j] + scale_round)