/* * Copyright (c) 2014 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.
*/
// 2-tap (bilinear) filter values are always positive, but 4-tap filter values // are negative on the outer edges (taps 0 and 3), with taps 1 and 2 having much // greater positive values to compensate. To use instructions that operate on // 8-bit types we also need the types to be unsigned. Subtracting the products // of taps 0 and 3 from the products of taps 1 and 2 always works given that // 2-tap filters are 0-padded. staticINLINE uint8x8_t convolve4_8(const uint8x8_t s0, const uint8x8_t s1, const uint8x8_t s2, const uint8x8_t s3, const uint8x8_t filter_taps[4]) {
uint16x8_t sum = vmull_u8(s1, filter_taps[1]);
sum = vmlal_u8(sum, s2, filter_taps[2]);
sum = vmlsl_u8(sum, s0, filter_taps[0]);
sum = vmlsl_u8(sum, s3, filter_taps[3]); // We halved the filter values so -1 from right shift. return vqrshrun_n_s16(vreinterpretq_s16_u16(sum), FILTER_BITS - 1);
}
staticINLINEvoid convolve_4tap_vert_neon(const uint8_t *src,
ptrdiff_t src_stride, uint8_t *dst,
ptrdiff_t dst_stride, int w, int h, const int16x8_t filter) { // 4-tap and bilinear filter values are even, so halve them to reduce // intermediate precision requirements. const uint8x8_t y_filter =
vshrn_n_u16(vreinterpretq_u16_s16(vabsq_s16(filter)), 1);
// Neon does not have lane-referencing multiply or multiply-accumulate // instructions that operate on vectors of 8-bit elements. This means we have // to duplicate filter taps into a whole vector and use standard multiply / // multiply-accumulate instructions. const uint8x8_t filter_taps[4] = { vdup_lane_u8(y_filter, 2),
vdup_lane_u8(y_filter, 3),
vdup_lane_u8(y_filter, 4),
vdup_lane_u8(y_filter, 5) };
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.