ref: c8606a241f852f376b2be56b5b38058a09f1e7e5
parent: 3f2b254c38030d86dd6c4bda6a688397aa2b804f
parent: 888d0c82da0fd634aa8a03d6201540f343506d45
author: Yaowu Xu <[email protected]>
date: Wed Apr 17 10:51:55 EDT 2013
Merge "make lf_deltas dependent on filter_lvl" into experimental
--- a/vp9/common/vp9_entropymode.c
+++ b/vp9/common/vp9_entropymode.c
@@ -671,15 +671,15 @@
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[INTRA_FRAME] = 1;
xd->ref_lf_deltas[LAST_FRAME] = 0;
- xd->ref_lf_deltas[GOLDEN_FRAME] = -2;
- xd->ref_lf_deltas[ALTREF_FRAME] = -2;
+ xd->ref_lf_deltas[GOLDEN_FRAME] = -1;
+ xd->ref_lf_deltas[ALTREF_FRAME] = -1;
- xd->mode_lf_deltas[0] = 4; // I4X4_PRED
- xd->mode_lf_deltas[1] = -2; // Zero
- xd->mode_lf_deltas[2] = 2; // New mv
- xd->mode_lf_deltas[3] = 4; // Split mv
+ xd->mode_lf_deltas[0] = 2; // I4X4_PRED
+ xd->mode_lf_deltas[1] = -1; // Zero
+ xd->mode_lf_deltas[2] = 1; // New mv
+ xd->mode_lf_deltas[3] = 2; // Split mv
}
void vp9_setup_past_independence(VP9_COMMON *cm, MACROBLOCKD *xd) {
--- a/vp9/common/vp9_loopfilter.c
+++ b/vp9/common/vp9_loopfilter.c
@@ -83,9 +83,13 @@
void vp9_loop_filter_frame_init(VP9_COMMON *cm,
MACROBLOCKD *xd,
int default_filt_lvl) {
- int seg, /* segment number */
- ref, /* index in ref_lf_deltas */
- mode; /* index in mode_lf_deltas */
+ int seg, // segment number
+ ref, // index in ref_lf_deltas
+ mode; // index in mode_lf_deltas
+ // n_shift is the a multiplier for lf_deltas
+ // the multiplier is 1 for when filter_lvl is between 0 and 31;
+ // 2 when filter_lvl is between 32 and 63
+ int n_shift = default_filt_lvl >> 5;
loop_filter_info_n *lfi = &cm->lf_info;
@@ -128,18 +132,17 @@
ref = INTRA_FRAME;
/* Apply delta for reference frame */
- lvl_ref += xd->ref_lf_deltas[ref];
+ lvl_ref += xd->ref_lf_deltas[ref] << n_shift;
/* Apply delta for Intra modes */
mode = 0; /* I4X4_PRED */
/* Only the split mode I4X4_PRED has a further special case */
- lvl_mode = clamp(lvl_ref + xd->mode_lf_deltas[mode], 0, 63);
+ lvl_mode = lvl_ref + (xd->mode_lf_deltas[mode] << n_shift);
+ lfi->lvl[seg][ref][mode] = clamp(lvl_mode, 0, 63);
- lfi->lvl[seg][ref][mode] = lvl_mode;
-
mode = 1; /* all the rest of Intra modes */
- lvl_mode = clamp(lvl_ref, 0, 63);
- lfi->lvl[seg][ref][mode] = lvl_mode;
+ lvl_mode = lvl_ref;
+ lfi->lvl[seg][ref][mode] = clamp(lvl_mode, 0, 63);
/* LAST, GOLDEN, ALT */
for (ref = 1; ref < MAX_REF_FRAMES; ref++) {
@@ -146,12 +149,12 @@
int lvl_ref = lvl_seg;
/* Apply delta for reference frame */
- lvl_ref += xd->ref_lf_deltas[ref];
+ lvl_ref += xd->ref_lf_deltas[ref] << n_shift;
/* Apply delta for Inter modes */
for (mode = 1; mode < 4; mode++) {
- lvl_mode = clamp(lvl_ref + xd->mode_lf_deltas[mode], 0, 63);
- lfi->lvl[seg][ref][mode] = lvl_mode;
+ lvl_mode = lvl_ref + (xd->mode_lf_deltas[mode] << n_shift);
+ lfi->lvl[seg][ref][mode] = clamp(lvl_mode, 0, 63);
}
}
}