diff options
author | Jingning Han <jingning@google.com> | 2015-02-23 12:55:50 -0800 |
---|---|---|
committer | Jingning Han <jingning@google.com> | 2015-02-24 11:48:38 -0800 |
commit | f87e315e1e34de158581cbf7bc96248542d4b3fb (patch) | |
tree | 7d911a8ba17507b122b09f50f2606b03c931b0fc /vp9/encoder | |
parent | a28a8cb72626d8bea3543052e9bf825e95666c7e (diff) | |
download | libvpx-f87e315e1e34de158581cbf7bc96248542d4b3fb.tar libvpx-f87e315e1e34de158581cbf7bc96248542d4b3fb.tar.gz libvpx-f87e315e1e34de158581cbf7bc96248542d4b3fb.tar.bz2 libvpx-f87e315e1e34de158581cbf7bc96248542d4b3fb.zip |
Re-distribute hierarchical vector match pattern
This commit modifies the hierarchical vector match patter. It
avoids repeated SAD computation at same points. The function
vp9_vector_sad_sse2 is called 12 times per 64x64 block, instead
of 15 times as before. The effective coverage remains the same.
Change-Id: I91ad9d27d40db8963c907d02af84e10702136994
Diffstat (limited to 'vp9/encoder')
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 39dedf6cb..6787faa8a 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -528,10 +528,10 @@ static int vector_match(int16_t *ref, int16_t *src) { } center = offset; - for (d = -8; d <= 8; d += 4) { + for (d = -8; d <= 8; d += 16) { int this_pos = offset + d; // check limit - if (this_pos < 0 || this_pos > 64 || this_pos == 32) + if (this_pos < 0 || this_pos > 64) continue; this_sad = vp9_vector_sad(&ref[this_pos], src, 64); if (this_sad < best_sad) { @@ -541,10 +541,10 @@ static int vector_match(int16_t *ref, int16_t *src) { } offset = center; - for (d = -4; d <= 4; d += 2) { + for (d = -4; d <= 4; d += 8) { int this_pos = offset + d; // check limit - if (this_pos < 0 || this_pos > 64 || this_pos == 32) + if (this_pos < 0 || this_pos > 64) continue; this_sad = vp9_vector_sad(&ref[this_pos], src, 64); if (this_sad < best_sad) { @@ -554,10 +554,23 @@ static int vector_match(int16_t *ref, int16_t *src) { } offset = center; - for (d = -2; d <= 2; d += 1) { + for (d = -2; d <= 2; d += 4) { int this_pos = offset + d; // check limit - if (this_pos < 0 || this_pos > 64 || this_pos == 32) + if (this_pos < 0 || this_pos > 64) + continue; + this_sad = vp9_vector_sad(&ref[this_pos], src, 64); + if (this_sad < best_sad) { + best_sad = this_sad; + center = this_pos; + } + } + offset = center; + + for (d = -1; d <= 1; d += 2) { + int this_pos = offset + d; + // check limit + if (this_pos < 0 || this_pos > 64) continue; this_sad = vp9_vector_sad(&ref[this_pos], src, 64); if (this_sad < best_sad) { |