Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 9c01aa1 | 2016-09-01 14:32:49 -0700 | [diff] [blame] | 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. |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 12 | #ifndef AOM_DSP_MIPS_INV_TXFM_DSPR2_H_ |
| 13 | #define AOM_DSP_MIPS_INV_TXFM_DSPR2_H_ |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 14 | |
| 15 | #include <assert.h> |
| 16 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 17 | #include "./aom_config.h" |
| 18 | #include "aom/aom_integer.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 19 | #include "aom_dsp/inv_txfm.h" |
| 20 | #include "aom_dsp/mips/common_dspr2.h" |
| 21 | |
| 22 | #ifdef __cplusplus |
| 23 | extern "C" { |
| 24 | #endif |
| 25 | |
| 26 | #if HAVE_DSPR2 |
| 27 | #define DCT_CONST_ROUND_SHIFT_TWICE_COSPI_16_64(input) \ |
| 28 | ({ \ |
| 29 | \ |
| 30 | int32_t tmp, out; \ |
| 31 | int dct_cost_rounding = DCT_CONST_ROUNDING; \ |
| 32 | int in = input; \ |
| 33 | \ |
| 34 | __asm__ __volatile__(/* out = dct_const_round_shift(dc * cospi_16_64); */ \ |
| 35 | "mtlo %[dct_cost_rounding], $ac1 " \ |
| 36 | " \n\t" \ |
| 37 | "mthi $zero, $ac1 " \ |
| 38 | " \n\t" \ |
| 39 | "madd $ac1, %[in], " \ |
| 40 | "%[cospi_16_64] \n\t" \ |
| 41 | "extp %[tmp], $ac1, " \ |
| 42 | "31 \n\t" \ |
| 43 | \ |
| 44 | /* out = dct_const_round_shift(out * cospi_16_64); */ \ |
| 45 | "mtlo %[dct_cost_rounding], $ac2 " \ |
| 46 | " \n\t" \ |
| 47 | "mthi $zero, $ac2 " \ |
| 48 | " \n\t" \ |
| 49 | "madd $ac2, %[tmp], " \ |
| 50 | "%[cospi_16_64] \n\t" \ |
| 51 | "extp %[out], $ac2, " \ |
| 52 | "31 \n\t" \ |
| 53 | \ |
| 54 | : [tmp] "=&r"(tmp), [out] "=r"(out) \ |
| 55 | : [in] "r"(in), \ |
| 56 | [dct_cost_rounding] "r"(dct_cost_rounding), \ |
| 57 | [cospi_16_64] "r"(cospi_16_64)); \ |
| 58 | out; \ |
| 59 | }) |
| 60 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 61 | void aom_idct32_cols_add_blk_dspr2(int16_t *input, uint8_t *dest, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 62 | int dest_stride); |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 63 | void aom_idct4_rows_dspr2(const int16_t *input, int16_t *output); |
| 64 | void aom_idct4_columns_add_blk_dspr2(int16_t *input, uint8_t *dest, |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 65 | int dest_stride); |
| 66 | void iadst4_dspr2(const int16_t *input, int16_t *output); |
| 67 | void idct8_rows_dspr2(const int16_t *input, int16_t *output, uint32_t no_rows); |
| 68 | void idct8_columns_add_blk_dspr2(int16_t *input, uint8_t *dest, |
| 69 | int dest_stride); |
| 70 | void iadst8_dspr2(const int16_t *input, int16_t *output); |
| 71 | void idct16_rows_dspr2(const int16_t *input, int16_t *output, uint32_t no_rows); |
| 72 | void idct16_cols_add_blk_dspr2(int16_t *input, uint8_t *dest, int dest_stride); |
| 73 | void iadst16_dspr2(const int16_t *input, int16_t *output); |
| 74 | |
| 75 | #endif // #if HAVE_DSPR2 |
| 76 | #ifdef __cplusplus |
| 77 | } // extern "C" |
| 78 | #endif |
| 79 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 80 | #endif // AOM_DSP_MIPS_INV_TXFM_DSPR2_H_ |