15ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang/* 25ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang * Copyright (c) 2013 The WebM project authors. All Rights Reserved. 35ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang * 45ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang * Use of this source code is governed by a BSD-style license 55ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang * that can be found in the LICENSE file in the root of the source 65ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang * tree. An additional intellectual property rights grant can be found 75ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang * in the file PATENTS. All contributing project authors may 85ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang * be found in the AUTHORS file in the root of the source tree. 95ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang */ 105ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang 11da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian#ifndef VPX_DSP_MIPS_INV_TXFM_DSPR2_H_ 12da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian#define VPX_DSP_MIPS_INV_TXFM_DSPR2_H_ 135ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang 145ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include <assert.h> 155ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang 165ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include "./vpx_config.h" 175ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#include "vpx/vpx_integer.h" 18da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian#include "vpx_dsp/inv_txfm.h" 19da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian#include "vpx_dsp/mips/common_dspr2.h" 205ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang 21b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian#ifdef __cplusplus 22b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanianextern "C" { 23b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian#endif 24b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian 255ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#if HAVE_DSPR2 265ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#define DCT_CONST_ROUND_SHIFT_TWICE_COSPI_16_64(input) ({ \ 275ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang \ 285ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang int32_t tmp, out; \ 295ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang int dct_cost_rounding = DCT_CONST_ROUNDING; \ 305ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang int in = input; \ 315ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang \ 325ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang __asm__ __volatile__ ( \ 335ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang /* out = dct_const_round_shift(input_dc * cospi_16_64); */ \ 345ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang "mtlo %[dct_cost_rounding], $ac1 \n\t"\ 355ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang "mthi $zero, $ac1 \n\t"\ 365ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang "madd $ac1, %[in], %[cospi_16_64] \n\t"\ 375ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang "extp %[tmp], $ac1, 31 \n\t"\ 385ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang \ 395ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang /* out = dct_const_round_shift(out * cospi_16_64); */ \ 405ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang "mtlo %[dct_cost_rounding], $ac2 \n\t"\ 415ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang "mthi $zero, $ac2 \n\t"\ 425ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang "madd $ac2, %[tmp], %[cospi_16_64] \n\t"\ 435ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang "extp %[out], $ac2, 31 \n\t"\ 445ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang \ 455ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang : [tmp] "=&r" (tmp), [out] "=r" (out) \ 465ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang : [in] "r" (in), \ 475ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang [dct_cost_rounding] "r" (dct_cost_rounding), \ 485ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang [cospi_16_64] "r" (cospi_16_64) \ 495ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang ); \ 505ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang out; }) 515ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang 52da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanianvoid vpx_idct32_cols_add_blk_dspr2(int16_t *input, uint8_t *dest, 53b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian int dest_stride); 54da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanianvoid vpx_idct4_rows_dspr2(const int16_t *input, int16_t *output); 55da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanianvoid vpx_idct4_columns_add_blk_dspr2(int16_t *input, uint8_t *dest, 56da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian int dest_stride); 57da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanianvoid iadst4_dspr2(const int16_t *input, int16_t *output); 58da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanianvoid idct8_rows_dspr2(const int16_t *input, int16_t *output, uint32_t no_rows); 59da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanianvoid idct8_columns_add_blk_dspr2(int16_t *input, uint8_t *dest, 60da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian int dest_stride); 61da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanianvoid iadst8_dspr2(const int16_t *input, int16_t *output); 62da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanianvoid idct16_rows_dspr2(const int16_t *input, int16_t *output, 63da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian uint32_t no_rows); 64da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanianvoid idct16_cols_add_blk_dspr2(int16_t *input, uint8_t *dest, 65da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian int dest_stride); 66da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanianvoid iadst16_dspr2(const int16_t *input, int16_t *output); 675ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang 685ae7ac49f08a179e4f054d99fcfc9dce78d26e58hkuang#endif // #if HAVE_DSPR2 69b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian#ifdef __cplusplus 70b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian} // extern "C" 71b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian#endif 72b08e2e23eec181e9951df33cd704ac294c5407b6Vignesh Venkatasubramanian 73da49e34c1fb5e99681f4ad99c21d9cfd83eddb96Vignesh Venkatasubramanian#endif // VPX_DSP_MIPS_INV_TXFM_DSPR2_H_ 74