ref: 39c7b01d3c98e29457dab2ecd3c784ca313817bc
parent: 24df77e95102980e5f303b3a64a955a6e8089028
author: Dmitry Kovalev <[email protected]>
date: Fri Sep 20 08:54:14 EDT 2013
Cleanup in vp9_init3smotion_compensation. Change-Id: Ie47f53e76bc9530475c8c6d24e9b7a5a0189de56
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -136,66 +136,26 @@
}
void vp9_init3smotion_compensation(MACROBLOCK *x, int stride) {
- int len;
- int search_site_count = 0;
+ int len, ss_count = 1;
- // Generate offsets for 8 search sites per step.
- x->ss[search_site_count].mv.col = 0;
- x->ss[search_site_count].mv.row = 0;
- x->ss[search_site_count].offset = 0;
- search_site_count++;
+ x->ss[0].mv.col = x->ss[0].mv.row = 0;
+ x->ss[0].offset = 0;
for (len = MAX_FIRST_STEP; len > 0; len /= 2) {
- // Compute offsets for search sites.
- x->ss[search_site_count].mv.col = 0;
- x->ss[search_site_count].mv.row = -len;
- x->ss[search_site_count].offset = -len * stride;
- search_site_count++;
-
- // Compute offsets for search sites.
- x->ss[search_site_count].mv.col = 0;
- x->ss[search_site_count].mv.row = len;
- x->ss[search_site_count].offset = len * stride;
- search_site_count++;
-
- // Compute offsets for search sites.
- x->ss[search_site_count].mv.col = -len;
- x->ss[search_site_count].mv.row = 0;
- x->ss[search_site_count].offset = -len;
- search_site_count++;
-
- // Compute offsets for search sites.
- x->ss[search_site_count].mv.col = len;
- x->ss[search_site_count].mv.row = 0;
- x->ss[search_site_count].offset = len;
- search_site_count++;
-
- // Compute offsets for search sites.
- x->ss[search_site_count].mv.col = -len;
- x->ss[search_site_count].mv.row = -len;
- x->ss[search_site_count].offset = -len * stride - len;
- search_site_count++;
-
- // Compute offsets for search sites.
- x->ss[search_site_count].mv.col = len;
- x->ss[search_site_count].mv.row = -len;
- x->ss[search_site_count].offset = -len * stride + len;
- search_site_count++;
-
- // Compute offsets for search sites.
- x->ss[search_site_count].mv.col = -len;
- x->ss[search_site_count].mv.row = len;
- x->ss[search_site_count].offset = len * stride - len;
- search_site_count++;
-
- // Compute offsets for search sites.
- x->ss[search_site_count].mv.col = len;
- x->ss[search_site_count].mv.row = len;
- x->ss[search_site_count].offset = len * stride + len;
- search_site_count++;
+ // Generate offsets for 8 search sites per step.
+ const MV ss_mvs[8] = {
+ { 0, -len}, {0, len}, {-len, 0 }, {len, 0 },
+ {-len, -len}, {len, -len}, {-len, len}, {len, len}
+ };
+ int i;
+ for (i = 0; i < 8; ++i) {
+ search_site *const ss = &x->ss[ss_count++];
+ ss->mv = ss_mvs[i];
+ ss->offset = ss->mv.row * stride + ss->mv.col;
+ }
}
- x->ss_count = search_site_count;
+ x->ss_count = ss_count;
x->searches_per_step = 8;
}