summaryrefslogtreecommitdiff
path: root/vp9/common/vp9_mfqe.c
diff options
context:
space:
mode:
authorJackyChen <jackychen@google.com>2015-01-05 10:41:12 -0800
committerJackyChen <jackychen@google.com>2015-01-05 11:38:42 -0800
commitfe23539d58b6e4b8411d155cc6fa4c91e5fbacfd (patch)
treea8cbe4fb381bb0298072e5934d5dc25e871b7d42 /vp9/common/vp9_mfqe.c
parent2fe1bfa5ade46b7f9f3505801071493a7afd4ad0 (diff)
downloadlibvpx-fe23539d58b6e4b8411d155cc6fa4c91e5fbacfd.tar
libvpx-fe23539d58b6e4b8411d155cc6fa4c91e5fbacfd.tar.gz
libvpx-fe23539d58b6e4b8411d155cc6fa4c91e5fbacfd.tar.bz2
libvpx-fe23539d58b6e4b8411d155cc6fa4c91e5fbacfd.zip
Adopt weighted averaging in MFQE.
By using weighted averaging in the calculation of the frames to be displayed, we get an average gain of more than 1 db for key frames whose base qp are 20 higher than non-key frames. Change-Id: I7bcb2e7b9c6420ea3f73f33204d18b072dffd17c
Diffstat (limited to 'vp9/common/vp9_mfqe.c')
-rw-r--r--vp9/common/vp9_mfqe.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/vp9/common/vp9_mfqe.c b/vp9/common/vp9_mfqe.c
index 92650e954..110404f5a 100644
--- a/vp9/common/vp9_mfqe.c
+++ b/vp9/common/vp9_mfqe.c
@@ -167,10 +167,10 @@ static void mfqe_block(BLOCK_SIZE bs, const uint8_t *y, const uint8_t *u,
// it might be a lighting change in smooth area. When there is a
// lighting change in smooth area, it is dangerous to do MFQE.
if (sad > 1 && sad < sad_thr && vdiff > sad * 3 && vdiff < 150) {
- // TODO(jackychen): Add weighted average in the calculation.
- // Currently, the data is copied from last frame without averaging.
+ int weight = ((float)sad / (sad_thr - 1)) * ((float)vdiff / (150 - 1)) *
+ (1 << MFQE_PRECISION);
apply_ifactor(y, y_stride, yd, yd_stride, u, v, uv_stride,
- ud, vd, uvd_stride, bs, 0);
+ ud, vd, uvd_stride, bs, weight);
} else {
// Copy the block from current frame (i.e., no mfqe is done).
copy_block(y, u, v, y_stride, uv_stride, yd, ud, vd,