1 /*
2  *  Copyright (c) 2013 The WebM project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef VPX_VPX_DSP_MIPS_INV_TXFM_DSPR2_H_
12 #define VPX_VPX_DSP_MIPS_INV_TXFM_DSPR2_H_
13 
14 #include <assert.h>
15 
16 #include "./vpx_config.h"
17 #include "vpx/vpx_integer.h"
18 #include "vpx_dsp/inv_txfm.h"
19 #include "vpx_dsp/mips/common_dspr2.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #if HAVE_DSPR2
26 #define DCT_CONST_ROUND_SHIFT_TWICE_COSPI_16_64(input)                         \
27   ({                                                                           \
28     int32_t tmp, out;                                                          \
29     int dct_cost_rounding = DCT_CONST_ROUNDING;                                \
30     int in = input;                                                            \
31                                                                                \
32     __asm__ __volatile__(/* out = dct_const_round_shift(dc *  cospi_16_64); */ \
33                          "mtlo     %[dct_cost_rounding],   $ac1              " \
34                          "                \n\t"                                \
35                          "mthi     $zero,                  $ac1              " \
36                          "                \n\t"                                \
37                          "madd     $ac1,                   %[in],            " \
38                          "%[cospi_16_64]  \n\t"                                \
39                          "extp     %[tmp],                 $ac1,             " \
40                          "31              \n\t"                                \
41                                                                                \
42                          /* out = dct_const_round_shift(out * cospi_16_64); */ \
43                          "mtlo     %[dct_cost_rounding],   $ac2              " \
44                          "                \n\t"                                \
45                          "mthi     $zero,                  $ac2              " \
46                          "                \n\t"                                \
47                          "madd     $ac2,                   %[tmp],           " \
48                          "%[cospi_16_64]  \n\t"                                \
49                          "extp     %[out],                 $ac2,             " \
50                          "31              \n\t"                                \
51                                                                                \
52                          : [tmp] "=&r"(tmp), [out] "=r"(out)                   \
53                          : [in] "r"(in),                                       \
54                            [dct_cost_rounding] "r"(dct_cost_rounding),         \
55                            [cospi_16_64] "r"(cospi_16_64));                    \
56     out;                                                                       \
57   })
58 
59 void vpx_idct32_cols_add_blk_dspr2(int16_t *input, uint8_t *dest, int stride);
60 void vpx_idct4_rows_dspr2(const int16_t *input, int16_t *output);
61 void vpx_idct4_columns_add_blk_dspr2(int16_t *input, uint8_t *dest, int stride);
62 void iadst4_dspr2(const int16_t *input, int16_t *output);
63 void idct8_rows_dspr2(const int16_t *input, int16_t *output, uint32_t no_rows);
64 void idct8_columns_add_blk_dspr2(int16_t *input, uint8_t *dest, int stride);
65 void iadst8_dspr2(const int16_t *input, int16_t *output);
66 void idct16_rows_dspr2(const int16_t *input, int16_t *output, uint32_t no_rows);
67 void idct16_cols_add_blk_dspr2(int16_t *input, uint8_t *dest, int stride);
68 void iadst16_dspr2(const int16_t *input, int16_t *output);
69 
70 #endif  // #if HAVE_DSPR2
71 #ifdef __cplusplus
72 }  // extern "C"
73 #endif
74 
75 #endif  // VPX_VPX_DSP_MIPS_INV_TXFM_DSPR2_H_
76