• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2016, 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 "aom_dsp/mips/common_dspr2.h"
13 
14 #if HAVE_DSPR2
aom_h_predictor_4x4_dspr2(uint8_t * dst,ptrdiff_t stride,const uint8_t * above,const uint8_t * left)15 void aom_h_predictor_4x4_dspr2(uint8_t *dst, ptrdiff_t stride,
16                                const uint8_t *above, const uint8_t *left) {
17   int32_t tmp1, tmp2, tmp3, tmp4;
18   (void)above;
19 
20   __asm__ __volatile__(
21       "lb         %[tmp1],      (%[left])                    \n\t"
22       "lb         %[tmp2],      1(%[left])                   \n\t"
23       "lb         %[tmp3],      2(%[left])                   \n\t"
24       "lb         %[tmp4],      3(%[left])                   \n\t"
25       "replv.qb   %[tmp1],      %[tmp1]                      \n\t"
26       "replv.qb   %[tmp2],      %[tmp2]                      \n\t"
27       "replv.qb   %[tmp3],      %[tmp3]                      \n\t"
28       "replv.qb   %[tmp4],      %[tmp4]                      \n\t"
29       "sw         %[tmp1],      (%[dst])                     \n\t"
30       "add        %[dst],       %[dst],         %[stride]    \n\t"
31       "sw         %[tmp2],      (%[dst])                     \n\t"
32       "add        %[dst],       %[dst],         %[stride]    \n\t"
33       "sw         %[tmp3],      (%[dst])                     \n\t"
34       "add        %[dst],       %[dst],         %[stride]    \n\t"
35       "sw         %[tmp4],      (%[dst])                     \n\t"
36 
37       : [tmp1] "=&r"(tmp1), [tmp2] "=&r"(tmp2), [tmp3] "=&r"(tmp3),
38         [tmp4] "=&r"(tmp4)
39       : [left] "r"(left), [dst] "r"(dst), [stride] "r"(stride));
40 }
41 
aom_dc_predictor_4x4_dspr2(uint8_t * dst,ptrdiff_t stride,const uint8_t * above,const uint8_t * left)42 void aom_dc_predictor_4x4_dspr2(uint8_t *dst, ptrdiff_t stride,
43                                 const uint8_t *above, const uint8_t *left) {
44   int32_t expected_dc;
45   int32_t average;
46   int32_t tmp, above_c, above_l, above_r, left_c, left_r, left_l;
47 
48   __asm__ __volatile__(
49       "lw              %[above_c],         (%[above])                    \n\t"
50       "lw              %[left_c],          (%[left])                     \n\t"
51 
52       "preceu.ph.qbl   %[above_l],         %[above_c]                    \n\t"
53       "preceu.ph.qbr   %[above_r],         %[above_c]                    \n\t"
54       "preceu.ph.qbl   %[left_l],          %[left_c]                     \n\t"
55       "preceu.ph.qbr   %[left_r],          %[left_c]                     \n\t"
56 
57       "addu.ph         %[average],         %[above_r],       %[above_l]  \n\t"
58       "addu.ph         %[average],         %[average],       %[left_l]   \n\t"
59       "addu.ph         %[average],         %[average],       %[left_r]   \n\t"
60       "addiu           %[average],         %[average],       4           \n\t"
61       "srl             %[tmp],             %[average],       16          \n\t"
62       "addu.ph         %[average],         %[tmp],           %[average]  \n\t"
63       "srl             %[expected_dc],     %[average],       3           \n\t"
64       "replv.qb        %[expected_dc],     %[expected_dc]                \n\t"
65 
66       "sw              %[expected_dc],     (%[dst])                      \n\t"
67       "add             %[dst],              %[dst],          %[stride]   \n\t"
68       "sw              %[expected_dc],     (%[dst])                      \n\t"
69       "add             %[dst],              %[dst],          %[stride]   \n\t"
70       "sw              %[expected_dc],     (%[dst])                      \n\t"
71       "add             %[dst],              %[dst],          %[stride]   \n\t"
72       "sw              %[expected_dc],     (%[dst])                      \n\t"
73 
74       : [above_c] "=&r"(above_c), [above_l] "=&r"(above_l),
75         [above_r] "=&r"(above_r), [left_c] "=&r"(left_c),
76         [left_l] "=&r"(left_l), [left_r] "=&r"(left_r),
77         [average] "=&r"(average), [tmp] "=&r"(tmp),
78         [expected_dc] "=&r"(expected_dc)
79       : [above] "r"(above), [left] "r"(left), [dst] "r"(dst),
80         [stride] "r"(stride));
81 }
82 #endif  // #if HAVE_DSPR2
83