Commit fbabcad6 authored by James Zern's avatar James Zern Committed by Gerrit Code Review
Browse files

Merge changes I4850b36e,Ic4d7128a into nextgenv2

* changes:
  variance_avx2: sync variance functions with c-code
  Resolve -Wshorten-64-to-32 in variance.
parents 8d510e2e 8c64331a
......@@ -148,7 +148,7 @@ static void var_filter_block2d_bil_second_pass(const uint16_t *a, uint8_t *b,
uint32_t *sse) { \
int sum; \
variance(a, a_stride, b, b_stride, W, H, sse, &sum); \
return *sse - (((int64_t)sum * sum) / (W * H)); \
return *sse - (uint32_t)(((int64_t)sum * sum) / (W * H)); \
}
#define SUBPIX_VAR(W, H) \
......
......@@ -62,7 +62,7 @@ unsigned int aom_variance32x16_avx2(const uint8_t *src, int src_stride,
int sum;
variance_avx2(src, src_stride, ref, ref_stride, 32, 16, sse, &sum,
aom_get32x32var_avx2, 32);
return *sse - (((int64_t)sum * sum) >> 9);
return *sse - (uint32_t)(((int64_t)sum * sum) >> 9);
}
unsigned int aom_variance32x32_avx2(const uint8_t *src, int src_stride,
......@@ -71,7 +71,7 @@ unsigned int aom_variance32x32_avx2(const uint8_t *src, int src_stride,
int sum;
variance_avx2(src, src_stride, ref, ref_stride, 32, 32, sse, &sum,
aom_get32x32var_avx2, 32);
return *sse - (((int64_t)sum * sum) >> 10);
return *sse - (uint32_t)(((int64_t)sum * sum) >> 10);
}
unsigned int aom_variance64x64_avx2(const uint8_t *src, int src_stride,
......@@ -80,7 +80,7 @@ unsigned int aom_variance64x64_avx2(const uint8_t *src, int src_stride,
int sum;
variance_avx2(src, src_stride, ref, ref_stride, 64, 64, sse, &sum,
aom_get32x32var_avx2, 32);
return *sse - (((int64_t)sum * sum) >> 12);
return *sse - (uint32_t)(((int64_t)sum * sum) >> 12);
}
unsigned int aom_variance64x32_avx2(const uint8_t *src, int src_stride,
......@@ -89,7 +89,7 @@ unsigned int aom_variance64x32_avx2(const uint8_t *src, int src_stride,
int sum;
variance_avx2(src, src_stride, ref, ref_stride, 64, 32, sse, &sum,
aom_get32x32var_avx2, 32);
return *sse - (((int64_t)sum * sum) >> 11);
return *sse - (uint32_t)(((int64_t)sum * sum) >> 11);
}
unsigned int aom_sub_pixel_variance32xh_avx2(const uint8_t *src, int src_stride,
......@@ -116,7 +116,7 @@ unsigned int aom_sub_pixel_variance64x64_avx2(const uint8_t *src,
dst + 32, dst_stride, 64, &sse2);
const int se = se1 + se2;
*sse = sse1 + sse2;
return *sse - (((int64_t)se * se) >> 12);
return *sse - (uint32_t)(((int64_t)se * se) >> 12);
}
unsigned int aom_sub_pixel_variance32x32_avx2(const uint8_t *src,
......@@ -126,7 +126,7 @@ unsigned int aom_sub_pixel_variance32x32_avx2(const uint8_t *src,
unsigned int *sse) {
const int se = aom_sub_pixel_variance32xh_avx2(
src, src_stride, x_offset, y_offset, dst, dst_stride, 32, sse);
return *sse - (((int64_t)se * se) >> 10);
return *sse - (uint32_t)(((int64_t)se * se) >> 10);
}
unsigned int aom_sub_pixel_avg_variance64x64_avx2(
......@@ -143,7 +143,7 @@ unsigned int aom_sub_pixel_avg_variance64x64_avx2(
*sse = sse1 + sse2;
return *sse - (((int64_t)se * se) >> 12);
return *sse - (uint32_t)(((int64_t)se * se) >> 12);
}
unsigned int aom_sub_pixel_avg_variance32x32_avx2(
......@@ -152,5 +152,5 @@ unsigned int aom_sub_pixel_avg_variance32x32_avx2(
// Process 32 elements in parallel.
const int se = aom_sub_pixel_avg_variance32xh_avx2(
src, src_stride, x_offset, y_offset, dst, dst_stride, sec, 32, 32, sse);
return *sse - (((int64_t)se * se) >> 10);
return *sse - (uint32_t)(((int64_t)se * se) >> 10);
}
......@@ -249,7 +249,7 @@ unsigned int aom_variance32x32_sse2(const uint8_t *src, int src_stride,
aom_get16x16var_sse2, 16);
assert(sum <= 255 * 32 * 32);
assert(sum >= -255 * 32 * 32);
return *sse - (((int64_t)sum * sum) >> 10);
return *sse - (unsigned int)(((int64_t)sum * sum) >> 10);
}
unsigned int aom_variance32x16_sse2(const uint8_t *src, int src_stride,
......@@ -260,7 +260,7 @@ unsigned int aom_variance32x16_sse2(const uint8_t *src, int src_stride,
aom_get16x16var_sse2, 16);
assert(sum <= 255 * 32 * 16);
assert(sum >= -255 * 32 * 16);
return *sse - (((int64_t)sum * sum) >> 9);
return *sse - (unsigned int)(((int64_t)sum * sum) >> 9);
}
unsigned int aom_variance16x32_sse2(const uint8_t *src, int src_stride,
......@@ -271,7 +271,7 @@ unsigned int aom_variance16x32_sse2(const uint8_t *src, int src_stride,
aom_get16x16var_sse2, 16);
assert(sum <= 255 * 32 * 16);
assert(sum >= -255 * 32 * 16);
return *sse - (((int64_t)sum * sum) >> 9);
return *sse - (unsigned int)(((int64_t)sum * sum) >> 9);
}
unsigned int aom_variance64x64_sse2(const uint8_t *src, int src_stride,
......@@ -282,7 +282,7 @@ unsigned int aom_variance64x64_sse2(const uint8_t *src, int src_stride,
aom_get16x16var_sse2, 16);
assert(sum <= 255 * 64 * 64);
assert(sum >= -255 * 64 * 64);
return *sse - (((int64_t)sum * sum) >> 12);
return *sse - (unsigned int)(((int64_t)sum * sum) >> 12);
}
unsigned int aom_variance64x32_sse2(const uint8_t *src, int src_stride,
......@@ -293,7 +293,7 @@ unsigned int aom_variance64x32_sse2(const uint8_t *src, int src_stride,
aom_get16x16var_sse2, 16);
assert(sum <= 255 * 64 * 32);
assert(sum >= -255 * 64 * 32);
return *sse - (((int64_t)sum * sum) >> 11);
return *sse - (unsigned int)(((int64_t)sum * sum) >> 11);
}
unsigned int aom_variance32x64_sse2(const uint8_t *src, int src_stride,
......@@ -304,7 +304,7 @@ unsigned int aom_variance32x64_sse2(const uint8_t *src, int src_stride,
aom_get16x16var_sse2, 16);
assert(sum <= 255 * 64 * 32);
assert(sum >= -255 * 64 * 32);
return *sse - (((int64_t)sum * sum) >> 11);
return *sse - (unsigned int)(((int64_t)sum * sum) >> 11);
}
unsigned int aom_mse8x8_sse2(const uint8_t *src, int src_stride,
......@@ -381,7 +381,7 @@ DECLS(ssse3, ssse3);
} \
} \
*sse_ptr = sse; \
return sse - (cast_prod(cast se * se) >> (wlog2 + hlog2)); \
return sse - (unsigned int)(cast_prod(cast se * se) >> (wlog2 + hlog2)); \
}
#define FNS(opt1, opt2) \
......@@ -452,7 +452,7 @@ DECLS(ssse3, ssse3);
} \
} \
*sseptr = sse; \
return sse - (cast_prod(cast se * se) >> (wlog2 + hlog2)); \
return sse - (unsigned int)(cast_prod(cast se * se) >> (wlog2 + hlog2)); \
}
#define FNS(opt1, opt2) \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment