/* * Copyright (c) 2017 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree.
*/
s = vec_sum4s(d0, s);
ss = vec_msum(d0, d0, ss);
s = vec_sum4s(d1, s);
ss = vec_msum(d1, d1, ss);
s = vec_sum4s(d2, s);
ss = vec_msum(d2, d2, ss);
s = vec_sum4s(d3, s);
ss = vec_msum(d3, d3, ss);
*sum = s;
*sum_squared = ss;
}
staticINLINEvoid variance(const uint8_t *src_ptr, int src_stride, const uint8_t *ref_ptr, int ref_stride, int w, int h, uint32_t *sse, int *sum) { int i;
int32x4_t s = vec_splat_s32(0);
int32x4_t ss = vec_splat_s32(0);
switch (w) { case 4: for (i = 0; i < h / 2; ++i) { const int16x8_t a0 = unpack_to_s16_h(read4x2(src_ptr, src_stride)); const int16x8_t b0 = unpack_to_s16_h(read4x2(ref_ptr, ref_stride)); const int16x8_t d = vec_sub(a0, b0);
s = vec_sum4s(d, s);
ss = vec_msum(d, d, ss);
src_ptr += src_stride * 2;
ref_ptr += ref_stride * 2;
} break; case 8: for (i = 0; i < h; ++i) { const int16x8_t a0 = unpack_to_s16_h(vec_vsx_ld(0, src_ptr)); const int16x8_t b0 = unpack_to_s16_h(vec_vsx_ld(0, ref_ptr)); const int16x8_t d = vec_sub(a0, b0);
ss = vec_splat(vec_sums(ss, vec_splat_s32(0)), 3);
vec_ste((uint32x4_t)ss, 0, sse);
}
/* Identical to the variance call except it takes an additional parameter, sum, * and returns that value using pass-by-reference instead of returning * sse - sum^2 / w*h
*/ #define GET_VAR(W, H) \ void vpx_get##W##x##H##var_vsx(const uint8_t *src_ptr, int src_stride, \ const uint8_t *ref_ptr, int ref_stride, \
uint32_t *sse, int *sum) { \
variance(src_ptr, src_stride, ref_ptr, ref_stride, W, H, sse, sum); \
}
/* Identical to the variance call except it does not calculate the * sse - sum^2 / w*h and returns sse in addition to modifying the passed in * variable.
*/ #define MSE(W, H) \
uint32_t vpx_mse##W##x##H##_vsx(const uint8_t *src_ptr, int src_stride, \ const uint8_t *ref_ptr, int ref_stride, \
uint32_t *sse) { \ int sum; \
variance(src_ptr, src_stride, ref_ptr, ref_stride, W, H, sse, &sum); \ return *sse; \
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.