/* * Copyright (c) 2018, Alliance for Open Media. All rights reserved. * * This source code is subject to the terms of the BSD 2 Clause License and * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License * was not distributed with this source code in the LICENSE file, you can * obtain it at www.aomedia.org/license/software. If the Alliance for Open * Media Patent License 1.0 was not distributed with this source code in the * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
*/
int i, j; // When rounding constant is added, there is a possibility of overflow. // However that much precision is not required. Code should very well work for // other values of DIFF_FACTOR_LOG2 and AOM_BLEND_A64_MAX_ALPHA as well. But // there is a possibility of corner case bugs.
assert(DIFF_FACTOR_LOG2 == 4);
assert(AOM_BLEND_A64_MAX_ALPHA == 64); for (i = 0; i < h; ++i) { for (j = 0; j < w; j += 8) { const __m128i data_src0 =
_mm_loadu_si128((__m128i *)&src0[(i * src0_stride) + j]); const __m128i data_src1 =
_mm_loadu_si128((__m128i *)&src1[(i * src1_stride) + j]);
const __m128i diffa = _mm_subs_epu16(data_src0, data_src1); const __m128i diffb = _mm_subs_epu16(data_src1, data_src0); const __m128i diff = _mm_max_epu16(diffa, diffb); const __m128i diff_round =
_mm_srli_epi16(_mm_adds_epu16(diff, round_const), round); const __m128i diff_factor = _mm_srli_epi16(diff_round, DIFF_FACTOR_LOG2); const __m128i diff_mask = _mm_adds_epi16(diff_factor, mask_base_16);
__m128i diff_clamp = _mm_min_epi16(diff_mask, clip_diff); // clamp to 0 can be skipped since we are using add and saturate // instruction
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.