From 7012ba63951388bc1b794c042f87f343c71bd65a Mon Sep 17 00:00:00 2001 From: James Zern Date: Wed, 3 Jun 2015 20:40:32 -0700 Subject: [PATCH] vp9_reconintra: simplify d63_predictor calculate the averages needed for even and odd rows once; this removes a conditional from the inner loop the final average calculated currently relies on above[] being extended, it could be reduced to use above[block_size - 2] + 3 * above[block_size - 1] Change-Id: I70f5eac8d8a2a959c7114844a95826f445c3dd4d --- vp9/common/vp9_reconintra.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/vp9/common/vp9_reconintra.c b/vp9/common/vp9_reconintra.c index 80034e4db..3312f2977 100644 --- a/vp9/common/vp9_reconintra.c +++ b/vp9/common/vp9_reconintra.c @@ -425,13 +425,17 @@ void vp9_d63_predictor_4x4_c(uint8_t *dst, ptrdiff_t stride, static INLINE void d63_predictor(uint8_t *dst, ptrdiff_t stride, int bs, const uint8_t *above, const uint8_t *left) { int r, c; - (void) left; - for (r = 0; r < bs; ++r) { - for (c = 0; c < bs; ++c) - dst[c] = r & 1 ? AVG3(above[(r >> 1) + c], above[(r >> 1) + c + 1], - above[(r >> 1) + c + 2]) - : AVG2(above[(r >> 1) + c], above[(r >> 1) + c + 1]); - dst += stride; + int size; + (void)left; + for (c = 0; c < bs; ++c) { + dst[c] = AVG2(above[c], above[c + 1]); + dst[stride + c] = AVG3(above[c], above[c + 1], above[c + 2]); + } + for (r = 2, size = bs - 2; r < bs; r += 2, --size) { + memcpy(dst + (r + 0) * stride, dst + (r >> 1), size); + memset(dst + (r + 0) * stride + size, above[bs - 1], bs - size); + memcpy(dst + (r + 1) * stride, dst + stride + (r >> 1), size); + memset(dst + (r + 1) * stride + size, above[bs - 1], bs - size); } } intra_pred_no_4x4(d63) -- 2.40.0