summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_pickmode.c
diff options
context:
space:
mode:
authorJingning Han <jingning@google.com>2014-02-28 09:35:08 -0800
committerJingning Han <jingning@google.com>2014-02-28 09:44:53 -0800
commit24c7ee78c59eb2237d12658f8ca01ad0862bc444 (patch)
treeb6bbe56a1ff34e8fc39425a82d840395b2cd0b18 /vp9/encoder/vp9_pickmode.c
parent17b1e92d6cdf2fbb9ae984b6d36465d3c9b7b3f3 (diff)
downloadlibvpx-24c7ee78c59eb2237d12658f8ca01ad0862bc444.tar
libvpx-24c7ee78c59eb2237d12658f8ca01ad0862bc444.tar.gz
libvpx-24c7ee78c59eb2237d12658f8ca01ad0862bc444.tar.bz2
libvpx-24c7ee78c59eb2237d12658f8ca01ad0862bc444.zip
Skip some mode SAD calculation in non-RD mode
This commit checks if the motion vector associated with the current mode has been computed in previous mode tests. If possible, skip the redundant reference block generation and SAD calculation in the non-RD mode decision process. For test sequence pedestrian_area 1080p, the runtime goes from 24261 ms to 23770 ms. This does not change compression performance. The speed-up is mostly around places with consistent motion. Change-Id: I97be63c6a2d07c57be26b3c600fbda3803adddda
Diffstat (limited to 'vp9/encoder/vp9_pickmode.c')
-rw-r--r--vp9/encoder/vp9_pickmode.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c
index 87f20fa1c..0f2e3034f 100644
--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -270,12 +270,21 @@ int64_t vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
&frame_mv[NEWMV][ref_frame]);
}
- mbmi->mode = this_mode;
- mbmi->mv[0].as_int = frame_mv[this_mode][ref_frame].as_int;
- vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize);
+ if (frame_mv[this_mode][ref_frame].as_int == 0) {
+ dist = x->mode_sad[ref_frame][INTER_OFFSET(ZEROMV)];
+ } else if (this_mode != NEARESTMV &&
+ frame_mv[NEARESTMV][ref_frame].as_int ==
+ frame_mv[this_mode][ref_frame].as_int) {
+ dist = x->mode_sad[ref_frame][INTER_OFFSET(NEARESTMV)];
+ } else {
+ mbmi->mode = this_mode;
+ mbmi->mv[0].as_int = frame_mv[this_mode][ref_frame].as_int;
+ vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize);
+ dist = x->mode_sad[ref_frame][INTER_OFFSET(this_mode)] =
+ cpi->fn_ptr[bsize].sdf(p->src.buf, p->src.stride,
+ pd->dst.buf, pd->dst.stride, INT_MAX);
+ }
- dist = cpi->fn_ptr[bsize].sdf(p->src.buf, p->src.stride,
- pd->dst.buf, pd->dst.stride, INT_MAX);
this_rd = rate + dist;
if (this_rd < best_rd) {