DXR will be turned off on Tuesday, December 29th. It will redirect to Searchfox.
See the announcement on Discourse.

DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Mercurial (d38398e5144e)

VCS Links

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
/*
 *  Copyright (c) 2013 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.
 */

#ifndef VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_MASKS_DSPR2_H_
#define VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_MASKS_DSPR2_H_

#include <stdlib.h>

#include "./vpx_dsp_rtcd.h"
#include "vpx/vpx_integer.h"
#include "vpx_mem/vpx_mem.h"

#ifdef __cplusplus
extern "C" {
#endif

#if HAVE_DSPR2
/* processing 4 pixels at the same time
 * compute hev and mask in the same function */
static INLINE void filter_hev_mask_dspr2(uint32_t limit, uint32_t flimit,
                                         uint32_t p1, uint32_t p0, uint32_t p3,
                                         uint32_t p2, uint32_t q0, uint32_t q1,
                                         uint32_t q2, uint32_t q3,
                                         uint32_t thresh, uint32_t *hev,
                                         uint32_t *mask) {
  uint32_t c, r, r3, r_k;
  uint32_t s1, s2, s3;
  uint32_t ones = 0xFFFFFFFF;
  uint32_t hev1;

  __asm__ __volatile__(
      /* mask |= (abs(p3 - p2) > limit) */
      "subu_s.qb      %[c],   %[p3],     %[p2]        \n\t"
      "subu_s.qb      %[r_k], %[p2],     %[p3]        \n\t"
      "or             %[r_k], %[r_k],    %[c]         \n\t"
      "cmpgu.lt.qb    %[c],   %[limit],  %[r_k]       \n\t"
      "or             %[r],   $0,        %[c]         \n\t"

      /* mask |= (abs(p2 - p1) > limit) */
      "subu_s.qb      %[c],   %[p2],     %[p1]        \n\t"
      "subu_s.qb      %[r_k], %[p1],     %[p2]        \n\t"
      "or             %[r_k], %[r_k],    %[c]         \n\t"
      "cmpgu.lt.qb    %[c],   %[limit],  %[r_k]       \n\t"
      "or             %[r],   %[r],      %[c]         \n\t"

      /* mask |= (abs(p1 - p0) > limit)
       * hev  |= (abs(p1 - p0) > thresh)
       */
      "subu_s.qb      %[c],   %[p1],     %[p0]        \n\t"
      "subu_s.qb      %[r_k], %[p0],     %[p1]        \n\t"
      "or             %[r_k], %[r_k],    %[c]         \n\t"
      "cmpgu.lt.qb    %[c],   %[thresh], %[r_k]       \n\t"
      "or             %[r3],  $0,        %[c]         \n\t"
      "cmpgu.lt.qb    %[c],   %[limit],  %[r_k]       \n\t"
      "or             %[r],   %[r],      %[c]         \n\t"

      /* mask |= (abs(q1 - q0) > limit)
       * hev  |= (abs(q1 - q0) > thresh)
       */
      "subu_s.qb      %[c],   %[q1],     %[q0]        \n\t"
      "subu_s.qb      %[r_k], %[q0],     %[q1]        \n\t"
      "or             %[r_k], %[r_k],    %[c]         \n\t"
      "cmpgu.lt.qb    %[c],   %[thresh], %[r_k]       \n\t"
      "or             %[r3],  %[r3],     %[c]         \n\t"
      "cmpgu.lt.qb    %[c],   %[limit],  %[r_k]       \n\t"
      "or             %[r],   %[r],      %[c]         \n\t"

      /* mask |= (abs(q2 - q1) > limit) */
      "subu_s.qb      %[c],   %[q2],     %[q1]        \n\t"
      "subu_s.qb      %[r_k], %[q1],     %[q2]        \n\t"
      "or             %[r_k], %[r_k],    %[c]         \n\t"
      "cmpgu.lt.qb    %[c],   %[limit],  %[r_k]       \n\t"
      "or             %[r],   %[r],      %[c]         \n\t"
      "sll            %[r3],    %[r3],    24          \n\t"

      /* mask |= (abs(q3 - q2) > limit) */
      "subu_s.qb      %[c],   %[q3],     %[q2]        \n\t"
      "subu_s.qb      %[r_k], %[q2],     %[q3]        \n\t"
      "or             %[r_k], %[r_k],    %[c]         \n\t"
      "cmpgu.lt.qb    %[c],   %[limit],  %[r_k]       \n\t"
      "or             %[r],   %[r],      %[c]         \n\t"

      : [c] "=&r"(c), [r_k] "=&r"(r_k), [r] "=&r"(r), [r3] "=&r"(r3)
      : [limit] "r"(limit), [p3] "r"(p3), [p2] "r"(p2), [p1] "r"(p1),
        [p0] "r"(p0), [q1] "r"(q1), [q0] "r"(q0), [q2] "r"(q2), [q3] "r"(q3),
        [thresh] "r"(thresh));

  __asm__ __volatile__(
      /* abs(p0 - q0) */
      "subu_s.qb      %[c],   %[p0],     %[q0]        \n\t"
      "subu_s.qb      %[r_k], %[q0],     %[p0]        \n\t"
      "wrdsp          %[r3]                           \n\t"
      "or             %[s1],  %[r_k],    %[c]         \n\t"

      /* abs(p1 - q1) */
      "subu_s.qb      %[c],    %[p1],    %[q1]        \n\t"
      "addu_s.qb      %[s3],   %[s1],    %[s1]        \n\t"
      "pick.qb        %[hev1], %[ones],  $0           \n\t"
      "subu_s.qb      %[r_k],  %[q1],    %[p1]        \n\t"
      "or             %[s2],   %[r_k],   %[c]         \n\t"

      /* abs(p0 - q0) * 2 + abs(p1 - q1) / 2  > flimit * 2 + limit */
      "shrl.qb        %[s2],   %[s2],     1           \n\t"
      "addu_s.qb      %[s1],   %[s2],     %[s3]       \n\t"
      "cmpgu.lt.qb    %[c],    %[flimit], %[s1]       \n\t"
      "or             %[r],    %[r],      %[c]        \n\t"
      "sll            %[r],    %[r],      24          \n\t"

      "wrdsp          %[r]                            \n\t"
      "pick.qb        %[s2],  $0,         %[ones]     \n\t"

      : [c] "=&r"(c), [r_k] "=&r"(r_k), [s1] "=&r"(s1), [hev1] "=&r"(hev1),
        [s2] "=&r"(s2), [r] "+r"(r), [s3] "=&r"(s3)
      : [p0] "r"(p0), [q0] "r"(q0), [p1] "r"(p1), [r3] "r"(r3), [q1] "r"(q1),
        [ones] "r"(ones), [flimit] "r"(flimit));

  *hev = hev1;
  *mask = s2;
}

static INLINE void filter_hev_mask_flatmask4_dspr2(
    uint32_t limit, uint32_t flimit, uint32_t thresh, uint32_t p1, uint32_t p0,
    uint32_t p3, uint32_t p2, uint32_t q0, uint32_t q1, uint32_t q2,
    uint32_t q3, uint32_t *hev, uint32_t *mask, uint32_t *flat) {
  uint32_t c, r, r3, r_k, r_flat;
  uint32_t s1, s2, s3;
  uint32_t ones = 0xFFFFFFFF;
  uint32_t flat_thresh = 0x01010101;
  uint32_t hev1;
  uint32_t flat1;

  __asm__ __volatile__(
      /* mask |= (abs(p3 - p2) > limit) */
      "subu_s.qb      %[c],       %[p3],          %[p2]        \n\t"
      "subu_s.qb      %[r_k],     %[p2],          %[p3]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[limit],       %[r_k]       \n\t"
      "or             %[r],       $0,             %[c]         \n\t"

      /* mask |= (abs(p2 - p1) > limit) */
      "subu_s.qb      %[c],       %[p2],          %[p1]        \n\t"
      "subu_s.qb      %[r_k],     %[p1],          %[p2]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[limit],       %[r_k]       \n\t"
      "or             %[r],       %[r],           %[c]         \n\t"

      /* mask |= (abs(p1 - p0) > limit)
       * hev  |= (abs(p1 - p0) > thresh)
       * flat |= (abs(p1 - p0) > thresh)
       */
      "subu_s.qb      %[c],       %[p1],          %[p0]        \n\t"
      "subu_s.qb      %[r_k],     %[p0],          %[p1]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[thresh],      %[r_k]       \n\t"
      "or             %[r3],      $0,             %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[limit],       %[r_k]       \n\t"
      "or             %[r],       %[r],           %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[flat_thresh], %[r_k]       \n\t"
      "or             %[r_flat],  $0,             %[c]         \n\t"

      /* mask |= (abs(q1 - q0) > limit)
       * hev  |= (abs(q1 - q0) > thresh)
       * flat |= (abs(q1 - q0) > thresh)
       */
      "subu_s.qb      %[c],       %[q1],          %[q0]        \n\t"
      "subu_s.qb      %[r_k],     %[q0],          %[q1]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[thresh],      %[r_k]       \n\t"
      "or             %[r3],      %[r3],          %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[limit],       %[r_k]       \n\t"
      "or             %[r],       %[r],           %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[flat_thresh], %[r_k]       \n\t"
      "or             %[r_flat],  %[r_flat],      %[c]         \n\t"

      /* flat |= (abs(p0 - p2) > thresh) */
      "subu_s.qb      %[c],       %[p0],          %[p2]        \n\t"
      "subu_s.qb      %[r_k],     %[p2],          %[p0]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[flat_thresh], %[r_k]       \n\t"
      "or             %[r_flat],  %[r_flat],      %[c]         \n\t"

      /* flat |= (abs(q0 - q2) > thresh) */
      "subu_s.qb      %[c],       %[q0],          %[q2]        \n\t"
      "subu_s.qb      %[r_k],     %[q2],          %[q0]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[flat_thresh], %[r_k]       \n\t"
      "or             %[r_flat],  %[r_flat],      %[c]         \n\t"

      /* flat |= (abs(p3 - p0) > thresh) */
      "subu_s.qb      %[c],       %[p3],          %[p0]        \n\t"
      "subu_s.qb      %[r_k],     %[p0],          %[p3]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[flat_thresh], %[r_k]       \n\t"
      "or             %[r_flat],  %[r_flat],      %[c]         \n\t"

      /* flat |= (abs(q3 - q0) > thresh) */
      "subu_s.qb      %[c],       %[q3],          %[q0]        \n\t"
      "subu_s.qb      %[r_k],     %[q0],          %[q3]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[flat_thresh], %[r_k]       \n\t"
      "or             %[r_flat],  %[r_flat],      %[c]         \n\t"
      "sll            %[r_flat],  %[r_flat],      24           \n\t"
      /* look at stall here */
      "wrdsp          %[r_flat]                                \n\t"
      "pick.qb        %[flat1],   $0,             %[ones]      \n\t"

      /* mask |= (abs(q2 - q1) > limit) */
      "subu_s.qb      %[c],       %[q2],          %[q1]        \n\t"
      "subu_s.qb      %[r_k],     %[q1],          %[q2]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[limit],       %[r_k]       \n\t"
      "or             %[r],       %[r],           %[c]         \n\t"
      "sll            %[r3],      %[r3],          24           \n\t"

      /* mask |= (abs(q3 - q2) > limit) */
      "subu_s.qb      %[c],       %[q3],          %[q2]        \n\t"
      "subu_s.qb      %[r_k],     %[q2],          %[q3]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[limit],       %[r_k]       \n\t"
      "or             %[r],       %[r],           %[c]         \n\t"

      : [c] "=&r"(c), [r_k] "=&r"(r_k), [r] "=&r"(r), [r3] "=&r"(r3),
        [r_flat] "=&r"(r_flat), [flat1] "=&r"(flat1)
      : [limit] "r"(limit), [p3] "r"(p3), [p2] "r"(p2), [p1] "r"(p1),
        [p0] "r"(p0), [q1] "r"(q1), [q0] "r"(q0), [q2] "r"(q2), [q3] "r"(q3),
        [thresh] "r"(thresh), [flat_thresh] "r"(flat_thresh), [ones] "r"(ones));

  __asm__ __volatile__(
      /* abs(p0 - q0) */
      "subu_s.qb      %[c],   %[p0],     %[q0]        \n\t"
      "subu_s.qb      %[r_k], %[q0],     %[p0]        \n\t"
      "wrdsp          %[r3]                           \n\t"
      "or             %[s1],  %[r_k],    %[c]         \n\t"

      /* abs(p1 - q1) */
      "subu_s.qb      %[c],    %[p1],    %[q1]        \n\t"
      "addu_s.qb      %[s3],   %[s1],    %[s1]        \n\t"
      "pick.qb        %[hev1], %[ones],  $0           \n\t"
      "subu_s.qb      %[r_k],  %[q1],    %[p1]        \n\t"
      "or             %[s2],   %[r_k],   %[c]         \n\t"

      /* abs(p0 - q0) * 2 + abs(p1 - q1) / 2  > flimit * 2 + limit */
      "shrl.qb        %[s2],   %[s2],     1           \n\t"
      "addu_s.qb      %[s1],   %[s2],     %[s3]       \n\t"
      "cmpgu.lt.qb    %[c],    %[flimit], %[s1]       \n\t"
      "or             %[r],    %[r],      %[c]        \n\t"
      "sll            %[r],    %[r],      24          \n\t"

      "wrdsp          %[r]                            \n\t"
      "pick.qb        %[s2],   $0,        %[ones]     \n\t"

      : [c] "=&r"(c), [r_k] "=&r"(r_k), [s1] "=&r"(s1), [hev1] "=&r"(hev1),
        [s2] "=&r"(s2), [r] "+r"(r), [s3] "=&r"(s3)
      : [p0] "r"(p0), [q0] "r"(q0), [p1] "r"(p1), [r3] "r"(r3), [q1] "r"(q1),
        [ones] "r"(ones), [flimit] "r"(flimit));

  *hev = hev1;
  *mask = s2;
  *flat = flat1;
}

static INLINE void flatmask5(uint32_t p4, uint32_t p3, uint32_t p2, uint32_t p1,
                             uint32_t p0, uint32_t q0, uint32_t q1, uint32_t q2,
                             uint32_t q3, uint32_t q4, uint32_t *flat2) {
  uint32_t c, r, r_k, r_flat;
  uint32_t ones = 0xFFFFFFFF;
  uint32_t flat_thresh = 0x01010101;
  uint32_t flat1, flat3;

  __asm__ __volatile__(
      /* flat |= (abs(p4 - p0) > thresh) */
      "subu_s.qb      %[c],   %[p4],           %[p0]        \n\t"
      "subu_s.qb      %[r_k], %[p0],           %[p4]        \n\t"
      "or             %[r_k], %[r_k],          %[c]         \n\t"
      "cmpgu.lt.qb    %[c],   %[flat_thresh],  %[r_k]       \n\t"
      "or             %[r],   $0,              %[c]         \n\t"

      /* flat |= (abs(q4 - q0) > thresh) */
      "subu_s.qb      %[c],     %[q4],           %[q0]     \n\t"
      "subu_s.qb      %[r_k],   %[q0],           %[q4]     \n\t"
      "or             %[r_k],   %[r_k],          %[c]      \n\t"
      "cmpgu.lt.qb    %[c],     %[flat_thresh],  %[r_k]    \n\t"
      "or             %[r],     %[r],            %[c]      \n\t"
      "sll            %[r],     %[r],            24        \n\t"
      "wrdsp          %[r]                                 \n\t"
      "pick.qb        %[flat3], $0,           %[ones]      \n\t"

      /* flat |= (abs(p1 - p0) > thresh) */
      "subu_s.qb      %[c],       %[p1],          %[p0]        \n\t"
      "subu_s.qb      %[r_k],     %[p0],          %[p1]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[flat_thresh], %[r_k]       \n\t"
      "or             %[r_flat],  $0,             %[c]         \n\t"

      /* flat |= (abs(q1 - q0) > thresh) */
      "subu_s.qb      %[c],      %[q1],           %[q0]        \n\t"
      "subu_s.qb      %[r_k],    %[q0],           %[q1]        \n\t"
      "or             %[r_k],    %[r_k],          %[c]         \n\t"
      "cmpgu.lt.qb    %[c],      %[flat_thresh],  %[r_k]       \n\t"
      "or             %[r_flat], %[r_flat],       %[c]         \n\t"

      /* flat |= (abs(p0 - p2) > thresh) */
      "subu_s.qb      %[c],       %[p0],          %[p2]        \n\t"
      "subu_s.qb      %[r_k],     %[p2],          %[p0]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[flat_thresh], %[r_k]       \n\t"
      "or             %[r_flat],  %[r_flat],      %[c]         \n\t"

      /* flat |= (abs(q0 - q2) > thresh) */
      "subu_s.qb      %[c],       %[q0],          %[q2]        \n\t"
      "subu_s.qb      %[r_k],     %[q2],          %[q0]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[flat_thresh], %[r_k]       \n\t"
      "or             %[r_flat],  %[r_flat],      %[c]         \n\t"

      /* flat |= (abs(p3 - p0) > thresh) */
      "subu_s.qb      %[c],       %[p3],          %[p0]        \n\t"
      "subu_s.qb      %[r_k],     %[p0],          %[p3]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[flat_thresh], %[r_k]       \n\t"
      "or             %[r_flat],  %[r_flat],      %[c]         \n\t"

      /* flat |= (abs(q3 - q0) > thresh) */
      "subu_s.qb      %[c],       %[q3],          %[q0]        \n\t"
      "subu_s.qb      %[r_k],     %[q0],          %[q3]        \n\t"
      "or             %[r_k],     %[r_k],         %[c]         \n\t"
      "cmpgu.lt.qb    %[c],       %[flat_thresh], %[r_k]       \n\t"
      "or             %[r_flat],  %[r_flat],      %[c]         \n\t"
      "sll            %[r_flat],  %[r_flat],      24           \n\t"
      "wrdsp          %[r_flat]                                \n\t"
      "pick.qb        %[flat1],   $0,             %[ones]      \n\t"
      /* flat & flatmask4(thresh, p3, p2, p1, p0, q0, q1, q2, q3) */
      "and            %[flat1],  %[flat3],        %[flat1]     \n\t"

      : [c] "=&r"(c), [r_k] "=&r"(r_k), [r] "=&r"(r), [r_flat] "=&r"(r_flat),
        [flat1] "=&r"(flat1), [flat3] "=&r"(flat3)
      : [p4] "r"(p4), [p3] "r"(p3), [p2] "r"(p2), [p1] "r"(p1), [p0] "r"(p0),
        [q0] "r"(q0), [q1] "r"(q1), [q2] "r"(q2), [q3] "r"(q3), [q4] "r"(q4),
        [flat_thresh] "r"(flat_thresh), [ones] "r"(ones));

  *flat2 = flat1;
}
#endif  // #if HAVE_DSPR2
#ifdef __cplusplus
}  // extern "C"
#endif

#endif  // VP9_COMMON_MIPS_DSPR2_VP9_LOOPFILTER_MASKS_DSPR2_H_