tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

highbd_rdopt_neon.c (1734B)


      1 /*
      2 * Copyright (c) 2023, Alliance for Open Media. All rights reserved.
      3 *
      4 * This source code is subject to the terms of the BSD 2 Clause License and
      5 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
      6 * was not distributed with this source code in the LICENSE file, you can
      7 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
      8 * Media Patent License 1.0 was not distributed with this source code in the
      9 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
     10 */
     11 
     12 #include <assert.h>
     13 #include <arm_neon.h>
     14 
     15 #include "config/av1_rtcd.h"
     16 #include "aom_dsp/arm/sum_neon.h"
     17 
     18 int64_t av1_highbd_block_error_neon(const tran_low_t *coeff,
     19                                    const tran_low_t *dqcoeff,
     20                                    intptr_t block_size, int64_t *ssz, int bd) {
     21  uint64x2_t err_u64 = vdupq_n_u64(0);
     22  int64x2_t ssz_s64 = vdupq_n_s64(0);
     23 
     24  const int shift = 2 * (bd - 8);
     25  const int rounding = (1 << shift) >> 1;
     26 
     27  assert(block_size >= 16);
     28  assert((block_size % 16) == 0);
     29 
     30  do {
     31    const int32x4_t c = vld1q_s32(coeff);
     32    const int32x4_t d = vld1q_s32(dqcoeff);
     33 
     34    const uint32x4_t diff = vreinterpretq_u32_s32(vabdq_s32(c, d));
     35 
     36    err_u64 = vmlal_u32(err_u64, vget_low_u32(diff), vget_low_u32(diff));
     37    err_u64 = vmlal_u32(err_u64, vget_high_u32(diff), vget_high_u32(diff));
     38 
     39    ssz_s64 = vmlal_s32(ssz_s64, vget_low_s32(c), vget_low_s32(c));
     40    ssz_s64 = vmlal_s32(ssz_s64, vget_high_s32(c), vget_high_s32(c));
     41 
     42    coeff += 4;
     43    dqcoeff += 4;
     44    block_size -= 4;
     45  } while (block_size != 0);
     46 
     47  *ssz = (horizontal_add_s64x2(ssz_s64) + rounding) >> shift;
     48  return ((int64_t)horizontal_add_u64x2(err_u64) + rounding) >> shift;
     49 }